Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107168490
D46578.id143074.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D46578.id143074.diff
View Options
diff --git a/sbin/pfctl/tests/files/pf1022.in b/sbin/pfctl/tests/files/pf1022.in
new file mode 100644
--- /dev/null
+++ b/sbin/pfctl/tests/files/pf1022.in
@@ -0,0 +1 @@
+pass out on em0 from 192.0.2.1 to 198.51.100.1 received-on fxp0
diff --git a/sbin/pfctl/tests/files/pf1022.ok b/sbin/pfctl/tests/files/pf1022.ok
new file mode 100644
--- /dev/null
+++ b/sbin/pfctl/tests/files/pf1022.ok
@@ -0,0 +1 @@
+pass out on em0 inet from 192.0.2.1 to 198.51.100.1 received-on fxp0 flags S/SA keep state
diff --git a/sbin/pfctl/tests/pfctl_test_list.inc b/sbin/pfctl/tests/pfctl_test_list.inc
--- a/sbin/pfctl/tests/pfctl_test_list.inc
+++ b/sbin/pfctl/tests/pfctl_test_list.inc
@@ -130,3 +130,4 @@
PFCTL_TEST(1019, "Test pflow option")
PFCTL_TEST(1020, "Test hashmark and semicolon comment")
PFCTL_TEST(1021, "Endpoint-independent")
+PFCTL_TEST(1022, "Test received-on")
diff --git a/tests/sys/netpfil/pf/pass_block.sh b/tests/sys/netpfil/pf/pass_block.sh
--- a/tests/sys/netpfil/pf/pass_block.sh
+++ b/tests/sys/netpfil/pf/pass_block.sh
@@ -292,6 +292,70 @@
pft_cleanup
}
+atf_test_case "received_on" "cleanup"
+received_on_head()
+{
+ atf_set descr 'Test received-on filtering'
+ atf_set require.user root
+}
+
+received_on_body()
+{
+ pft_init
+
+ epair_one=$(vnet_mkepair)
+ epair_two=$(vnet_mkepair)
+ epair_route=$(vnet_mkepair)
+
+ vnet_mkjail alcatraz ${epair_one}b ${epair_two}b ${epair_route}a
+ vnet_mkjail srv ${epair_route}b
+
+ ifconfig ${epair_one}a 192.0.2.2/24 up
+ ifconfig ${epair_two}a 198.51.100.2/24 up
+ route add 203.0.113.2 192.0.2.1
+ route add 203.0.113.3 198.51.100.1
+
+ jexec alcatraz ifconfig ${epair_one}b 192.0.2.1/24 up
+ jexec alcatraz ifconfig ${epair_two}b 198.51.100.1/24 up
+ jexec alcatraz ifconfig ${epair_route}a 203.0.113.1/24 up
+ jexec alcatraz sysctl net.inet.ip.forwarding=1
+
+ jexec srv ifconfig ${epair_route}b 203.0.113.2/24 up
+ jexec srv ifconfig ${epair_route}b inet alias 203.0.113.3/24 up
+ jexec srv route add default 203.0.113.1
+
+ # Sanity checks
+ atf_check -s exit:0 -o ignore \
+ ping -c 1 192.0.2.1
+ atf_check -s exit:0 -o ignore \
+ ping -c 1 198.51.100.1
+ atf_check -s exit:0 -o ignore \
+ ping -c 1 203.0.113.2
+ atf_check -s exit:0 -o ignore \
+ ping -c 1 203.0.113.3
+
+ jexec alcatraz pfctl -e
+ pft_set_rules alcatraz \
+ "block in" \
+ "pass received-on ${epair_one}b"
+
+ atf_check -s exit:0 -o ignore \
+ ping -c 1 192.0.2.1
+ atf_check -s exit:2 -o ignore \
+ ping -c 1 198.51.100.1
+
+ # And ensure we can check the received-on interface after routing
+ atf_check -s exit:0 -o ignore \
+ ping -c 1 203.0.113.2
+ atf_check -s exit:2 -o ignore \
+ ping -c 1 203.0.113.3
+}
+
+received_on_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "enable_disable"
@@ -300,4 +364,5 @@
atf_add_test_case "noalias"
atf_add_test_case "nested_inline"
atf_add_test_case "urpf"
+ atf_add_test_case "received_on"
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 4:17 AM (2 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15761083
Default Alt Text
D46578.id143074.diff (2 KB)
Attached To
Mode
D46578: pf tests: test the new received-on feature
Attached
Detach File
Event Timeline
Log In to Comment