Use ip_af_t rather than sa_family_t. We only want to handle AF_INET and
AF_INET6, and this lets us skip the 'default: panic()' case in a number of
switch statements.
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential D46809
pf: start using ip_af_t kp on Sep 27 2024, 9:54 AM. Authored by Tags None Referenced Files
Details
Diff Detail
Event TimelineComment Actions What's the desired behaviour of this code though if you don't define inet and inet6? Why would you even build pf at that point? For example - you'd end up with a bunch of ke/ke2 in pf_table.c being not set, but then checked. What's that even mean? If it were me, I'd have an AF_UNDEFINED = 0 or something as the first / always exist entry in the enum, and always handle AF_UNDEFINED with an appropriate action - eg stopping the function at that point, logging/counting an error, etc. That way it also always compiles w/ a NOINET kernel. Also - the missed #ifdef in pf_islinklocal() for AF_INET6 - is this a fallout from reusing AF_INET/AF_INET6 in that enum, versus defining new names so you'd get appropriate compiler errors? :)
|