Page MenuHomeFreeBSD

Document and enforce assumptions about struct (in6_)ifreq.
ClosedPublic

Authored by brooks on Mar 30 2018, 5:43 PM.
Tags
None
Referenced Files
F114614852: D14910.diff
Mon, Apr 14, 11:09 AM
Unknown Object (File)
Mon, Apr 14, 4:53 AM
Unknown Object (File)
Mon, Apr 14, 12:44 AM
Unknown Object (File)
Mon, Apr 14, 12:22 AM
Unknown Object (File)
Sun, Apr 13, 11:41 PM
Unknown Object (File)
Sun, Apr 13, 11:13 PM
Unknown Object (File)
Mar 11 2025, 12:00 AM
Unknown Object (File)
Mar 9 2025, 7:37 AM
Subscribers

Details

Summary
  • The two types must be type-punnable for shared members of ifr_ifru. This allows compatibility accessors to be shared.
  • There must be no padding gap between ifr_name and ifr_ifru. This is assumed in tcpdump's use of SIOCGIFFLAGS output which attempts to be broadly portable. This is true for all current architectures, but very large (256-bit) fat-pointers could violate this invariant.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 15899
Build 15899: arc lint + arc unit

Event Timeline

  • Use _Static_assert which is defined in sys/cdefs.h rather than CTASSERT
  • Use 0 not NULL for files with strange include orders.
sys/net/if.h
428 ↗(On Diff #40921)

I suggest to move the asserts to some .c file. There is no benefits of forcing all users of if.h to recheck the same stuff, one assert is enough for the developer to notice the issue.

  • Move asserts to .c files.
This revision is now accepted and ready to land.Mar 30 2018, 8:53 PM
This revision was automatically updated to reflect the committed changes.