#
b2a48c3c |
| 01-Sep-2023 |
Mateusz Guzik <mjg@FreeBSD.org> |
pf: retire pf_krule_to_rule and pf_kpool_to_pool
Discussed with: kp Sponsored by: Rubicon Communications, LLC ("Netgate")
|
#
8d49fd73 |
| 29-Aug-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: remove DIOCGETRULE and DIOCGETSTATUS
These calls have nvlist variants that completely supersede them. Remove the old code.
Reviewed by: mjg MFC after: never Sponsored by: Rubicon Communications
pf: remove DIOCGETRULE and DIOCGETSTATUS
These calls have nvlist variants that completely supersede them. Remove the old code.
Reviewed by: mjg MFC after: never Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D41651
show more ...
|
#
2e8edbc2 |
| 28-Aug-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: Remove DIOCCLRSTATES and DIOCKILLSTATES
These now have nvlist based alternatives, so remove them.
Reviewed by: mjg, Pau Amma <pauamma@gundo.com> (man page) MFC after: never Sponsored by: Rubico
pf: Remove DIOCCLRSTATES and DIOCKILLSTATES
These now have nvlist based alternatives, so remove them.
Reviewed by: mjg, Pau Amma <pauamma@gundo.com> (man page) MFC after: never Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30056
show more ...
|
#
685dc743 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
6b4ed16d |
| 13-Jul-2023 |
Kajetan Staszkiewicz <vegeta@tuxpowered.net> |
pf: Simplify rule actions logic
Actions applied to a processed packet come in case of stateless firewalling from a rule or in case of statefull firewalling from a state. The state obtains the action
pf: Simplify rule actions logic
Actions applied to a processed packet come in case of stateless firewalling from a rule or in case of statefull firewalling from a state. The state obtains the actions from a rule when it is created by a rule or by pfsync. The logic for deciding if actions come from a rule or a state is spread across many places in pf.
There already is struct pf_rule_actions in struct pf_pdesc and thus it can be used as a central place for storing actions and their parameters. OpenBSD does something similar: they also store the actions in struct pf_pdesc and have no variables in pf_test() but they use separate variables instead of a structure. By using struct pf_rule_actions we can simplify the code even further. Applying of actions is done *only* in pf_rule_to_actions() no matter if for the legacy scrub rules or for the normal match / pass rules. The logic of choosing if rule or state actions are used is applied only once in pf_test() by copying the whole struct.
Reviewed by: kp Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D41009
show more ...
|
#
3a1f834b |
| 20-Jun-2023 |
Doug Rabson <dfr@FreeBSD.org> |
pf: Add code to enable filtering for locally delivered packets
This is disabled by default since it potentially changes the behavior of existing filter rule sets. To enable this extra filter for pac
pf: Add code to enable filtering for locally delivered packets
This is disabled by default since it potentially changes the behavior of existing filter rule sets. To enable this extra filter for packets being delivered locally, use:
sysctl net.pf.filter_local=1 service pf restart
PR: 268717 Reviewed-by: kp MFC-after: 2 weeks Differential Revision: https://reviews.freebsd.org/D40373
show more ...
|
#
ba94bf28 |
| 15-Jun-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: extend use of skip steps for Ethernet rules
Use the already populated PFE_SKIP_DST_ADDR and extend the skip infrastructure to also skip on IP source/destination addresses.
This should make eval
pf: extend use of skip steps for Ethernet rules
Use the already populated PFE_SKIP_DST_ADDR and extend the skip infrastructure to also skip on IP source/destination addresses.
This should make evaluating the rules slightly faster.
Reported by: R. Christian McDonald <rcm@rcm.sh> Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D40567
show more ...
|
#
9925aee0 |
| 30-May-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: carry over rule actions from route-to rules
If we route-to (or dup-to/reply-to) we re-run pf_test(), which will also create states for the connection. This means that we may end up matching a di
pf: carry over rule actions from route-to rules
If we route-to (or dup-to/reply-to) we re-run pf_test(), which will also create states for the connection. This means that we may end up matching a different (i.e. not the state that was created by the route-to rule) state, without the attributes (such as dummynet pipes/queues) set by the route-to rule.
Address this by inheriting the pf_rule_actions from the route-to rule while evaluating the connection again in pf_test(). That is, we set default pf_rule_actions based on the route-to rule for the new evaluation. The new rule may still overrule these, but if it does not have such actions the route-to actions are applied.
Do the same for IPv6 rules in pf_test6()/pf_route6().
See also: https://redmine.pfsense.org/issues/14039 Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D40340
show more ...
|
#
c45d6b0e |
| 29-May-2023 |
Kajetan Staszkiewicz <vegeta@tuxpowered.net> |
pfctl: Add missing state parameters in DIOCGETSTATESV2
Reviewed by: kp Sponsored by: InnoGames GmbH Different Revision: https://reviews.freebsd.org/D40259
|
#
4bf98559 |
| 29-May-2023 |
Kajetan Staszkiewicz <vegeta@tuxpowered.net> |
pf: make contents of struct pfsync_state configurable
Make struct pfsync_state contents configurable by sending out new versions of the structure in separate subheader actions. Both old and new vers
pf: make contents of struct pfsync_state configurable
Make struct pfsync_state contents configurable by sending out new versions of the structure in separate subheader actions. Both old and new version of struct pfsync_state can be understood, so replication of states from a system running an older kernel is possible. The version being sent out is configured using ifconfig pfsync0 … version XXXX. The version is an user-friendly string - 1301 stands for FreeBSD 13.1 (I have checked synchronization against a host running 13.1), 1400 stands for 14.0.
A host running an older kernel will just ignore the messages and count them as "packets discarded for bad action".
Reviewed by: kp Sponsored by: InnoGames GmbH Differential Revision: https://reviews.freebsd.org/D39392
show more ...
|
#
c4a32455 |
| 19-May-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: remove the use of caddr_t
Replace caddr_t with void *, or more accurate types.
Suggested by: glebius Reviewed by: zlei Differential Revision: https://reviews.freebsd.org/D40186
|
Revision tags: release/13.2.0 |
|
#
7626863e |
| 29-Mar-2023 |
Tom Hukins <tom@FreeBSD.org> |
pf: Fix a spelling mistake in a comment
Pull Request: https://github.com/freebsd/freebsd-src/pull/704
|
#
2e6cdfe2 |
| 18-Apr-2023 |
Kristof Provost <kp@FreeBSD.org> |
pf: change pf_rules_lock and pf_ioctl_lock to per-vnet locks
Both pf_rules_lock and pf_ioctl_lock only ever affect one vnet, so there's no point in having these locks affect other vnets. (In fact, t
pf: change pf_rules_lock and pf_ioctl_lock to per-vnet locks
Both pf_rules_lock and pf_ioctl_lock only ever affect one vnet, so there's no point in having these locks affect other vnets. (In fact, the only lock in pf that can affect multiple vnets is pf_end_lock.)
That's especially important for the rules lock, because taking the write lock suspends all network traffic until it's released. This will reduce the impact a vnet running pf can have on other vnets, and improve concurrency on machines running multiple pf-enabled vnets.
Reviewed by: zlei Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D39658
show more ...
|
#
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 ...
|
#
caf32b26 |
| 14-Feb-2023 |
Gleb Smirnoff <glebius@FreeBSD.org> |
pfil: add pfil_mem_{in,out}() and retire pfil_run_hooks()
The 0b70e3e78b0 changed the original design of a single entry point into pfil(9) chains providing separate functions for the filtering point
pfil: add pfil_mem_{in,out}() and retire pfil_run_hooks()
The 0b70e3e78b0 changed the original design of a single entry point into pfil(9) chains providing separate functions for the filtering points that always provide mbufs and know the direction of a flow. The motivation was to reduce branching. The logical continuation would be to do the same for the filtering points that always provide a memory pointer and retire the single entry point.
o Hooks now provide two functions: one for mbufs and optional for memory pointers. o pfil_hook_args() has a new member and pfil_add_hook() has a requirement to zero out uninitialized data. Bump PFIL_VERSION. o As it was before, a hook function for a memory pointer may realloc into an mbuf. Such mbuf would be returned via a pointer that must be provided in argument. o The only hook that supports memory pointers is ipfw:default-link. It is rewritten to provide two functions. o All remaining uses of pfil_run_hooks() are converted to pfil_mem_in(). o Transparent union of pfil_packet_t and tricks to fix pointer alignment are retired. Internal pfil_realloc() reduces down to m_devget() and thus is retired, too.
Reviewed by: mjg, ocochard Differential revision: https://reviews.freebsd.org/D37977
show more ...
|
#
3d0d5b21 |
| 23-Jan-2023 |
Justin Hibbits <jhibbits@FreeBSD.org> |
IfAPI: Explicitly include <net/if_private.h> in netstack
Summary: In preparation of making if_t completely opaque outside of the netstack, explicitly include the header. <net/if_var.h> will stop in
IfAPI: Explicitly include <net/if_private.h> in netstack
Summary: In preparation of making if_t completely opaque outside of the netstack, explicitly include the header. <net/if_var.h> will stop including the header in the future.
Sponsored by: Juniper Networks, Inc. Reviewed by: glebius, melifaro Differential Revision: https://reviews.freebsd.org/D38200
show more ...
|
#
933be8d7 |
| 31-Dec-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: default syncookies to adaptive mode
The cost of enabling syncookies in adaptive mode is very low (basically a single atomic add when we create a new half-open state), and the payoff when under S
pf: default syncookies to adaptive mode
The cost of enabling syncookies in adaptive mode is very low (basically a single atomic add when we create a new half-open state), and the payoff when under SYN flood is huge.
So, enable adaptive mode by default.
Suggested by: Eirik Øverby
show more ...
|
#
57cc96f4 |
| 14-Dec-2022 |
Mark Johnston <markj@FreeBSD.org> |
pf: Fix definitions of pf_pfil_*_hooked
This use of "volatile" in the vnet definitions doesn't have any effect. VNET_DEFINE_STATE(volatile int, ...) should work, but let's avoid using "volatile" alt
pf: Fix definitions of pf_pfil_*_hooked
This use of "volatile" in the vnet definitions doesn't have any effect. VNET_DEFINE_STATE(volatile int, ...) should work, but let's avoid using "volatile" altogether and convert to atomic_load/atomic_store. Also convert to bool while here.
Reviewed by: kp, mjg MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37684
show more ...
|
Revision tags: 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 ...
|
#
444a77ca |
| 24-Sep-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: expose syncookie active/inactive status
When syncookies are in adaptive mode they may be active or inactive. Expose this status to users.
Suggested by: Guido van Rooij Sponsored by: Rubicon Com
pf: expose syncookie active/inactive status
When syncookies are in adaptive mode they may be active or inactive. Expose this status to users.
Suggested by: Guido van Rooij Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
#
558ec54d |
| 25-Oct-2022 |
Gordon Bergling <gbe@FreeBSD.org> |
netpfil: Fix two typos in source code comments
- s/missmatch/mismatch/
MFC after: 3 days
|
#
133935d2 |
| 07-Oct-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: atomically increment state ids
Rather than using a per-cpu state counter, and adding in the CPU id we can atomically increment the number. This has the advantage of removing the assumption that
pf: atomically increment state ids
Rather than using a per-cpu state counter, and adding in the CPU id we can atomically increment the number. This has the advantage of removing the assumption that the CPU ID fits in 8 bits.
Event: Aberdeen Hackathon 2022 Reviewed by: mjg Differential Revision: https://reviews.freebsd.org/D36915
show more ...
|
#
1d090028 |
| 29-Sep-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: use time_to for timestamps
Use time_t rather than uint32_t to represent the timestamps. That means we have 64 bits rather than 32 on all platforms except i386, avoiding the Y2K38 issues on most
pf: use time_to for timestamps
Use time_t rather than uint32_t to represent the timestamps. That means we have 64 bits rather than 32 on all platforms except i386, avoiding the Y2K38 issues on most platforms.
Reviewed by: Zhenlei Huang Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D36837
show more ...
|
#
6ab80e72 |
| 19-Aug-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: do not block new Ethernet rules for in-progress transactions
Make Ethernet rule addition behave just like L3 rules, in that we now allow ongoing transaction to be interrupted, rather than reject
pf: do not block new Ethernet rules for in-progress transactions
Make Ethernet rule addition behave just like L3 rules, in that we now allow ongoing transaction to be interrupted, rather than rejecting a new one.
The result of that is that we can no longer end up in a state where a transaction failed, but was not rolled back, blocking us from setting new rules.
It's safe to assume there's no pending epoch callback for cleanup here, because we've explicitly called it before hitting pf_begin_eth().
Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|
#
c780d3ad |
| 19-Aug-2022 |
Kristof Provost <kp@FreeBSD.org> |
pf: clear ethernet rules prior to shutdown
Ethernet rule cleanup is postponed to an epoch callback. Ensure it's been called before we remove the entire vnet, or we risk the rules still getting hit a
pf: clear ethernet rules prior to shutdown
Ethernet rule cleanup is postponed to an epoch callback. Ensure it's been called before we remove the entire vnet, or we risk the rules still getting hit after we've freed the uma zone, i.e. a use-after-free.
Sponsored by: Rubicon Communications, LLC ("Netgate")
show more ...
|