Page MenuHomeFreeBSD

pf: dedupe layer 4 protocol code in pf_setup_pdesc()
Needs ReviewPublic

Authored by kp on Thu, Sep 12, 11:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Sep 21, 11:18 AM
Unknown Object (File)
Thu, Sep 19, 10:40 AM
Unknown Object (File)
Tue, Sep 17, 4:45 PM
Unknown Object (File)
Tue, Sep 17, 1:07 PM
Unknown Object (File)
Mon, Sep 16, 2:52 AM
Unknown Object (File)
Thu, Sep 12, 11:13 PM
Unknown Object (File)
Thu, Sep 12, 6:09 PM
Unknown Object (File)
Thu, Sep 12, 6:09 PM

Details

Reviewers
None
Group Reviewers
network
pfsense
Summary

In pf_setup_pdesc() the code for analysing TCP and UDP headers was
the same for v4 and v6. Deduplicate by moving the protocol switch
after the address family switch.
ok henning@ claudio@

Obtained from: OpenBSD, bluhm <bluhm@openbsd.org>, 72cf18cc6e
Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

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

Event Timeline

kp requested review of this revision.Thu, Sep 12, 11:57 AM

I'm a little nervous about this change. It seems invalid combinations such as IPv4/ICMPv6 and IPv6/ICMP are now possible after the change. Do we have some pre-checks about those combinations ?

I'm a little nervous about this change. It seems invalid combinations such as IPv4/ICMPv6 and IPv6/ICMP are now possible after the change. Do we have some pre-checks about those combinations ?

There's an explicit test in pf_test() where we drop such packets. It's introduced in D46649. That's after pf_setup_pdesc(), but I'd argue that that's fine. pf_setup_pdesc() is only meant to set up a context struct, it doesn't have to do the full packet validation.