#
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 ...
|
Revision tags: release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0 |
|
#
e11dacbf |
| 11-Oct-2024 |
Kristof Provost <kp@FreeBSD.org> |
pf: partially import OpenBSD's NAT rewrite
We won't follow this fully, because it involves breaking syntax changes (removing nat/rdr rules and moving this functionality into regular rules) as well a
pf: partially import OpenBSD's NAT rewrite
We won't follow this fully, because it involves breaking syntax changes (removing nat/rdr rules and moving this functionality into regular rules) as well as behaviour changes because NAT is now done after the rules evaluation, rather than before it.
We import some related changes anyway, because it paves the way for nat64 support. This change introduces a new pf_kpool in struct pf_krule, for nat. It is not yet used (but will be for nat64) and renames the existing 'rpool' to 'rdr'.
Obtained from: OpenBSD, henning <henning@openbsd.org>, 0ef3d4febe Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D47783
show more ...
|
#
c49c9da2 |
| 28-Nov-2024 |
Kajetan Staszkiewicz <ks@FreeBSD.org> |
pf: Move route-to information to rule actions
Route-to redirection information (rt, rt_kif, rt_addr) can be considered an action of a rule. This information is duplicated in struct pf_kstate which m
pf: Move route-to information to rule actions
Route-to redirection information (rt, rt_kif, rt_addr) can be considered an action of a rule. This information is duplicated in struct pf_kstate which means that the pf_route() function must always figure out where to get this information from: state for stateful forwarding, or rule for stateless.
Create the necessary members in struct pf_rule_action. Fill them in right after parsing the ruleset, similar for how NAT redirection is applied right after parsing the NAT ruleset. Remove the logic for finding the right source for route-to redirection from pf_route().
As a bonus simplify pf_map_addr_sn() and source node handling. Both for the NAT and the filter ruleset there is now only one path: 1. parse the rules 2. apply redirection either from an existing source node or by load balancing for the last matching rule 3. create the source node using the redirection if the node does not yet exist
Reviewed by: kp Approved by: kp (mentor) Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D47827
show more ...
|
#
e5c64b26 |
| 02-Oct-2024 |
Kajetan Staszkiewicz <vegeta@tuxpowered.net> |
pf: replace union pf_krule_ptr with struct pf_krule in in-kernel structs
There is no need for the union pf_krule_ptr for kernel-only structs like pf_kstate and pf_ksrc_node. The rules are always acc
pf: replace union pf_krule_ptr with struct pf_krule in in-kernel structs
There is no need for the union pf_krule_ptr for kernel-only structs like pf_kstate and pf_ksrc_node. The rules are always accessed by pointer. The rule numbers are a leftover from using the same structure for pfctl(8) and pf(4).
Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D46868
show more ...
|
Revision tags: release/13.4.0, release/14.1.0, release/13.3.0 |
|
#
04932601 |
| 07-Dec-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: store state creation/expiration timestamps with milisecond precision
The primary beneficiary is pflow(4), which expects milisecond precision in timestamps.
Sponsored by: Rubicon Communications,
pf: store state creation/expiration timestamps with milisecond precision
The primary beneficiary is pflow(4), which expects milisecond precision in timestamps.
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D43112
show more ...
|
Revision tags: release/14.0.0 |
|
#
4f337550 |
| 20-Oct-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: allow states to be killed by their pre-NAT address
If a connection is NAT-ed we could previously only terminate it by its ID or the post-NAT IP address. Allow users to specify they want look for
pf: allow states to be killed by their pre-NAT address
If a connection is NAT-ed we could previously only terminate it by its ID or the post-NAT IP address. Allow users to specify they want look for the state by its pre-NAT address. Usage: `pfctl -k nat -k <address>`.
See also: https://redmine.pfsense.org/issues/11556 Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42312
show more ...
|
#
685dc743 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
76c8f202 |
| 15-May-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: fix pf_nv##_array() size check
We want to set the maximum number of elements we'll accept, not the exact number we need.
MFC after: 3 weeks Sponsored by: Orange Business Services
|
#
4d846d26 |
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
#
ef661d4a |
| 24-Apr-2023 |
Christian McDonald <cmcdonald@netgate.com> |
pf: introduce ridentifier and labels to ether rules
Make Ethernet rules more similar to the usual layer 3 rules by also allowing ridentifier and labels to be set on them.
Reviewed by: kp Sponsored
pf: introduce ridentifier and labels to ether rules
Make Ethernet rules more similar to the usual layer 3 rules by also allowing ridentifier and labels to be set on them.
Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
Revision tags: release/13.2.0, release/12.4.0 |
|
#
8a8af942 |
| 22-Sep-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: bridge-to
Allow pf (l2) to be used to redirect ethernet packets to a different interface.
The intended use case is to send 802.1x challenges out to a side interface, to enable AT&T links to fun
pf: bridge-to
Allow pf (l2) to be used to redirect ethernet packets to a different interface.
The intended use case is to send 802.1x challenges out to a side interface, to enable AT&T links to function with pfSense as a gateway, rather than the AT&T provided hardware.
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D37193
show more ...
|
#
0044bd90 |
| 27-Sep-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: fix memory leak retrieving Ethernet rules
Remember to free the nvlist we've added to our main nvlist.
Sponsored by: Rubicon Communications, LLC ("Netgate")
|
#
1f61367f |
| 31-May-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: support matching on tags for Ethernet rules
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D35362
|
Revision tags: release/13.1.0 |
|
#
0abcc1d2 |
| 22-Apr-2022 |
Reid Linnemann <rlinnemann@netgate.com> |
pf: Add per-rule timestamps for rule and eth_rule
Similar to ipfw rule timestamps, these timestamps internally are uint32_t snaps of the system time in seconds. The timestamp is CPU local and update
pf: Add per-rule timestamps for rule and eth_rule
Similar to ipfw rule timestamps, these timestamps internally are uint32_t snaps of the system time in seconds. The timestamp is CPU local and updated each time a rule or a state associated with a rule or state is matched.
Reviewed by: kp Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D34970
show more ...
|
#
812839e5 |
| 12-Apr-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: allow the use of tables in ethernet rules
Allow tables to be used for the l3 source/destination matching. This requires taking the PF_RULES read lock.
Sponsored by: Rubicon Communications, LLC
pf: allow the use of tables in ethernet rules
Allow tables to be used for the l3 source/destination matching. This requires taking the PF_RULES read lock.
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D34917
show more ...
|
#
d27c9f5b |
| 29-Mar-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: fixup match rules
Ensure that we can set and print match rules in ethernet rules.
Sponsored by: Rubicon Communications, LLC ("Netgate")
|
#
3468cd95 |
| 25-Mar-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: ether l3 rules can only use addresses
Disallow the use of tables in ethernet rules. Using tables requires taking the PF_RULES lock. Moreover, the current table code isn't ready to deal with ethe
pf: ether l3 rules can only use addresses
Disallow the use of tables in ethernet rules. Using tables requires taking the PF_RULES lock. Moreover, the current table code isn't ready to deal with ethernet rules.
Disallow their use for now.
Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
#
8a42005d |
| 08-Mar-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: support basic L3 filtering in the Ethernet rules
Allow filtering based on the source or destination IP/IPv6 address in the Ethernet layer rules.
Reviewed by: pauamma_gundo.com (man), debdrup (m
pf: support basic L3 filtering in the Ethernet rules
Allow filtering based on the source or destination IP/IPv6 address in the Ethernet layer rules.
Reviewed by: pauamma_gundo.com (man), debdrup (man) Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D34482
show more ...
|
#
b590f17a |
| 20-Jan-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: support masking mac addresses
When filtering Ethernet packets allow rules to specify a mac address with a mask. This indicates which bits of the specified address are significant. This allows us
pf: support masking mac addresses
When filtering Ethernet packets allow rules to specify a mac address with a mask. This indicates which bits of the specified address are significant. This allows users to do things like filter based on device manufacturer.
Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
Revision tags: release/12.3.0 |
|
#
c5131afe |
| 01-Oct-2021 |
Kristof Provost <kp@FreeBSD.org> |
pf: add anchor support for ether rules
Support anchors in ether rules.
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32482
|
#
fb330f39 |
| 27-Sep-2021 |
Kristof Provost <kp@FreeBSD.org> |
pf: support dummynet on L2 rules
Allow packets to be tagged with dummynet information. Note that we do not apply dummynet shaping on the L2 traffic, but instead mark it for dummynet processing in th
pf: support dummynet on L2 rules
Allow packets to be tagged with dummynet information. Note that we do not apply dummynet shaping on the L2 traffic, but instead mark it for dummynet processing in the L3 code. This is the same approach as we take for ALTQ.
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32222
show more ...
|
Revision tags: release/13.0.0 |
|
#
e732e742 |
| 03-Feb-2021 |
Kristof Provost <kp@FreeBSD.org> |
pf: Initial Ethernet level filtering code
This is the kernel side of stateless Ethernel level filtering for pf.
The primary use case for this is to enable captive portal functionality to allow/deny
pf: Initial Ethernet level filtering code
This is the kernel side of stateless Ethernel level filtering for pf.
The primary use case for this is to enable captive portal functionality to allow/deny access by MAC address, rather than per IP address.
Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31737
show more ...
|
#
0143a6bb |
| 14-Feb-2022 |
Franco Fichtner <franco@opnsense.org> |
pf: fix set_prio after nv conversion
Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D34266
|
#
773e3a71 |
| 31-Jan-2022 |
Mark Johnston <markj@FreeBSD.org> |
pf: Initialize pf_kpool mutexes earlier
There are some error paths in ioctl handlers that will call pf_krule_free() before the rule's rpool.mtx field is initialized, causing a panic with INVARIANTS
pf: Initialize pf_kpool mutexes earlier
There are some error paths in ioctl handlers that will call pf_krule_free() before the rule's rpool.mtx field is initialized, causing a panic with INVARIANTS enabled.
Fix the problem by introducing pf_krule_alloc() and initializing the mutex there. This does mean that the rule->krule and pool->kpool conversion functions need to stop zeroing the input structure, but I don't see a nicer way to handle this except perhaps by guarding the mtx_destroy() with a mtx_initialized() check.
Constify some related functions while here and add a regression test based on a syzkaller reproducer.
Reported by: syzbot+77cd12872691d219c158@syzkaller.appspotmail.com Reviewed by: kp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34115
show more ...
|
#
218a8a49 |
| 08-Nov-2021 |
Kristof Provost <kp@FreeBSD.org> |
pf: ensure we populate dyncnt/tblcnt in struct pf_addr_wrap
PR: 259689 MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D3
pf: ensure we populate dyncnt/tblcnt in struct pf_addr_wrap
PR: 259689 MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32892
show more ...
|