diff options
author | Kjell Wooding <kjell@cvs.openbsd.org> | 2002-06-08 09:43:59 +0000 |
---|---|---|
committer | Kjell Wooding <kjell@cvs.openbsd.org> | 2002-06-08 09:43:59 +0000 |
commit | f3b7d34b9b9200b547cd9904152df9d9aae1bc5b (patch) | |
tree | d6f228bb48c63e5ae1db8ad221c5ab5a165bd6cf /regress/sbin/pfctl | |
parent | 55669dcabc31d563cc17941f50e1ab574003341a (diff) |
Add regression tests for NAT list expansion
Diffstat (limited to 'regress/sbin/pfctl')
-rw-r--r-- | regress/sbin/pfctl/Makefile | 15 | ||||
-rw-r--r-- | regress/sbin/pfctl/nat1.in | 14 | ||||
-rw-r--r-- | regress/sbin/pfctl/nat1.ok | 17 |
3 files changed, 41 insertions, 5 deletions
diff --git a/regress/sbin/pfctl/Makefile b/regress/sbin/pfctl/Makefile index 16a0e38f296..31567648579 100644 --- a/regress/sbin/pfctl/Makefile +++ b/regress/sbin/pfctl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.14 2002/06/07 18:36:54 frantzen Exp $ +# $OpenBSD: Makefile,v 1.15 2002/06/08 09:43:58 kjell Exp $ PFTESTS=1 2 3 4 5 6 7 8 9 10 11 12 13 14 PFFAIL=1 2 3 4 5 6 7 8 @@ -22,11 +22,16 @@ pf${n}: .endfor -binat1: - pfctl -nv -N - < ${.CURDIR}/binat1.in | \ - cmp -s ${.CURDIR}/binat1.ok /dev/stdin +NATTESTS=binat1 nat1 -REGRESSTARGETS+=binat1 +.for n in ${NATTESTS} +REGRESSTARGETS+=${n} + +${n}: + pfctl -nv -N - < ${.CURDIR}/${n}.in | \ + cmp -s ${.CURDIR}/${n}.ok /dev/stdin + +.endfor .PHONY: ${REGRESSTARGETS} diff --git a/regress/sbin/pfctl/nat1.in b/regress/sbin/pfctl/nat1.in new file mode 100644 index 00000000000..1b4a567ca28 --- /dev/null +++ b/regress/sbin/pfctl/nat1.in @@ -0,0 +1,14 @@ +# test nat + +TEST_LIST1 = "{ 192.168.1.5, 192.168.1.6, 192.168.1.7 }" +TEST_LIST2 = "{ 172.6.1.1, 172.14.1.2/32, 172.16.2.0/24 }" + +no nat on lo0 from 192.168.1.1 to 10.1.2.3 +nat on lo0 from 192.168.1.1 to any -> 10.0.0.1 +nat on lo0 proto tcp from 192.168.1.2 to any -> 10.0.0.2 +nat on lo0 proto udp from 192.168.1.3 to any -> 10.0.0.3 +nat on lo0 proto icmp from 192.168.1.4 to any -> 10.0.0.4 + +nat on lo0 from $TEST_LIST1 to $TEST_LIST2 -> lo0 + +nat on lo0 from 192.168.1.8 to ! 172.17.0.0/16 -> 10.0.0.8 diff --git a/regress/sbin/pfctl/nat1.ok b/regress/sbin/pfctl/nat1.ok new file mode 100644 index 00000000000..3350699b4a2 --- /dev/null +++ b/regress/sbin/pfctl/nat1.ok @@ -0,0 +1,17 @@ +TEST_LIST1 = { 192.168.1.5, 192.168.1.6, 192.168.1.7 } +TEST_LIST2 = { 172.6.1.1, 172.14.1.2/32, 172.16.2.0/24 } +no nat on lo0 inet from 192.168.1.1 to 10.1.2.3 +nat on lo0 inet from 192.168.1.1 to any -> 10.0.0.1 +nat on lo0 inet proto tcp from 192.168.1.2 to any -> 10.0.0.2 +nat on lo0 inet proto udp from 192.168.1.3 to any -> 10.0.0.3 +nat on lo0 inet proto icmp from 192.168.1.4 to any -> 10.0.0.4 +nat on lo0 inet from 192.168.1.7 to 172.16.2.0/24 -> 127.0.0.1 +nat on lo0 inet from 192.168.1.7 to 172.14.1.2 -> 127.0.0.1 +nat on lo0 inet from 192.168.1.7 to 172.6.1.1 -> 127.0.0.1 +nat on lo0 inet from 192.168.1.6 to 172.16.2.0/24 -> 127.0.0.1 +nat on lo0 inet from 192.168.1.6 to 172.14.1.2 -> 127.0.0.1 +nat on lo0 inet from 192.168.1.6 to 172.6.1.1 -> 127.0.0.1 +nat on lo0 inet from 192.168.1.5 to 172.16.2.0/24 -> 127.0.0.1 +nat on lo0 inet from 192.168.1.5 to 172.14.1.2 -> 127.0.0.1 +nat on lo0 inet from 192.168.1.5 to 172.6.1.1 -> 127.0.0.1 +nat on lo0 inet from 192.168.1.8 to ! 172.17.0.0/16 -> 10.0.0.8 |