opnsense-src/sys/net
Kristof Provost 8b9d1dc82a pf: don't use state keys after pf_state_insert()
pf_state_insert() may free the state keys, it's not safe to access these
pointers after the call.

Introduce osrc/odst (similar to osport/odport) to store the original source and
destination addresses. This allows us to undo NAT transformations without having
to access the state keys.

Reviewed by:	glebius, markj
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D49551

(cherry picked from commit bdea9cbcf2decafeb4da5a0280313efccc09e1b3)
2025-04-21 22:25:45 +02:00
..
altq altq: Stop checking for failures from malloc(M_WAITOK) 2024-09-30 12:44:15 +08:00
route routing: do not allow PINNED routes to be overriden 2025-03-18 12:09:33 +03:00
bpf.c bpf: Use static initializers 2025-03-13 18:13:50 +08:00
bpf.h ifnet: Detach BPF descriptors on interface vmove event 2025-02-07 02:37:01 +08:00
bpf_buffer.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
bpf_buffer.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
bpf_filter.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
bpf_jitter.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
bpf_jitter.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
bpf_zerocopy.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
bpf_zerocopy.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
bpfdesc.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
bridgestp.c bridgestp: Use static initializers 2025-03-13 18:13:50 +08:00
bridgestp.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
debugnet.c debugnet: Use precise types when accessing mbuf contents 2024-10-18 12:28:09 +00:00
debugnet.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
debugnet_inet.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
debugnet_int.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
dlt.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ethernet.h Teach if_smsc to get MAC from bootargs. 2023-12-28 15:40:31 +01:00
firewire.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee8023ad_lacp.c net: if_media for 1000Base-BX BiDi 2025-03-02 13:56:38 -07:00
ieee8023ad_lacp.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ieee_oui.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if.c if_clone: Use static initializers 2025-03-13 18:13:50 +08:00
if.h ifnet: Add handling for toggling IFF_ALLMULTI in ifhwioctl() 2024-09-20 11:39:16 +00:00
if_arp.h Support ARP for 802 networks 2024-04-27 10:45:22 -04:00
if_bridge.c if_bridge: Use static initializers 2025-03-13 18:13:50 +08:00
if_bridgevar.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_clone.c if_clone: Use static initializers 2025-03-13 18:13:50 +08:00
if_clone.h if_clone: Use static initializers 2025-03-13 18:13:50 +08:00
if_dead.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_disc.c net: Remove unneeded NULL check for the allocated ifnet 2024-07-12 20:03:37 +08:00
if_dl.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
if_edsc.c net: Remove unneeded NULL check for the allocated ifnet 2024-07-12 20:03:37 +08:00
if_enc.c if_enc(4): Use new KPI to create enc interface 2024-10-20 21:43:01 +08:00
if_enc.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_epair.c net: Remove unneeded NULL check for the allocated ifnet 2024-07-12 20:03:37 +08:00
if_ethersubr.c ethernet: Fix logging of frame length 2024-04-15 12:00:37 +08:00
if_fwsubr.c sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_gif.c bpf: Make BPF interop consistent with if_loop 2024-05-08 09:06:15 -04:00
if_gif.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
if_gre.c bpf: Make BPF interop consistent with if_loop 2024-05-08 09:06:15 -04:00
if_gre.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
if_infiniband.c if_infininband: Support BPF write for broadcast frames 2025-03-02 16:41:29 -08:00
if_ipsec.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_ipsec.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_lagg.c lagg: Use static initializers 2025-03-13 18:13:51 +08:00
if_lagg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_llatbl.c if_llatbl: Fix a typo in a KASSERT message 2024-01-25 07:47:31 +01:00
if_llatbl.h sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_llc.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
if_loop.c net: Remove unneeded NULL check for the allocated ifnet 2024-07-12 20:03:37 +08:00
if_me.c bpf: Make BPF interop consistent with if_loop 2024-05-08 09:06:15 -04:00
if_media.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_media.h net: if_media for 1000Base-BX BiDi 2025-03-02 13:56:38 -07:00
if_mib.c sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_mib.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_ovpn.c if_ovpn: fix use-after-free of mbuf 2025-04-15 09:27:09 +02:00
if_ovpn.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
if_pflog.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_pfsync.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
if_private.h IfAPI: Hide the macros that touch ifnet members 2023-04-24 09:54:23 -04:00
if_stf.c net: Remove unneeded NULL check for the allocated ifnet 2024-07-12 20:03:37 +08:00
if_stf.h if_stf: make if_stf.h self-contained 2021-12-17 12:38:34 +01:00
if_strings.h ifnet: fix if_strings.h build check 2023-06-16 15:54:29 +00:00
if_tap.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
if_tun.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_tuntap.c kern: Make fileops and filterops tables const where possible 2024-12-03 01:03:42 +00:00
if_types.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
if_var.h ifnet: Remove if_getamcount() 2024-09-20 11:39:16 +00:00
if_vlan.c if_vlan: handle VID conflicts 2024-10-11 12:04:09 +02:00
if_vlan_var.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_vxlan.c if_vxlan(4): Prefer SYSCTL_INT over TUNABLE_INT 2025-02-03 20:24:10 +08:00
if_vxlan.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ifdi_if.m iflib: invert default restart on VLAN changes 2023-08-24 13:48:19 -07:00
iflib.c iflib: Set the NUMA domain in receive packet headers 2024-12-18 13:43:49 +00:00
iflib.h iflib: Add subinterface interrupt allocation function 2024-04-24 15:14:48 -07:00
ifq.c IfAPI: Explicitly include <net/if_private.h> in netstack 2023-01-31 15:02:16 -05:00
ifq.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
infiniband.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
mp_ring.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
mp_ring.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
mppc.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
mppcc.c sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
mppcd.c sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
netisr.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
netisr.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
netisr_internal.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
netmap.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
netmap_legacy.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
netmap_user.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
netmap_virt.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
paravirt.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
pfil.c pfil: don't leak pfil_head_t on interface detach 2024-01-08 16:29:05 -08:00
pfil.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
pfkeyv2.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
pfvar.h pf: don't use state keys after pf_state_insert() 2025-04-21 22:25:45 +02:00
ppp_defs.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
radix.c sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
radix.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
rndis.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
route.c sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
route.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
rss_config.c sys: Remove $FreeBSD$: two-line .c pattern 2023-08-16 11:54:30 -06:00
rss_config.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
rtsock.c socket: Move SO_SETFIB handling to protocol layers 2025-02-21 01:04:50 +00:00
sff8436.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sff8472.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
slcompress.c sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
slcompress.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
toeplitz.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
toeplitz.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
vnet.c vnet: Use static initializers 2025-03-13 18:13:51 +08:00
vnet.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00