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)
Feb 8 2025, 2:11 PM
Unknown Object (File)
Jan 30 2025, 1:30 AM
Unknown Object (File)
Jan 30 2025, 12:58 AM
Unknown Object (File)
Jan 30 2025, 12:52 AM
Unknown Object (File)
Jan 25 2025, 7:34 PM
Unknown Object (File)
Jan 24 2025, 5:14 PM
Unknown Object (File)
Jan 22 2025, 5:23 PM
Unknown Object (File)
Jan 21 2025, 5:55 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 42414
Build 39302: 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