Page MenuHomeFreeBSD

ifconfig: warn if setting an Internet address without mask
ClosedPublic

Authored by karels on Oct 28 2021, 2:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 12 2024, 11:47 AM
Unknown Object (File)
Mar 12 2024, 11:32 AM
Unknown Object (File)
Mar 7 2024, 4:10 PM
Unknown Object (File)
Feb 12 2024, 4:26 AM
Unknown Object (File)
Feb 1 2024, 11:01 AM
Unknown Object (File)
Jan 28 2024, 5:12 PM
Unknown Object (File)
Dec 17 2023, 9:10 PM
Unknown Object (File)
Oct 17 2023, 10:09 AM
Subscribers

Details

Summary

Add a postproc function for af_inet, and add interface flags as a
parameter. Check there if setting an address without a mask unless
the interface is loopback or point-to-point, where mask is not really
meaningful; warn if so. This will hopefully be an error in the future.

Test Plan

Tested with and without masks.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42524
Build 39412: arc lint + arc unit

Event Timeline

Otherwise looks good to me but I am not the best ifconfig-review person; especially I cannot test the v4 changes (easily)

sbin/ifconfig/ifconfig.c
1182

Can you make this a bool?

Change getifflags() err_ok parameter to bool

No one seems to have done structural work on ifconfig for a while. Suggestions for other reviewers welcome, but I think it is pretty well tested.

sbin/ifconfig/ifconfig.c
1182

Good suggestion, thanks.

karels marked an inline comment as done.

Fix delete case

Still looks okay (untested); the ifconfig man page examples section seemed to already look good; src/libexec/rc/rc.conf probably needs a pass as well.

This revision is now accepted and ready to land.Nov 9 2021, 3:16 PM