Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
Describe the bug
Last tested working version:
FreeBSD OPNsense.localdomain 14.3-RELEASE-p16 FreeBSD 14.3-RELEASE-p16 stable/26.1-n272152-9b6eef552f24 SMP amd64
After the FreeBSD upgrade to 15.1, when configuring a rdr in combination with a stateful divert-to rule (DNAT + pass rule), traffic is passed to the divert socket, but handing the packet back to the kernel will cause a block with reason state-insert.
To Reproduce
A jail setup and a python forward script have been attached to this issue. The script sets up 3 jails, client, firewall and server.
Topology:
Client (10.1.1.2) --> (10.1.1.1) Firewall (10.2.2.1) --> Server (10.2.2.2)
jexec server sh -c 'python3 -m http.server 8080'
jexec firewall divert_forward.py
jexec client curl http://10.1.1.1:8080
- Observe the SYN passing through the python script, but blackholed once sent back to the kernel
pf.conf is as follows:
rdr on firewall0 inet proto tcp from {any} to {10.1.1.1} port {8080} -> 10.2.2.2 port 8080
pass in
pass out
pass in quick on firewall0 inet proto tcp from any to 10.2.2.2 port 8080 keep state divert-to 8000
Expected behavior
GET request goes through.
Describe alternatives you considered
Defining the divert-to on an outbound rule on the "internal" side.
Screenshots
Reproducing the issue on my development box shows the state-insert reason block:
Relevant log files
N/A
Additional context
N/A
Environment
OPNsense 27.1.a_13 (amd64)
FreeBSD OPNsense.development 15.1-RELEASE-p1 FreeBSD 15.1-RELEASE-p1 stable/26.7-n283674-12334a596709 SMP amd64
Scripts
jail_divert_dnat.setup.txt
divert_forward.py
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
Describe the bug
Last tested working version:
After the FreeBSD upgrade to 15.1, when configuring a rdr in combination with a stateful divert-to rule (DNAT + pass rule), traffic is passed to the divert socket, but handing the packet back to the kernel will cause a block with reason
state-insert.To Reproduce
A jail setup and a python forward script have been attached to this issue. The script sets up 3 jails,
client,firewallandserver.Topology:
Client (10.1.1.2) --> (10.1.1.1) Firewall (10.2.2.1) --> Server (10.2.2.2)
jexec server sh -c 'python3 -m http.server 8080'jexec firewall divert_forward.pyjexec client curl http://10.1.1.1:8080pf.confis as follows:Expected behavior
GET request goes through.
Describe alternatives you considered
Defining the divert-to on an outbound rule on the "internal" side.
Screenshots
Reproducing the issue on my development box shows the
state-insertreason block:Relevant log files
N/A
Additional context
N/A
Environment
OPNsense 27.1.a_13 (amd64)
FreeBSD OPNsense.development 15.1-RELEASE-p1 FreeBSD 15.1-RELEASE-p1 stable/26.7-n283674-12334a596709 SMP amd64
Scripts
jail_divert_dnat.setup.txt
divert_forward.py