Page MenuHomeFreeBSD

pf: start using ip_af_t
Needs ReviewPublic

Authored by kp on Sep 27 2024, 9:54 AM.
Tags
None
Referenced Files
F102663077: D46809.diff
Fri, Nov 15, 12:59 PM
Unknown Object (File)
Mon, Nov 4, 8:06 PM
Unknown Object (File)
Thu, Oct 31, 10:13 AM
Unknown Object (File)
Thu, Oct 24, 5:55 AM
Unknown Object (File)
Sat, Oct 19, 2:09 AM
Unknown Object (File)
Oct 2 2024, 11:23 AM
Unknown Object (File)
Oct 1 2024, 5:02 PM
Unknown Object (File)
Sep 29 2024, 8:29 AM

Details

Reviewers
bz
glebius
Group Reviewers
network
pfsense
Summary

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")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59619
Build 56506: arc lint + arc unit

Event Timeline

kp requested review of this revision.Sep 27 2024, 9:54 AM

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? :)

sys/netpfil/pf/pf_lb.c
406

Is this supposed to be wrapped in an #ifdef ?