opnsense-src/tests/sys
Doug Rabson 5ab151574c netinet*: Fix redirects for connections from localhost
Redirect rules use PFIL_IN and PFIL_OUT events to allow packet filter
rules to change the destination address and port for a connection.
Typically, the rule triggers on an input event when a packet is received
by a router and the destination address and/or port is changed to
implement the redirect. When a reply packet on this connection is output
to the network, the rule triggers again, reversing the modification.

When the connection is initiated on the same host as the packet filter,
it is initially output via lo0 which queues it for input processing.
This causes an input event on the lo0 interface, allowing redirect
processing to rewrite the destination and create state for the
connection. However, when the reply is received, no corresponding output
event is generated; instead, the packet is delivered to the higher level
protocol (e.g. tcp or udp) without reversing the redirect, the reply is
not matched to the connection and the packet is dropped (for tcp, a
connection reset is also sent).

This commit fixes the problem by adding a second packet filter call in
the input path. The second call happens right before the handoff to
higher level processing and provides the missing output event to allow
the redirect's reply processing to perform its rewrite. This extra
processing is disabled by default and can be enabled using pfilctl:

	pfilctl link -o pf:default-out inet-local
	pfilctl link -o pf:default-out6 inet6-local

PR:		268717
Reviewed-by:	kp, melifaro
MFC-after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40256
2023-05-31 11:11:05 +01:00
..
acl acl tests: Serialize 2023-03-30 19:35:59 -04:00
aio aio tests: Use unique names for zvols 2023-03-30 19:35:59 -04:00
audit tests/sys/audit: Remove MIPS-specific sysarch(2) test. 2023-03-29 15:06:03 -07:00
auditpipe Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
capsicum spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
cddl zfsd: add support for hotplugging spares 2023-04-06 11:58:55 -06:00
common pf tests: properly destroy renamed interfaces 2023-01-16 07:23:07 +01:00
compat32 tests: Don't recurse into sys/compat32 2023-05-16 02:06:34 +01:00
devrandom spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
fifo spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
file spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
fs spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
geom spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
kern tests: Fix format strings 2023-05-26 17:38:06 -04:00
kqueue kqueue tests: Simplify the test runner 2022-05-24 20:17:41 -04:00
mac Resolve conflict between the fusefs(5) and mac_bsdextended(4) tests 2020-05-02 20:14:59 +00:00
mqueue Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
net spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
netgraph netgraph tests: Serialize 2023-03-18 16:57:11 -04:00
netinet carp test: improve jail names for unicast_ll_v6 test 2023-05-18 22:12:08 +02:00
netinet6 testing: improve python vnet wrapper. 2022-12-29 19:59:11 +00:00
netipsec netipsec tests: Serialize 2023-03-20 12:21:17 -04:00
netlink netlink: add snl(3) support for listing genetlink multicast groups 2023-05-27 11:13:14 +00:00
netmap spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
netpfil netinet*: Fix redirects for connections from localhost 2023-05-31 11:11:05 +01:00
opencrypto test/sys/opencrypto: Fix NIST KAT parser iterator 2022-10-06 16:42:31 +02:00
pjdfstest Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
posixshm spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
ses ses: cleanup ses tests 2023-03-27 14:06:51 -06:00
sys spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
vfs capsicum: Verify that openat("/", "..") fails with ENOTCAPABLE 2023-04-25 09:54:47 -04:00
vm spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
vmm spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
Makefile tests: Don't recurse into sys/compat32 2023-05-16 02:06:34 +01:00
Makefile.depend
Makefile.inc Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00