Page MenuHomeFreeBSD

pf: dedupe layer 4 protocol code in pf_setup_pdesc()
ClosedPublic

Authored by kp on Thu, Sep 12, 11:57 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 5, 10:56 AM
Unknown Object (File)
Thu, Oct 3, 9:48 AM
Unknown Object (File)
Thu, Oct 3, 9:08 AM
Unknown Object (File)
Thu, Oct 3, 8:35 AM
Unknown Object (File)
Wed, Oct 2, 4:15 PM
Unknown Object (File)
Wed, Oct 2, 4:14 PM
Unknown Object (File)
Wed, Oct 2, 4:14 PM
Unknown Object (File)
Wed, Oct 2, 4:01 PM

Details

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 Not Applicable
Unit
Tests Not Applicable

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.

This revision was not accepted when it landed; it landed in state Needs Review.Wed, Sep 25, 12:35 PM
This revision was automatically updated to reflect the committed changes.