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
Unknown Object (File)
Sun, Jan 26, 6:27 PM
Unknown Object (File)
Sat, Jan 25, 7:56 PM
Unknown Object (File)
Sat, Jan 25, 7:22 PM
Unknown Object (File)
Sat, Jan 25, 7:12 PM
Unknown Object (File)
Thu, Jan 23, 5:37 PM
Unknown Object (File)
Jan 3 2025, 6:22 AM
Unknown Object (File)
Dec 26 2024, 1:32 PM
Unknown Object (File)
Dec 4 2024, 8:33 PM
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 15898
Build 15898: 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

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.