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)
Fri, Nov 1, 3:23 PM
Unknown Object (File)
Tue, Oct 29, 2:47 AM
Unknown Object (File)
Sun, Oct 27, 4:37 PM
Unknown Object (File)
Tue, Oct 22, 3:16 AM
Unknown Object (File)
Sun, Oct 20, 7:52 PM
Unknown Object (File)
Oct 7 2024, 2:43 PM
Unknown Object (File)
Sep 27 2024, 11:45 PM
Unknown Object (File)
Sep 27 2024, 11:45 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 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