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)
Fri, Jan 3, 6:22 AM
Unknown Object (File)
Thu, Dec 26, 1:32 PM
Unknown Object (File)
Dec 4 2024, 8:33 PM
Unknown Object (File)
Dec 4 2024, 8:33 PM
Unknown Object (File)
Dec 4 2024, 8:33 PM
Unknown Object (File)
Dec 4 2024, 8:32 PM
Unknown Object (File)
Dec 4 2024, 8:32 PM
Unknown Object (File)
Dec 4 2024, 8:12 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.