Page MenuHomeFreeBSD

pf: start using ip_af_t
AbandonedPublic

Authored by kp on Sep 27 2024, 9:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 25 2025, 12:48 PM
Unknown Object (File)
Feb 8 2025, 6:05 AM
Unknown Object (File)
Dec 18 2024, 5:57 AM
Unknown Object (File)
Nov 24 2024, 1:23 AM
Unknown Object (File)
Nov 21 2024, 9:42 AM
Unknown Object (File)
Nov 16 2024, 2:25 AM
Unknown Object (File)
Nov 15 2024, 12:59 PM
Unknown Object (File)
Nov 4 2024, 8:06 PM

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 ?