Commit graph

5414 commits

Author SHA1 Message Date
Kristof Provost
07579e2110 pf: sprinkle const over function arguments
Document that these are not supposed to modify their arguments.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-12-30 21:42:13 +01:00
Kristof Provost
3624de5394 if_ovpn: improve reconnect handling
When a DCO client reconnects (e.g. on server restart) OpenVPN may create a new
socket rather than reusing the existing one. This used to be rejected because we
expect all peers to use the same socket. However, if there are no peers it's
safe to release the previous socket and install the tunnel function on the new
one.

See also:	https://redmine.pfsense.org/issues/15928
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-12-18 17:10:29 +01:00
Konstantin Belousov
c7d13682a1 lagg: do not advertize support for ipsec offload
It is not implemented, and most likely cannot be, in a robust manner.

Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>, slavash
Sponsored by:	NVidia networking
2024-12-17 23:49:31 +02:00
Kristof Provost
7cae58a449 pf: handle fragmentation for nat64
When we reassemble IPv4 packets tag them just like we tag the IPv6 reassembled
packtes. Use this information as the basis for refragmenting the IPv6 packet.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D47804
2024-12-17 11:07:16 +01:00
Kristof Provost
aa69fdf154 pfctl: change for af-to / NAT64 support.
The general syntax is:
pass in inet from any to 192.168.1.1 af-to inet6 from 2001::1 to 2001::2
In the NAT64 case the "to" is not needed in af-to and the IP is extraced
from the IPv6 dst (assuming a /64 prefix).
Again most work by sperreault@, mikeb@ and reyk@
OK mcbride@, put it in deraadt@

Obtained from:	OpenBSD, claudio <claudio@openbsd.org>, 0cde32ce3f
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D47790
2024-12-17 11:07:13 +01:00
Kristof Provost
fcdb520c1b 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
2024-12-17 11:07:12 +01:00
Kristof Provost
2d7e68d5cd pf: add post-NAT src/dst address/port to pf_pdesc
stuff nsaddr/ndaddr/nsport/ndport (addrs/ports after NAT, used a lot while
walking the ruleset and up until state is fully set up) into pf_pdesc instead
of passing around those 4 seperately all the time, also shrinks the argument
count for a few functions that have/partialy had an insane count of arguments.
kinda preparational since we'll need them elsewhere too, soon
ok ryan jsing

Obtained from:	OpenBSD, henning <henning@openbsd.org>, ccf63ac6cb
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D47784
2024-12-17 11:07:12 +01:00
Kristof Provost
e11dacbf84 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
2024-12-17 11:07:12 +01:00
Kristof Provost
85570785b9 pf: remove unused variable from pf_pdesc
We only every assigned proto_sum, never used it.
Remove it entirely.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-12-16 23:33:56 +01:00
Zhenlei Huang
adc573c8e2 rtsock: Use NULL for VNET_SYS[UN]INIT's last arg, which is a pointer type
MFC after:	3 days
2024-12-10 01:14:08 +08:00
Zhenlei Huang
12b2d68bed routing: Use NULL for VNET_SYS[UN]INIT's last arg, which is a pointer type
MFC after:	3 days
2024-12-10 01:14:08 +08:00
Gleb Smirnoff
8e1af80243 IfAPI: make if_getlladdr() to return char *
No functional change.  The caddr_t is a relic typedef from C version
that didn't have void pointer.  In this particular change we really
need a char * pointer rather than void, because some consumers use
the link level address as a char array.
2024-12-09 08:18:56 -08:00
Gleb Smirnoff
d3f035f8d9 ifnet: make sa_dl_equal() a static function
No functional change.  Also clears last use of CLLADDR() macro.
2024-12-09 08:18:56 -08:00
Mark Johnston
3d642b0f71 iflib: Set the NUMA domain in receive packet headers
Reading PR 273559 made me realize that commit 767723ddeb is
incomplete.  iflib should set the NUMA domain of received packets before
passing them to protocol layers.

PR:		273559
Reviewed by:	zlei, kbowling, erj
Fixes:		767723ddeb ("iflib: Use if_alloc_dev() to allocate the ifnet")
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D47841
2024-12-04 16:22:50 +00:00
Kajetan Staszkiewicz
c49c9da239 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
2024-12-03 13:46:34 +01:00
Richard Scheffenegger
347dd0539f tcp: add TH_AE capabilities to ppp and pf
Add support for the AE Flag in the TCP header to pf and ppp.
Commonalize to the use of "E"(ECE), "W"(CWR) and "e"(AE)
for the TCP header flags, in line with tcpdump.

Reviewers: kp, cc, tuexen, cy, #transport!
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D47106
2024-11-29 10:04:31 +01:00
Richard Scheffenegger
0fc7bdc978 tcp: extend the use of the th_flags accessor function
Formally, there are 12 bits for TCP header flags.
Use the accessor functions in more (kernel) places.

No functional change.

Reviewed By: cc, #transport, cy, glebius, #iflib, kbowling
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D47063
2024-11-29 09:48:23 +01:00
Kajetan Staszkiewicz
b9c0321d54 pf: Fix source node locking
Source nodes are created quite early in pf_create_state(), even before
the state is allocated, locked and inserted into its hash row. They are
prone to being freed by source node killing or clearing ioctl while
pf_create_state() is still running.

The function pf_map_addr_sn() can be called in two very different paths.

One is for filter rules where it is called from
pf_create_state() after pf_insert_src_node(). In this case it is called
with a given source node and does not perform its own search and must
return the source node.

The other one is for NAT rules where it is called from
pf_get_translation() or its descendants. In this case it is called with
no known source node and performs its own search for source nodes. This
source node is then passed back to pf_create_state() without locking.

The states property of source node is increased in pf_find_src_node()
which allows for the counter to increase when a packet matches the NAT
rule but not a pass keep state rule.

The function pf_map_addr() operates on unlocked source node.

Modify pf_find_src_node() to return locked on source node found, so
that any subsequent operations can access the source node safely.

Move sn->states++ counter increase to pf_insert_src_node() to ensure
that it's called only from pf_create_state() and not from NAT ruleset
path, and have it increased only if the source node has really been
inserted or found, simplifying the cleanup.

Add locking in pf_src_connlimit() and pf_map_addr(). Sprinkle mutex
assertions in pf_map_addr().

Add a function pf_src_node_exists() to check a known source node is
still valid. Use it in pf_create_state() where it's impossible to hold
locks from pf_insert_src_node() because that would cause LoR (nodes
first, then state) against pf_src_connlimit() (state first, then node).

Don't propagate the source node found while parsing the NAT ruleset to
pf_create_state() because it must be found again and locked or created.

Reviewed by:		kp
Approved by:		kp (mentor)
Sponsored by:		InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D47770
2024-11-28 18:31:55 +01:00
Mark Johnston
ef9ffb8594 kern: Make fileops and filterops tables const where possible
No functional change intended.

MFC after:	1 week
2024-11-26 21:04:21 +00:00
Kristof Provost
56b7685ae3 pf: handle IPv6 fragmentation for route-to
If a fragmented IPv6 packet hits a route-to rule we have to first prevent
the pf_test(PF_OUT) check in pf_route6() from refragmenting (and calling
ip6_output()/ip6_forward()). We then have to refragment in pf_route6() and
transmit the packets on the route-to interface.

Split pf_refragment6() into two parts, the first to perform the refragmentation,
the second to call ip6_output()/ip6_forward() and call the former from
pf_route6().

Add a test case for route-to-ing fragmented IPv6 packets to verify this works
as expected.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D47684
2024-11-26 15:06:52 +01:00
Gleb Smirnoff
dae64402b3 rtsock: fix panic in rtsock_msg_buffer()
The rtsock_msg_buffer() can be called without walkarg, just to calculate
required length.  It can also be called with a degenerate walkarg, that
doesn't have a w_req.  The latter happens when the function is called from
update_rtm_from_info() for the second time.

Zero init walkarg in update_rtm_from_info() and don't pass random stack
garbage as w_req.

In rtsock_msg_buffer() initialize compat32 boolean only once and take of
possible empty w_req.  Simplify the rest of code once compat32 is already
set.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D47662
Reported-by: syzbot+d4a2682059e23179e76e@syzkaller.appspotmail.com
Reported-by: syzbot+66d7c9b3062e27a56f3f@syzkaller.appspotmail.com
2024-11-18 14:12:42 -08:00
Alexander V. Chernikov
1da4954c92 Fix failure to add an interface prefix route when route with the same
prefix is already presented in the routing table.

PR:		277125
Reported by:	Oleksandr Ignatyev <alex@i.org.ua>
Reviewed by:	ae, jlduran
Tested by:	jlduran
Differential Revision: https://reviews.freebsd.org/D47534
MFC after:	2 weeks
2024-11-12 23:36:50 +00:00
Justin Hibbits
f6efccaa35 IfAPI: Remove temporary inclusion of if_private.h
Summary:
The kernel is now fully migrated to the IfAPI, so remove the temporary
inclusion of the private structure definition.

Reviewed By:	#network, melifaro
Differential Revision:	https://reviews.freebsd.org/D39621
2024-11-13 14:31:20 -05:00
Justin Hibbits
3f2eb1ac23 dummymbuf: Explicitly include if_private.h
struct ifnet is expected to be private for everything outside of the
network stack (sys/net*, except netlink.  Since dummymbuf is part of the
network stack, explicitly include the header to get access to the
private members.

Sponsored by:	Juniper Networks, Inc.
2024-11-13 14:30:58 -05:00
Tore Amundsen
78c63ed260 net: if_media for 1000Base-BX BiDi
1000Base-BX uses two wavelengths, commonly 1310nm, 1490nm, 1550nm, or
1590nm, in a Coarse Wavelength Division Multiplexing (CWDM) arrangement
so that a single fiber strand may carry both upstream and downstream.
It is sometimes referred to as BiDi for bi-directional usage of one
fiber.

Optics must be paired such that the RX and TX wavelengths cross over,
with one side often called U(pstream) and the other D(ownstream).

This technology is useful for increasing link density or working around
construction issues, and is also frequently used as a last mile delivery
technology for FTTx.

MFC after:	3 days
Sponsored by:	BBOX.io (review/commits)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1518
2024-11-12 22:27:32 -07:00
Mark Johnston
4a7c6d6206 pf: Fix handling of v6 loopback connections with pf syncookies enabled
The SYN|ACK generated by pf needs to inherit M_LOOP from the original
SYN, otherwise it gets dropped by ip6_input().

Fix this by adding an mbuf_flags argument to pf_build_tcp() that can be
used to set both M_SKIP_FIREWALL and M_LOOP as needed.  Set M_LOOP on
the output mbuf if it was generated in response to an mbuf with M_LOOP
set.

Add a regression test case.  The v4 case had no problems, but the v6
case fails without this change.

Reviewed by:	kp
MFC after:	1 month
Sponsored by:	Klara, Inc.
Sponsored by:	Zenarmor
Differential Revision:	https://reviews.freebsd.org/D47257
2024-10-29 15:01:20 +00:00
Mark Johnston
01c738cd5c if_tuntap: Enable MEXTPG support
Fix tunread() to use m_mbuftouio() instead of manually copying (which
doesn't work for unmapped mbufs).

Reviewed by:	jhb, gallatin
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D47295
2024-10-28 15:14:36 +00:00
Mark Johnston
2bbfbf80d3 if_bridge: Mask MEXTPG if some members don't support it
Similar to how the network stack needs to use mb_unmapped_to_ext() to
convert mbufs before passing them to an unsupported driver, if_bridge
needs to avoid passing M_EXTPG mbufs to interfaces that don't support
them.  Thus, clear IFCAP_MEXTPG on the bridge if any member interfaces
don't handle unmapped mbufs.

PR:		278245
Reviewed by:	jhb, gallatin
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D47294
2024-10-28 15:14:21 +00:00
Kyle Evans
3360a15898 net: route: convert routing statistics to a sysctl
Exporting the relevant pcpustat is trivial, so let's do that.  We will
use it in a near-future change in netstat to avoid having to dig around
in mem(4) for live kernel statistics.

Differential Revision:	https://reviews.freebsd.org/D47231
2024-10-23 22:15:55 -05:00
Zhenlei Huang
d1d839d0b5 ifnet: Assert that we are assigning network stack correctly
It makes no sense to assign NULL vnet to an interface when the kernel
option VIMAGE is enabled. Add an assertion to catch that.

This will also help diagnosing problem report [1] and [2].

1. https://bugs.freebsd.org/275381
2. https://bugs.freebsd.org/282168

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D46982
2024-10-22 12:32:24 +08:00
Zhenlei Huang
eacad82f3a if_enc(4): Use new KPI to create enc interface
This driver allows only exactly one instance to be created. Clone
creating additional interfaces, e.g. `ifconfig enc1 create`, will get
error EEXIST which is somewhat confusing.

Convert to new KPI for less confusing error ENOSPC.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45758
2024-10-12 21:37:53 +08:00
Mark Johnston
5c385a54fe debugnet: Use precise types when accessing mbuf contents
This might be useful when adding bounds checks to mtod().  No functional
change intended.

MFC after:	1 week
2024-10-11 13:23:25 +00:00
Kristof Provost
9a405864e0 pf: move the mbuf into struct pf_pdesc too
As requested by henning, move the mbuf pointer into struct pf_pdesc.
Also sort pd to the beginning of the functions' parameter lists for
consistency.
ok henning

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 776f210a75
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46941
2024-10-10 14:10:42 +02:00
Kristof Provost
b4a4258911 pf: put kif into struct pf_pdesc
Put kif and dir into pdesc an use this instead of passing the values
around.  This is a mechanical change.  Initialize pd2 and use it
where appropriate.
ok henning on an earlier version; ok mpf

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 47de5c193e
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46939
2024-10-10 14:10:41 +02:00
Kristof Provost
48f5bf8be6 pf: convert DIOCGETRULESET to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46938
2024-10-10 14:10:41 +02:00
Kristof Provost
739731b8ca pf: consolidate pf function parameters
Move off and hdrlen into pdesc
and change their type from int to u_int32_t.  Do not pass struct
tcphdr *th and sa_family_t af, it is in pd anyway.  Do not use af
and pd->af intermixed, the latter makes clear where it comes from.
Do not calculate the packet length again if pd already has it.  Use
pd2.off instead of off2.
go go go go don't stop henning@ mpf@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 110e53770d
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46937
2024-10-10 14:10:41 +02:00
Kristof Provost
05896f1ef8 pf: move pf_test_rule() out of pf_setup_pdesc()
Move the call to pf_test_rule() for fragments that have not been
reassembled by normalization from pf_setup_pdesc() to pf_test().
This simplifies the paramter list of pf_setup_pdesc() as it can
concentrate on its job filling the pf_pdesc struct.
ok henning mpf

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, fb9fe53b92
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46935
2024-10-10 14:10:40 +02:00
Kristof Provost
5de77e952a pf: remove the last hand-rolled IPv6 extension header loop
Replace the IPv6 header walking loop in pf_test_state_icmp() with
the common function pf_walk_header6().  For that, pf_walk_header6()
can now extract both the information wether it is a fragment and
the final protocol if it is the first fragment.  This allows to
match the icmp6 too big packet of a first fragment to the reassembled
packet's state.  This is neccesary if a refragmented fragment is
to big for the Path-MTU.
Note that pd.proto contains the real protocol number for the first
fragment and IPPROTO_FRAGMENT for later fragments.  pd.virtual_protocol
is set to PF_VPROTO_FRAGMENT for all fragments.
ok mcbride@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 90b3c57e94
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46931
2024-10-10 14:10:40 +02:00
Kristof Provost
25e0f8f99f pf: convert DIOCGETRULESETS to netlink
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46930
2024-10-10 14:10:40 +02:00
Kristof Provost
5c3d74eca6 pf: add ttl to pf_pdesc
This simplifies the code a little, because we can now avoid looking at the
IP(v6) header at all in pf_test() itself.

We do have to move the Jumbogram check into pf_setup_pdesc as well.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46928
2024-10-10 14:10:39 +02:00
Kristof Provost
8de7f8ed5e pf: reduce IPv6 header parsing code duplication
There were two loops in pf_setup_pdesc() and pf_normalize_ip6()
walking over the IPv6 header chain.  Merge them into one loop,
adjust some length checks and fix IPv6 jumbo option handling.  Also
allow strange but legal IPv6 packets with plen=0 passing through
pf.  IPv6 jumbo packets still get dropped.
testing dhill@; ok mcbride@ henning@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, d68283bbf0
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D46925
2024-10-10 14:10:39 +02:00
Zhenlei Huang
8161000892 iflib: Make iflib_stop() static
It is declared as static. Make the definition consistent with the
declaration.

This follows 7ff9ae90f0 and partially reverts 09f6ff4f1a.

Reviewed by:	erj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D46185
2024-10-07 22:19:02 +08:00
Igor Ostapenko
dfcb8de5ef dummymbuf: Log the entire rule set if no delimiters are present
An empty string was printed instead.

Reviewed by:	kp
Approved by:	kp (mentor)
Differential Revision:	https://reviews.freebsd.org/D46964
2024-10-07 11:16:44 +00:00
Igor Ostapenko
6bd8d85579 dummymbuf: Fix code style
No functional change intended.

Reviewed by:	kp
Approved by:	kp (mentor)
Differential Revision:	https://reviews.freebsd.org/D46958
2024-10-06 11:34:28 +00:00
Igor Ostapenko
9f146a81d2 dummymbuf: Validate syntax upon write to net.dummymbuf.rules sysctl
For now, opargs are not validated due to their runtime nature.

Reviewed by:	kp
Approved by:	kp (mentor)
Differential Revision:	https://reviews.freebsd.org/D46496
2024-10-05 08:04:08 +00:00
Kajetan Staszkiewicz
e5c64b2662 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
2024-10-02 19:53:26 +02:00
Kajetan Staszkiewicz
6bbef79355 pf: Remove struct pf_pdesc->nat_rule
The variable struct pd->nat_rule is set only during rule evaluation, that
is only for the first packet of a connection. Use struct pf_kstate->nat_rule
instead.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46867
2024-10-02 12:05:08 +02:00
Zhenlei Huang
7643141e93 if_enc(4): Make enc_add_hhooks() void
As for the consumer `enc_add_hhooks()`, `hhook_add_hook()` will never
fail for the given parameters. Meanwhile, to build the module if_enc(4),
at least option INET or INET6 is required, so no need for the error
EPFNOSUPPORT.

No functional change intended.

Reviewed by:	ae
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D46770
2024-10-01 23:28:37 +08:00
Kristof Provost
288bec2b2b 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
2024-10-01 09:55:13 +02:00
Kajetan Staszkiewicz
8e3d252901 pf: Split pf_map_addr()
Split pf_map_addr() into 2 functions:
- pf_map_addr() handles just the address mapping algorithms, it is used
  in pf_route() and pf_route6() in case of stateless route-to, where
  source nodes would never be created
- pf_map_addr_sn() handles source nodes and calls pf_map_addr() for
  address mapping algorightms, it is used everywhere else, like NAT
  rules, which are always stateful

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D46776
2024-09-30 11:16:24 +02:00