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
F96070634: D32709.diff
Mon, Sep 23, 2:33 PM
Unknown Object (File)
Tue, Sep 17, 9:47 AM
Unknown Object (File)
Thu, Sep 12, 4:47 PM
Unknown Object (File)
Sat, Sep 7, 6:31 PM
Unknown Object (File)
Wed, Sep 4, 1:32 PM
Unknown Object (File)
Aug 24 2024, 5:40 AM
Unknown Object (File)
Aug 24 2024, 1:12 AM
Unknown Object (File)
Aug 19 2024, 6:16 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 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