#
029532e7 |
| 30-Jul-2025 |
Kristof Provost <kp@FreeBSD.org> |
pf: also allocate ethernet anchors from a UMA zone
As per the previous commit, ensure we can't endlessly allocate ethernet anchors.
Sponsored by: Rubicon Communications, LLC ("Netgate")
|
#
31131a9d |
| 30-Jul-2025 |
Kristof Provost <kp@FreeBSD.org> |
pf: allocate pf_kanchor from a pool
Add a pool for the allocation of the pf_anchor struct. It was possible to exhaust kernel memory by repeatedly calling pfioctl DIOCXBEGIN with different anchor nam
pf: allocate pf_kanchor from a pool
Add a pool for the allocation of the pf_anchor struct. It was possible to exhaust kernel memory by repeatedly calling pfioctl DIOCXBEGIN with different anchor names. OK bluhm@ Reported-by: syzbot+9dd98cbce69e26f0fc11@syzkaller.appspotmail.com
Obtained from: OpenBSD, mbuhl <mbuhl@openbsd.org>, fa90ac5c78 Obtained from: OpenBSD, mbuhl <mbuhl@openbsd.org>, c259202341 Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
#
7250fc4e |
| 08-Jul-2025 |
Kristof Provost <kp@FreeBSD.org> |
pflog: improve uid logging
Sometimes a user ID was logged in pflog(4) although the logopt of the rule did not specify it. Check the option again for the log rule in case another rule has triggered
pflog: improve uid logging
Sometimes a user ID was logged in pflog(4) although the logopt of the rule did not specify it. Check the option again for the log rule in case another rule has triggered a socket lookup. Remove logopt group, it is not documented and cannot work as struct pfloghdr does not contain a gid. Rename PF_LOG_SOCKET_LOOKUP to PF_LOG_USER to express what it does. The lookup involved is only an implemntation detail. OK kn@ sashan@ mvs@
Obtained from: OpenBSD, bluhm <bluhm@openbsd.org>, f6d3bf21b2 Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
#
9f21a946 |
| 07-Jul-2025 |
Kristof Provost <kp@FreeBSD.org> |
pf: rename PF_OPT_TABLE_PREFIX to PF_OPTIMIZER_TABLE_PFX
Move it to pf.h. OPT is misleading and usually refers to command line arguments to pfctl
ok sashan kn
Obtained from: OpenBSD, henning <henn
pf: rename PF_OPT_TABLE_PREFIX to PF_OPTIMIZER_TABLE_PFX
Move it to pf.h. OPT is misleading and usually refers to command line arguments to pfctl
ok sashan kn
Obtained from: OpenBSD, henning <henning@openbsd.org>, 9c6ad19ba4 Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
Revision tags: release/14.3.0-p1, release/14.2.0-p4, release/13.5.0-p2, release/14.3.0 |
|
#
54a547fc |
| 30-May-2025 |
Kristof Provost <kp@FreeBSD.org> |
pf: split pf_find_or_create_ruleset() into smaller chunks
tested by Hrvoje OK mpi@, OK bluhm@
Obtained from: OpenBSD, sashan <sashan@openbsd.org>, 0d5abfc5ba Sponsored by: Rubicon Communications, L
pf: split pf_find_or_create_ruleset() into smaller chunks
tested by Hrvoje OK mpi@, OK bluhm@
Obtained from: OpenBSD, sashan <sashan@openbsd.org>, 0d5abfc5ba Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D50725
show more ...
|
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4 |
|
#
c2346c3d |
| 13-Feb-2025 |
Kristof Provost <kp@FreeBSD.org> |
pf: support source-hash and random with tables and dynifs, not just pools
This finally allows to use source-hash for dynamic loadbalancing, eg. "rdr-to <hosts> source-hash", instead of just round-ro
pf: support source-hash and random with tables and dynifs, not just pools
This finally allows to use source-hash for dynamic loadbalancing, eg. "rdr-to <hosts> source-hash", instead of just round-robin and least-states.
An older pre-siphash version of this diff was tested by many people.
OK tedu@ benno@
Obtained from: OpenBSD, reyk <reyk@openbsd.org>, 252a05523f Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
#
07e070ef |
| 07-Feb-2025 |
Kajetan Staszkiewicz <ks@FreeBSD.org> |
pf: Add support for multiple source node types
For every state pf creates up to two source nodes: a limiting one struct pf_kstate -> src_node and a NAT one struct pf_kstate -> nat_src_node. The limi
pf: Add support for multiple source node types
For every state pf creates up to two source nodes: a limiting one struct pf_kstate -> src_node and a NAT one struct pf_kstate -> nat_src_node. The limiting source node is tracking information needed for limits using max-src-states and max-src-nodes and the NAT source node is tracking NAT rules only.
On closer inspection some issues emerge: - For route-to rules the redirection decision is stored in the limiting source node. Thus sticky-address and source limiting can't be used separately. - Global source tracking, as promised in the man page, is totally absent from the code. Pfctl is capable of setting flags PFRULE_SRCTRACK (enable source tracking) and PFRULE_RULESRCTRACK (make source tracking per rule). The kernel code checks PFRULE_SRCTRACK but ignores PFRULE_RULESRCTRACK. That makes source tracking work per-rule only.
This patch is based on OpenBSD approach where source nodes have a type and each state has an array of source node pointers indexed by source node type instead of just two pointers. The conditions for limiting are applied only to source nodes of PF_SN_LIMIT type. For global limit tracking source nodes are attached to the default rule.
Reviewed by: kp Approved by: kp (mentor) Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D39880
show more ...
|
#
c11d317a |
| 10-Feb-2025 |
Kristof Provost <kp@FreeBSD.org> |
pf: do not reset the fragment timeout each time a fragment arrives
Start the expire counter when the queue is created by the first fragment and drop it if the packet could not be reassembled within
pf: do not reset the fragment timeout each time a fragment arrives
Start the expire counter when the queue is created by the first fragment and drop it if the packet could not be reassembled within 60 seconds. Reported by Antonios Atlasis; OK henning@ deraadt@
Obtained from: OpenBSD, bluhm <bluhm@openbsd.org>, 4697a20621 Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
#
9a538abd |
| 05-Feb-2025 |
Kristof Provost <kp@FreeBSD.org> |
pf: add 'translation' counter
Add a separate "translation" counter and use this rather than "memory" when address translation fails due to no free ports in the configured range. ok mikeb@
Obtained
pf: add 'translation' counter
Add a separate "translation" counter and use this rather than "memory" when address translation fails due to no free ports in the configured range. ok mikeb@
Obtained from: OpenBSD, sthen <sthen@openbsd.org>, 70ff79155f Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
Revision tags: release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3 |
|
#
0972294e |
| 20-Jan-2025 |
Kristof Provost <kp@FreeBSD.org> |
pf: add a dedicated pf pool for route options
As suggested by henning. Which unbreaks ie route-to after the recent pf changes.
With much help debugging and pointing out of missing bits from claudio
pf: add a dedicated pf pool for route options
As suggested by henning. Which unbreaks ie route-to after the recent pf changes.
With much help debugging and pointing out of missing bits from claudio@
ok claudio@ "looks good" henning@
Obtained from: OpenBSD, jsg <jsg@openbsd.org>, 7fa5c09028 Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
#
e4f2733d |
| 09-Jan-2025 |
Kristof Provost <kp@FreeBSD.org> |
pf: add 'allow-related' to always allow SCTP multihome extra connections
Allow users to choose to allow permitted SCTP connections to set up additional multihomed connections regardless of the rules
pf: add 'allow-related' to always allow SCTP multihome extra connections
Allow users to choose to allow permitted SCTP connections to set up additional multihomed connections regardless of the ruleset. That is, allow an already established connection to set up flows that would otherwise be disallowed.
In case of if-bound connections we initially set the extra associations to be floating, because we don't know what path they'll be taking when they're created. Once we see the first traffic we can bind them.
MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D48453
show more ...
|
#
f88019e8 |
| 07-Jan-2025 |
Kristof Provost <kp@FreeBSD.org> |
pf: fixup af-to regression with match rules
pfctl should not infer the af-to behavior from the af/naf difference. instead, we should be clear that this is an af-to rule. essentially this change con
pf: fixup af-to regression with match rules
pfctl should not infer the af-to behavior from the af/naf difference. instead, we should be clear that this is an af-to rule. essentially this change converts FOM_AFTO marker into a rule flag PFRULE_AFTO so that we don't rely on ambiguous checks (like r->af != r->naf) when setting things up.
positive review and comments from claudio, ok henning, sperreault
Obtained from: OpenBSD, mikeb <mikeb@openbsd.org>, fc302162c0 Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
Revision tags: release/14.2.0 |
|
#
fcdb520c |
| 07-Oct-2024 |
Kristof Provost <kp@FreeBSD.org> |
pf: nat64
Since the IPv6 madness is not enough introduce NAT64 -- which is actually "af-to" a generic IP version translator for pf(4). Not everything perfect yet but lets fix these things in the tre
pf: nat64
Since the IPv6 madness is not enough introduce NAT64 -- which is actually "af-to" a generic IP version translator for pf(4). Not everything perfect yet but lets fix these things in the tree. Insane amount of work done by sperreault@, mikeb@ and reyk@. Looked over by mcbride@ henning@ and myself at eurobsdcon. OK mcbride@ and general put it in from deraadt@
Obtained from: OpenBSD, claudio <claudio@openbsd.org>, 97326e01c9 Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D47786
show more ...
|
#
288bec2b |
| 13-Sep-2024 |
Kristof Provost <kp@FreeBSD.org> |
pf: fold pf_test_fragment() into pf_test_rule()
Reduces code and fixes a bunch of bugs with fragment handling not being in sync with the rest of the ruleset.
Much feedback from mpf, bluhm & markus
pf: fold pf_test_fragment() into pf_test_rule()
Reduces code and fixes a bunch of bugs with fragment handling not being in sync with the rest of the ruleset.
Much feedback from mpf, bluhm & markus Thanks to Tony Sarendal for help with testing
ok bluhm; various previous versions ok henning, claudio, mpf, markus
Note that while this changes the order of src addr/src port/dst addr/dst port skips this doesn't actually affect the kernel/userspace ABI. The kernel always recalculates skip steps. As a result we have to fix one of the pfctl parser tests. Note that this is an order change that does not affect what packets are acceppted or dropped.
Obtained from: OpenBSD, mcbride <mcbride@openbsd.org>, 04c69899a7 Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46705
show more ...
|
Revision tags: release/13.4.0 |
|
#
f3ab00c2 |
| 03-Sep-2024 |
Kristof Provost <kp@FreeBSD.org> |
pf: add a new log opt PF_LOG_MATCHES
forces logging on all subsequent matching rules new log opt "matches" awesome for debugging, a rule like match log(matches) from $testbox will show you exactly w
pf: add a new log opt PF_LOG_MATCHES
forces logging on all subsequent matching rules new log opt "matches" awesome for debugging, a rule like match log(matches) from $testbox will show you exactly which subsequent rules match on that packet real ok theo assumed oks ryan & dlg bikeshedding many
Obtained from: OpenBSD, henning <henning@openbsd.org>, 1603e01ae4 Obtained from: OpenBSD, henning <henning@openbsd.org>, f496e91672 Obtained from: OpenBSD, henning <henning@openbsd.org>, 07481a9fee Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46588
show more ...
|
#
390dc369 |
| 06-Sep-2024 |
Tom Jones <thj@FreeBSD.org> |
pf: Add support for endpoint independent NAT bindings for UDP
With Endpoint Independent NAT bindings for UDP flows from a NATed source address are always mapped to the same ip:port pair on the NAT r
pf: Add support for endpoint independent NAT bindings for UDP
With Endpoint Independent NAT bindings for UDP flows from a NATed source address are always mapped to the same ip:port pair on the NAT router. This allows a client to connect to multiple external servers while appearing as the same host and enables NAT traversal without requiring the client to use a middlebox traversal protocol such as STUN or TURN.
Introduce the 'endpoint-independent' option to NAT rules to allow configuration of endpoint independent without effecting existing deployments.
This change satisfies REQ 1 and 3 of RFC 4787 also known as 'full cone' NAT.
Using Endpoint Independent NAT changes NAT exhaustion behaviour it does not introduce any additional security considerations compared to other forms of NAT.
PR: 219803 Co-authored-by: Damjan Jovanovic <damjan.jov@gmail.com> Co-authored-by: Naman Sood <mail@nsood.in> Reviewed-by: kp Sponsored-by: Tailscale Sponsored-by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D11137
show more ...
|
Revision tags: release/14.1.0, release/13.3.0 |
|
#
baf9b6d0 |
| 01-Dec-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: allow pflow to be activated per rule
Only generate ipfix/netflow reports (through pflow) for the rules where this is enabled. Reports can also be enabled globally through 'set state-default pflo
pf: allow pflow to be activated per rule
Only generate ipfix/netflow reports (through pflow) for the rules where this is enabled. Reports can also be enabled globally through 'set state-default pflow'.
Obtained from: OpenBSD Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D43108
show more ...
|
Revision tags: release/14.0.0 |
|
#
ca9dbde8 |
| 27-Oct-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: support SCTP-specific timeouts
Allow SCTP state timeouts to be configured independently from TCP state timeouts.
Reviewed by: tuexen MFC after: 1 week Sponsored by: Orange Business Services Dif
pf: support SCTP-specific timeouts
Allow SCTP state timeouts to be configured independently from TCP state timeouts.
Reviewed by: tuexen MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D42393
show more ...
|
#
2ff63af9 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
|
#
7b676698 |
| 03-May-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: simplify structs with anonymous unions
Rather than playing preprocessor hacks use actual anonymous unions. No functional change.
Sponsored by: Rubicon Communications, LLC ("Netgate")
|
#
39282ef3 |
| 13-Apr-2023 |
Kajetan Staszkiewicz <vegeta@tuxpowered.net> |
pf: backport OpenBSD syntax of "scrub" option for "match" and "pass" rules
Introduce the OpenBSD syntax of "scrub" option for "match" and "pass" rules and the "set reassemble" flag. The patch is bac
pf: backport OpenBSD syntax of "scrub" option for "match" and "pass" rules
Introduce the OpenBSD syntax of "scrub" option for "match" and "pass" rules and the "set reassemble" flag. The patch is backward-compatible, pf.conf can be still written in FreeBSD-style.
Obtained from: OpenBSD MFC after: never Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D38025
show more ...
|
Revision tags: release/13.2.0, release/12.4.0 |
|
#
57e047e5 |
| 22-Nov-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: allow scrub rules without fragment reassemble
scrub rules have defaulted to handling fragments for a long time, but since we removed "fragment crop" and "fragment drop-ovl" in 64b3b4d611 this ha
pf: allow scrub rules without fragment reassemble
scrub rules have defaulted to handling fragments for a long time, but since we removed "fragment crop" and "fragment drop-ovl" in 64b3b4d611 this has become less obvious and more expensive ("reassemble" being the more expensive option, even if it's the one the vast majority of users should be using).
Extend the 'scrub' syntax to allow fragment reassembly to be disabled, while retaining the other scrub behaviour (e.g. TTL changes, random-id, ..) using 'scrub fragment no reassemble'.
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D37459
show more ...
|
Revision tags: release/13.1.0, release/12.3.0 |
|
#
ce3ea450 |
| 20-Jul-2021 |
Kristof Provost <kp@FreeBSD.org> |
pf: import pf_set_protostate() from OpenBSD
to change a state's state (that term is overloaded in pf, protocol state like ESTABLISHED for tcp here), don't do it directly, but go through a newly intr
pf: import pf_set_protostate() from OpenBSD
to change a state's state (that term is overloaded in pf, protocol state like ESTABLISHED for tcp here), don't do it directly, but go through a newly introduced pf_set_protostate()
Reviewed by: kbowling Obtainted from: OpenBSD MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31729
show more ...
|
#
4cab80a8 |
| 29-Aug-2021 |
Kristof Provost <kp@FreeBSD.org> |
pf: Add counters for syncookies
Count when we send a syncookie, receive a valid syncookie or detect a synflood.
Reviewed by: kbowling MFC after: 1 week Sponsored by: Modirum MDPay Differential Revi
pf: Add counters for syncookies
Count when we send a syncookie, receive a valid syncookie or detect a synflood.
Reviewed by: kbowling MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31713
show more ...
|
#
2b10cf85 |
| 16-Aug-2021 |
Kristof Provost <kp@FreeBSD.org> |
pf: Introduce nvlist variant of DIOCGETSTATUS
Make it possible to extend the GETSTATUS call (e.g. when we want to add new counters, such as for syncookie support) by introducing an nvlist-based alte
pf: Introduce nvlist variant of DIOCGETSTATUS
Make it possible to extend the GETSTATUS call (e.g. when we want to add new counters, such as for syncookie support) by introducing an nvlist-based alternative.
MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31694
show more ...
|