freebsd-dev/sys
Kristof Provost 829a69db85 pf: change pf_route so pf only runs when packets enter and leave the stack.
before this change pf_route operated on the semantic that pf runs
when packets go over an interface, so when pf_route changed which
interface the packet was on it would run pf_test again. this change
changes (restores) the semantic that pf is only supposed to run
when packets go in or out of the network stack, even if route-to
is responsibly for short circuiting past the network stack.

just to be clear, for normal packets (ie, those not touched by
route-to/reply-to/dup-to), there isn't a difference between running
pf when packets enter or leave the stack, or having pf run when a
packet goes over an interface.

the main reason for this change is that running the same packet
through pf multiple times creates confusion for the state table.
by default, pf states are floating, meaning that packets are matched
to states regardless of which interface they're going over. if a
packet leaving on em0 is rerouted out em1, both traversals will end
up using the same state, which at best will make the accounting
look weird, or at worst fail some checks in the state and get
dropped.

another reason for this commit is is to make handling of the changes
that route-to makes consistent with other changes that are made to
packet. eg, when nat is applied to a packet, we don't run pf_test
again with the new addresses.

the main caveat with this diff is you can't have one rule that
pushes a packet out a different interface, and then have a rule on
that second interface that NATs the packet. i'm not convinced this
ever worked reliably or was used much anyway, so we don't think
it's a big concern.

discussed with many, with special thanks to bluhm@, sashan@ and
sthen@ for weathering most of that pain.
ok claudio@ sashan@ jmatthew@

Obtained from:	OpenBSD
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29554
2021-04-05 09:57:06 +02:00
..
amd64 x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
arm arm: add options GDB to std.armv6 and std.armv7 2021-03-30 12:04:24 -03:00
arm64 gdb: report specific stop reason for watchpoints 2021-03-30 11:36:41 -03:00
bsm
cam cam: make sure to clear CCBs allocated on the stack 2021-03-30 19:15:43 +01:00
cddl fbt: Remove some handling for multiple CTF containers 2021-04-02 17:49:13 -04:00
compat LinuxKPI: treat firmware file names more lenient 2021-04-02 10:03:39 +00:00
conf x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
contrib ACPICA: Fix build with options ACPI_DEBUG 2021-04-01 21:18:49 -04:00
crypto ossl: Don't encryt/decrypt too much data for chacha20. 2021-04-01 15:49:07 -07:00
ddb ddb: replace watchpoint set/clear functions 2021-03-29 12:05:44 -03:00
dev x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
dts dts: Bump the freebsd branding version to 5.10 2021-03-23 15:02:21 +01:00
fs nfsd: make the server repeat CB_RECALL every couple of seconds 2021-04-04 18:15:54 -07:00
gdb gdb: report specific stop reason for watchpoints 2021-03-30 11:36:41 -03:00
geom gmirror: Pre-allocate the timeout event structure 2021-03-11 15:45:15 -05:00
gnu Remove the old dts imported tree. 2021-01-15 20:09:55 +01:00
i386 x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
isa Move back the isa non-PNP driver deadline to FreeBSD 14. 2021-03-08 16:00:23 -07:00
kern lock_delay(9): improve interaction with restrict_starvation 2021-04-03 13:08:53 +01:00
kgssapi opencrypto: Introduce crypto_dispatch_async() 2021-02-08 09:19:19 -05:00
libkern x86: remove gcov kernel support 2021-04-02 15:41:51 +03:00
mips Clean up a couple of MD warts in vm_fault_populate(): 2021-03-30 18:15:55 -07:00
modules ndis: remove leftover sys/modules/ndis 2021-03-25 14:31:00 -04:00
net iflib: add support for netmap offsets 2021-04-05 07:54:47 +00:00
net80211 net80211: prefix get_random_bytes() with net80211_ 2021-03-24 22:16:09 +00:00
netgraph netgraph/ng_bridge: Add counters for the first link, too 2021-02-10 19:05:37 +01:00
netinet fix typo in 38ea2bd069 2021-04-02 20:34:33 +02:00
netinet6 base: remove if_wg(4) and associated utilities, manpage 2021-03-17 09:14:48 -05:00
netipsec Revert "SO_RERROR indicates that receive buffer overflows should be handled as errors." 2021-02-08 22:32:32 +00:00
netpfil pf: change pf_route so pf only runs when packets enter and leave the stack. 2021-04-05 09:57:06 +02:00
netsmb
nfs Fix panic when using BOOTP to resolve root path. 2021-03-28 14:02:40 -05:00
nfsclient nfs: Cleanup dead files 2021-03-17 06:16:31 +11:00
nfsserver nfs: Cleanup dead files 2021-03-17 06:16:31 +11:00
nlm
ofed LinuxKPI/OFED: (re)move inetdevice.h implementation 2021-03-30 14:40:46 +00:00
opencrypto ktls: Fix non-inplace TLS 1.3 encryption. 2021-03-10 11:07:40 -08:00
powerpc powernv: Include NUMA locality information in the CPU topology 2021-04-01 10:25:57 -04:00
riscv ddb: replace watchpoint set/clear functions 2021-03-29 12:05:44 -03:00
rpc nfs-over-tls: handle res.gid.gid_val correctly for memory allocation 2021-01-12 13:59:52 -08:00
security Add a comment on why the call to mac_vnode_relabel() might be in the wrong 2021-02-27 16:25:26 +00:00
sys vfs: add vfs_smr_quiesce 2021-04-02 05:11:05 +02:00
teken
tests Add IPv4 fib lookup performance tests with uniform keys. 2021-03-30 14:32:28 +01:00
tools syscalls.master: Add a new syscall type: RESERVED 2021-01-26 18:27:44 +00:00
ufs softdep_unmount: assert that no dandling dependencies are left 2021-03-12 13:31:08 +02:00
vm Add sysctl debug.uma_reclaim 2021-04-04 20:39:06 +03:00
x86 gdb: allow setting/removing hardware watchpoints 2021-03-30 11:36:41 -03:00
xdr
xen xen: move x86-specific xen_vector_callback_enabled to sys/x86 2021-03-15 14:20:21 +01:00
Makefile