summaryrefslogtreecommitdiff
path: root/regress/sbin
diff options
context:
space:
mode:
authorAlexandr Nedvedicky <sashan@cvs.openbsd.org>2017-11-29 00:24:33 +0000
committerAlexandr Nedvedicky <sashan@cvs.openbsd.org>2017-11-29 00:24:33 +0000
commitcfc9c70b790dca11145fc1bf935e283ea1c72d3d (patch)
tree1cfd5533797551bb37be32dc3a57d6884cb37848 /regress/sbin
parentd800b81596c9e9b563078254822b055833ad31e3 (diff)
- regression tests for 'load anchor ... from ...'
the test case itself comes from Leonardo Guardati
Diffstat (limited to 'regress/sbin')
-rw-r--r--regress/sbin/pfctl/Makefile28
-rw-r--r--regress/sbin/pfctl/pf112.in2
-rw-r--r--regress/sbin/pfctl/pf112.ok5
-rw-r--r--regress/sbin/pfctl/pf112.one2
-rw-r--r--regress/sbin/pfctl/pf112.two2
-rw-r--r--regress/sbin/pfctl/pf113.in2
-rw-r--r--regress/sbin/pfctl/pf113.ok5
-rw-r--r--regress/sbin/pfctl/pf113.one2
-rw-r--r--regress/sbin/pfctl/pf113.two12
9 files changed, 59 insertions, 1 deletions
diff --git a/regress/sbin/pfctl/Makefile b/regress/sbin/pfctl/Makefile
index adc236cc8b7..281f282ea15 100644
--- a/regress/sbin/pfctl/Makefile
+++ b/regress/sbin/pfctl/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.228 2017/11/24 22:53:55 bluhm Exp $
+# $OpenBSD: Makefile,v 1.229 2017/11/29 00:24:32 sashan Exp $
# TARGETS
# pf: feed pfNN.in through pfctl and check whether the output matches pfNN.ok
@@ -30,6 +30,7 @@ PFIF2IP=1 2 3
PFCHKSUM=1 2 3
PFCMD=1
PFCMDFAIL=1
+PFLOADANCHORS=112 113
PFCTL ?= /sbin/pfctl
@@ -331,6 +332,31 @@ pfchksum-update: ${PFCHKSUM_UPDATES}
NODEFAULT_TARGETS+=pfchksum
REGRESS_ROOT_TARGETS+=pfchksum
+.for n in ${PFLOADANCHORS}
+PFLOADANCHORS_TARGETS+=pfloadanchors${n}
+PFLOADANCHORS_UPDATES+=pfloadanchors${n}-update
+
+pfloadanchors${n}:
+ ${SUDO} ${PFCTL} -a regress -v -f - < ${.CURDIR}/pf${n}.in
+ (${SUDO} ${PFCTL} -a 'regress/*' -sr | \
+ sed -e 's/__automatic_[0-9a-f]*_.*>/__automatic_>/' ) | \
+ diff -u ${.CURDIR}/pf${n}.ok /dev/stdin
+ ${SUDO} ${PFCTL} -o none -a regress -Fr >/dev/null 2>&1
+
+pfloadanchors${n}-update:
+ ${SUDO} ${PFCTL} -a regress -v -f - < ${.CURDIR}/pf${n}.in
+ (${SUDO} ${PFCTL} -a 'regress/*' -sr | \
+ sed -e 's/__automatic_[0-9a-f]*_.*>/__automatic_>/' ) \
+ > ${.CURDIR}/pf${n}.ok
+ ${SUDO} ${PFCTL} -o none -a regress -Fr >/dev/null 2>&1
+
+.endfor
+
+pfloadanchors: ${PFLOADANCHORS_TARGETS}
+pfloadanchors-update: ${PFLOADANCHORS_UPDATES}
+
+REGRESS_TARGETS+=pfloadanchors
+
update: ${UPDATE_TARGETS}
alltests: ${REGRESS_TARGETS} ${NODEFAULT_TARGETS}
diff --git a/regress/sbin/pfctl/pf112.in b/regress/sbin/pfctl/pf112.in
new file mode 100644
index 00000000000..5b40dc0e69d
--- /dev/null
+++ b/regress/sbin/pfctl/pf112.in
@@ -0,0 +1,2 @@
+anchor "one"
+load anchor "one" from "pf112.one"
diff --git a/regress/sbin/pfctl/pf112.ok b/regress/sbin/pfctl/pf112.ok
new file mode 100644
index 00000000000..67420f7eea0
--- /dev/null
+++ b/regress/sbin/pfctl/pf112.ok
@@ -0,0 +1,5 @@
+anchor "one" all {
+ anchor "two" all {
+ pass from <foo> to any flags S/SA
+ }
+}
diff --git a/regress/sbin/pfctl/pf112.one b/regress/sbin/pfctl/pf112.one
new file mode 100644
index 00000000000..68e20033087
--- /dev/null
+++ b/regress/sbin/pfctl/pf112.one
@@ -0,0 +1,2 @@
+anchor "two"
+load anchor "two" from "pf112.two"
diff --git a/regress/sbin/pfctl/pf112.two b/regress/sbin/pfctl/pf112.two
new file mode 100644
index 00000000000..84e5f759569
--- /dev/null
+++ b/regress/sbin/pfctl/pf112.two
@@ -0,0 +1,2 @@
+table <foo> { 10.0.0.1 }
+pass from <foo>
diff --git a/regress/sbin/pfctl/pf113.in b/regress/sbin/pfctl/pf113.in
new file mode 100644
index 00000000000..f62fa7ab84a
--- /dev/null
+++ b/regress/sbin/pfctl/pf113.in
@@ -0,0 +1,2 @@
+anchor "one"
+load anchor "one" from "pf113.one"
diff --git a/regress/sbin/pfctl/pf113.ok b/regress/sbin/pfctl/pf113.ok
new file mode 100644
index 00000000000..a599c3c7e74
--- /dev/null
+++ b/regress/sbin/pfctl/pf113.ok
@@ -0,0 +1,5 @@
+anchor "one" all {
+ anchor "two" all {
+ pass inet from <__automatic_> to any flags S/SA
+ }
+}
diff --git a/regress/sbin/pfctl/pf113.one b/regress/sbin/pfctl/pf113.one
new file mode 100644
index 00000000000..4e4b63316b4
--- /dev/null
+++ b/regress/sbin/pfctl/pf113.one
@@ -0,0 +1,2 @@
+anchor "two"
+load anchor "two" from "pf113.two"
diff --git a/regress/sbin/pfctl/pf113.two b/regress/sbin/pfctl/pf113.two
new file mode 100644
index 00000000000..a99c64f94dc
--- /dev/null
+++ b/regress/sbin/pfctl/pf113.two
@@ -0,0 +1,12 @@
+addrs = "{ 1.2.3.4,
+ 10.20.30.40,
+ 2.4.6.8,
+ 20.40.60.80,
+ 4.8.12.16,
+ 40.80.120.160,
+ 5.6.7.8,
+ 50.60.70.80,
+ 10.12.14.16,
+ 100.120.140.160
+ }"
+pass from $addrs