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
F152850495: D32709.id98247.diff
Fri, Apr 17, 12:22 PM
F152698382: D32709.id97613.diff
Thu, Apr 16, 2:08 PM
Unknown Object (File)
Wed, Apr 15, 8:53 PM
Unknown Object (File)
Wed, Apr 15, 11:23 AM
Unknown Object (File)
Sat, Apr 11, 9:16 AM
Unknown Object (File)
Sun, Apr 5, 8:00 PM
Unknown Object (File)
Sat, Mar 28, 8:48 AM
Unknown Object (File)
Fri, Mar 27, 9:15 PM
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 42586
Build 39474: 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