diff options
author | Cedric Berger <cedric@cvs.openbsd.org> | 2003-01-14 14:43:32 +0000 |
---|---|---|
committer | Cedric Berger <cedric@cvs.openbsd.org> | 2003-01-14 14:43:32 +0000 |
commit | fdfc403c0410124b37b06d1cf07ae278bdd159d3 (patch) | |
tree | 391ddf1cf8d077a908e06ec866d233c408801969 /regress/sbin | |
parent | 1eb89ea242f33ff47176c75757713eb92fe847a1 (diff) |
Add regression tests for radix table address manipulations.
ok dhartmei@
Diffstat (limited to 'regress/sbin')
-rw-r--r-- | regress/sbin/pfctl/Makefile | 13 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr.exec | 41 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr1.in | 10 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr1.ok | 61 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr2.in | 10 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr2.ok | 61 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr3.in | 7 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr3.ok | 60 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr4.in | 9 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr4.ok | 197 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr5.in | 33 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr5.ok | 821 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr6.in | 13 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr6.ok | 152 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr7.in | 4 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr7.ok | 14 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr8.in | 3 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr8.ok | 22 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr9.in | 8 | ||||
-rw-r--r-- | regress/sbin/pfctl/pfr9.ok | 97 |
20 files changed, 1635 insertions, 1 deletions
diff --git a/regress/sbin/pfctl/Makefile b/regress/sbin/pfctl/Makefile index 113ca707216..e6907099129 100644 --- a/regress/sbin/pfctl/Makefile +++ b/regress/sbin/pfctl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.60 2003/01/06 11:36:04 mcbride Exp $ +# $OpenBSD: Makefile,v 1.61 2003/01/14 14:43:31 cedric Exp $ PFTESTS=1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 PFTESTS+=28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 @@ -7,6 +7,7 @@ PFSIMPLE=1 2 PFSETUP=1 PFLOAD=1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 26 27 28 29 PFLOAD+=30 31 32 33 34 35 36 38 39 40 43 44 +PFTABLE=1 2 3 4 5 6 7 8 9 .for n in ${PFFAIL} REGRESS_TARGETS+=pfail${n} @@ -52,6 +53,16 @@ pfload${n}: .endfor +.for n in ${PFTABLE} +REGRESS_TARGETS+=pfr${n} + +pfr${n}: + ${SUDO} /bin/ksh ${.CURDIR}/pfr.exec ${.CURDIR}/pfr${n}.in | \ + diff -u ${.CURDIR}/pfr${n}.ok /dev/stdin + +.endfor + + .ifdef DO_PFSETUP .for n in ${PFSETUP} REGRESS_TARGETS+=pfsetup${n} diff --git a/regress/sbin/pfctl/pfr.exec b/regress/sbin/pfctl/pfr.exec new file mode 100644 index 00000000000..bf230c159c0 --- /dev/null +++ b/regress/sbin/pfctl/pfr.exec @@ -0,0 +1,41 @@ +#!/bin/ksh +pfctl -t regress -qTk 2>&1 || exit 1 +echo "# create" +pfctl -t regress -Tc 2>&1 || exit 1 +for LINE in `sed -e "s/ /_/g" $1`; do + RESULT=`echo $LINE | awk '{split($1,a,"_");print a[1]}'` + case $RESULT in + pass|fail) ;; + *) continue ;; + esac + CMD=`echo $LINE | awk '{split($1,a,"_");print a[2]}'` + ARGSX=`echo $LINE | awk '{split($1,a,"_");for(i=3;a[i];i++)print a[i]}'` + ARGS="" + for ARG in $ARGSX; do ARGS="$ARGS $ARG"; done + if [ "$RESULT" = "pass" ]; then case $CMD in + a*|d*|r*) + echo "# $CMD -n $ARGS" + pfctl -t regress -nT $CMD $ARGS 2>&1 || exit 1 + echo "# $CMD -nf-" + echo "# test\n" $ARGSX | pfctl -t regress -nT $CMD -f- \ + 2>&1 || exit 1 + echo "# $CMD -nqv" + pfctl -t regress -nqvT $CMD $ARGS 2>&1 || exit 1 + echo "# $CMD -nqvv" + pfctl -t regress -nqvvT $CMD $ARGS 2>&1 || exit 1 + ;; + esac fi + if [ "$RESULT" = "pass" ]; then + echo "# $CMD" + pfctl -t regress -T $CMD $ARGS 2>&1 || exit 1 + else + echo "# $CMD" + pfctl -t regress -T $CMD $ARGS 2>&1 && exit 1 + fi +done +echo "# table" +pfctl -sT | grep regress 2>&1 || exit 1 +echo "# table -v" +pfctl -vsT | grep regress 2>&1 || exit 1 +echo "# kill" +pfctl -t regress -Tk 2>&1 || exit 1 diff --git a/regress/sbin/pfctl/pfr1.in b/regress/sbin/pfctl/pfr1.in new file mode 100644 index 00000000000..d0baf186daf --- /dev/null +++ b/regress/sbin/pfctl/pfr1.in @@ -0,0 +1,10 @@ +# basic manipulation of IPv4 addresses +pass add 1.1.1.1 1.1.1.2 1.1.1.3 +pass delete 1.1.1.1 1.1.1.2 1.1.1.4 +pass replace 1.1.1.1 1.1.1.2 1.1.1.3 +pass test 1.1.1.1 1.1.1.2 1.1.1.3 +fail test 1.1.1.1 1.1.1.2 1.1.1.4 +pass zero +pass show +pass flush +pass show diff --git a/regress/sbin/pfctl/pfr1.ok b/regress/sbin/pfctl/pfr1.ok new file mode 100644 index 00000000000..2b9e269efac --- /dev/null +++ b/regress/sbin/pfctl/pfr1.ok @@ -0,0 +1,61 @@ +# create +1 table added. +# add -n 1.1.1.1 1.1.1.2 1.1.1.3 +3/3 addresses added (dummy). +# add -nf- +3/3 addresses added (dummy). +# add -nqv +A 1.1.1.1 +A 1.1.1.2 +A 1.1.1.3 +# add -nqvv +A 1.1.1.1 +A 1.1.1.2 +A 1.1.1.3 +# add +3/3 addresses added. +# delete -n 1.1.1.1 1.1.1.2 1.1.1.4 +2/3 addresses deleted (dummy). +# delete -nf- +2/3 addresses deleted (dummy). +# delete -nqv +D 1.1.1.1 +D 1.1.1.2 +# delete -nqvv +D 1.1.1.1 +D 1.1.1.2 + 1.1.1.4 +# delete +2/3 addresses deleted. +# replace -n 1.1.1.1 1.1.1.2 1.1.1.3 +2 addresses added (dummy). +# replace -nf- +2 addresses added (dummy). +# replace -nqv +A 1.1.1.1 +A 1.1.1.2 +# replace -nqvv +A 1.1.1.1 +A 1.1.1.2 + 1.1.1.3 +# replace +2 addresses added. +# test +3/3 addresses match. +# test +2/3 addresses match. +# zero +1 table/stats cleared. +# show + 1.1.1.1 + 1.1.1.2 + 1.1.1.3 +# flush +3 addresses deleted. +# show +# table +regress +# table -v +-pa-- regress +# kill +1 table deleted. diff --git a/regress/sbin/pfctl/pfr2.in b/regress/sbin/pfctl/pfr2.in new file mode 100644 index 00000000000..76ca32d0717 --- /dev/null +++ b/regress/sbin/pfctl/pfr2.in @@ -0,0 +1,10 @@ +# basic manipulation of IPv6 addresses +pass add ::1 ::2 FE80::1 +pass delete ::1 ::2 FE80::2 +pass replace ::1 ::2 FE80::1 +pass test ::1 ::2 FE80::1 +fail test ::1 ::2 FE80::2 +pass zero +pass show +pass flush +pass show diff --git a/regress/sbin/pfctl/pfr2.ok b/regress/sbin/pfctl/pfr2.ok new file mode 100644 index 00000000000..0b1783c411b --- /dev/null +++ b/regress/sbin/pfctl/pfr2.ok @@ -0,0 +1,61 @@ +# create +1 table added. +# add -n ::1 ::2 FE80::1 +3/3 addresses added (dummy). +# add -nf- +3/3 addresses added (dummy). +# add -nqv +A ::1 +A ::2 +A fe80::1 +# add -nqvv +A ::1 +A ::2 +A fe80::1 +# add +3/3 addresses added. +# delete -n ::1 ::2 FE80::2 +2/3 addresses deleted (dummy). +# delete -nf- +2/3 addresses deleted (dummy). +# delete -nqv +D ::1 +D ::2 +# delete -nqvv +D ::1 +D ::2 + fe80::2 +# delete +2/3 addresses deleted. +# replace -n ::1 ::2 FE80::1 +2 addresses added (dummy). +# replace -nf- +2 addresses added (dummy). +# replace -nqv +A ::1 +A ::2 +# replace -nqvv +A ::1 +A ::2 + fe80::1 +# replace +2 addresses added. +# test +3/3 addresses match. +# test +2/3 addresses match. +# zero +1 table/stats cleared. +# show + ::1 + ::2 + fe80::1 +# flush +3 addresses deleted. +# show +# table +regress +# table -v +-pa-- regress +# kill +1 table deleted. diff --git a/regress/sbin/pfctl/pfr3.in b/regress/sbin/pfctl/pfr3.in new file mode 100644 index 00000000000..9cf12864c98 --- /dev/null +++ b/regress/sbin/pfctl/pfr3.in @@ -0,0 +1,7 @@ +# basic manipulation of IPv4 networks +pass add 10 10.11 10.11.12 10.11.12.13 +pass delete 10.11.0.0/16 10.11.12.0/24 +pass replace 10.0/8 172.16.0/12 192.168.0/16 +pass test 10.1.1.1 172.17.1.1 192.168.1.1 +fail test 11.1.1.1 +fail test 10.1.1.1 11.1.1.1 diff --git a/regress/sbin/pfctl/pfr3.ok b/regress/sbin/pfctl/pfr3.ok new file mode 100644 index 00000000000..8d30df0cdbe --- /dev/null +++ b/regress/sbin/pfctl/pfr3.ok @@ -0,0 +1,60 @@ +# create +1 table added. +# add -n 10 10.11 10.11.12 10.11.12.13 +4/4 addresses added (dummy). +# add -nf- +4/4 addresses added (dummy). +# add -nqv +A 10.0.0.0/8 +A 10.11.0.0/16 +A 10.11.12.0/24 +A 10.11.12.13 +# add -nqvv +A 10.0.0.0/8 +A 10.11.0.0/16 +A 10.11.12.0/24 +A 10.11.12.13 +# add +4/4 addresses added. +# delete -n 10.11.0.0/16 10.11.12.0/24 +2/2 addresses deleted (dummy). +# delete -nf- +2/2 addresses deleted (dummy). +# delete -nqv +D 10.11.0.0/16 +D 10.11.12.0/24 +# delete -nqvv +D 10.11.0.0/16 +D 10.11.12.0/24 +# delete +2/2 addresses deleted. +# replace -n 10.0/8 172.16.0/12 192.168.0/16 +2 addresses added (dummy). +1 addresses deleted (dummy). +# replace -nf- +2 addresses added (dummy). +1 addresses deleted (dummy). +# replace -nqv +A 172.16.0.0/12 +A 192.168.0.0/16 +D 10.11.12.13 +# replace -nqvv + 10.0.0.0/8 +A 172.16.0.0/12 +A 192.168.0.0/16 +D 10.11.12.13 +# replace +2 addresses added. +1 addresses deleted. +# test +3/3 addresses match. +# test +0/1 addresses match. +# test +1/2 addresses match. +# table +regress +# table -v +-pa-- regress +# kill +1 table deleted. diff --git a/regress/sbin/pfctl/pfr4.in b/regress/sbin/pfctl/pfr4.in new file mode 100644 index 00000000000..8d5ec7857fb --- /dev/null +++ b/regress/sbin/pfctl/pfr4.in @@ -0,0 +1,9 @@ +# parsing of all IPv4 network sizes +pass replace 0/0 0/1 0/2 0/3 0/4 0/5 0/6 0/7 +pass show +pass replace 0/8 0/9 0/10 0/11 0/12 0/13 0/14 0/15 +pass show +pass replace 0/16 0/17 0/18 0/19 0/20 0/21 0/22 0/23 +pass show +pass replace 0/24 0/25 0/26 0/27 0/28 0/29 0/30 0/31 +pass show diff --git a/regress/sbin/pfctl/pfr4.ok b/regress/sbin/pfctl/pfr4.ok new file mode 100644 index 00000000000..66fd94eb7a9 --- /dev/null +++ b/regress/sbin/pfctl/pfr4.ok @@ -0,0 +1,197 @@ +# create +1 table added. +# replace -n 0/0 0/1 0/2 0/3 0/4 0/5 0/6 0/7 +8 addresses added (dummy). +# replace -nf- +8 addresses added (dummy). +# replace -nqv +A 0.0.0.0/0 +A 0.0.0.0/1 +A 0.0.0.0/2 +A 0.0.0.0/3 +A 0.0.0.0/4 +A 0.0.0.0/5 +A 0.0.0.0/6 +A 0.0.0.0/7 +# replace -nqvv +A 0.0.0.0/0 +A 0.0.0.0/1 +A 0.0.0.0/2 +A 0.0.0.0/3 +A 0.0.0.0/4 +A 0.0.0.0/5 +A 0.0.0.0/6 +A 0.0.0.0/7 +# replace +8 addresses added. +# show + 0.0.0.0/0 + 0.0.0.0/7 + 0.0.0.0/6 + 0.0.0.0/5 + 0.0.0.0/4 + 0.0.0.0/3 + 0.0.0.0/2 + 0.0.0.0/1 +# replace -n 0/8 0/9 0/10 0/11 0/12 0/13 0/14 0/15 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A 0.0.0.0/8 +A 0.0.0.0/9 +A 0.0.0.0/10 +A 0.0.0.0/11 +A 0.0.0.0/12 +A 0.0.0.0/13 +A 0.0.0.0/14 +A 0.0.0.0/15 +D 0.0.0.0/1 +D 0.0.0.0/2 +D 0.0.0.0/3 +D 0.0.0.0/4 +D 0.0.0.0/5 +D 0.0.0.0/6 +D 0.0.0.0/7 +D 0.0.0.0/0 +# replace -nqvv +A 0.0.0.0/8 +A 0.0.0.0/9 +A 0.0.0.0/10 +A 0.0.0.0/11 +A 0.0.0.0/12 +A 0.0.0.0/13 +A 0.0.0.0/14 +A 0.0.0.0/15 +D 0.0.0.0/1 +D 0.0.0.0/2 +D 0.0.0.0/3 +D 0.0.0.0/4 +D 0.0.0.0/5 +D 0.0.0.0/6 +D 0.0.0.0/7 +D 0.0.0.0/0 +# replace +8 addresses added. +8 addresses deleted. +# show + 0.0.0.0/15 + 0.0.0.0/14 + 0.0.0.0/13 + 0.0.0.0/12 + 0.0.0.0/11 + 0.0.0.0/10 + 0.0.0.0/9 + 0.0.0.0/8 +# replace -n 0/16 0/17 0/18 0/19 0/20 0/21 0/22 0/23 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A 0.0.0.0/16 +A 0.0.0.0/17 +A 0.0.0.0/18 +A 0.0.0.0/19 +A 0.0.0.0/20 +A 0.0.0.0/21 +A 0.0.0.0/22 +A 0.0.0.0/23 +D 0.0.0.0/8 +D 0.0.0.0/9 +D 0.0.0.0/10 +D 0.0.0.0/11 +D 0.0.0.0/12 +D 0.0.0.0/13 +D 0.0.0.0/14 +D 0.0.0.0/15 +# replace -nqvv +A 0.0.0.0/16 +A 0.0.0.0/17 +A 0.0.0.0/18 +A 0.0.0.0/19 +A 0.0.0.0/20 +A 0.0.0.0/21 +A 0.0.0.0/22 +A 0.0.0.0/23 +D 0.0.0.0/8 +D 0.0.0.0/9 +D 0.0.0.0/10 +D 0.0.0.0/11 +D 0.0.0.0/12 +D 0.0.0.0/13 +D 0.0.0.0/14 +D 0.0.0.0/15 +# replace +8 addresses added. +8 addresses deleted. +# show + 0.0.0.0/23 + 0.0.0.0/22 + 0.0.0.0/21 + 0.0.0.0/20 + 0.0.0.0/19 + 0.0.0.0/18 + 0.0.0.0/17 + 0.0.0.0/16 +# replace -n 0/24 0/25 0/26 0/27 0/28 0/29 0/30 0/31 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A 0.0.0.0/24 +A 0.0.0.0/25 +A 0.0.0.0/26 +A 0.0.0.0/27 +A 0.0.0.0/28 +A 0.0.0.0/29 +A 0.0.0.0/30 +A 0.0.0.0/31 +D 0.0.0.0/16 +D 0.0.0.0/17 +D 0.0.0.0/18 +D 0.0.0.0/19 +D 0.0.0.0/20 +D 0.0.0.0/21 +D 0.0.0.0/22 +D 0.0.0.0/23 +# replace -nqvv +A 0.0.0.0/24 +A 0.0.0.0/25 +A 0.0.0.0/26 +A 0.0.0.0/27 +A 0.0.0.0/28 +A 0.0.0.0/29 +A 0.0.0.0/30 +A 0.0.0.0/31 +D 0.0.0.0/16 +D 0.0.0.0/17 +D 0.0.0.0/18 +D 0.0.0.0/19 +D 0.0.0.0/20 +D 0.0.0.0/21 +D 0.0.0.0/22 +D 0.0.0.0/23 +# replace +8 addresses added. +8 addresses deleted. +# show + 0.0.0.0/31 + 0.0.0.0/30 + 0.0.0.0/29 + 0.0.0.0/28 + 0.0.0.0/27 + 0.0.0.0/26 + 0.0.0.0/25 + 0.0.0.0/24 +# table +regress +# table -v +-pa-- regress +# kill +1 table deleted. diff --git a/regress/sbin/pfctl/pfr5.in b/regress/sbin/pfctl/pfr5.in new file mode 100644 index 00000000000..c309957492d --- /dev/null +++ b/regress/sbin/pfctl/pfr5.in @@ -0,0 +1,33 @@ +# parsing of all IPv6 network sizes +pass replace ::/0 ::/1 ::/2 ::/3 ::/4 ::/5 ::/6 ::/7 +pass show +pass replace ::/8 ::/9 ::/10 ::/11 ::/12 ::/13 ::/14 ::/15 +pass show +pass replace ::/16 ::/17 ::/18 ::/19 ::/20 ::/21 ::/22 ::/23 +pass show +pass replace ::/24 ::/25 ::/26 ::/27 ::/28 ::/29 ::/30 ::/31 +pass show +pass replace ::/32 ::/33 ::/34 ::/35 ::/36 ::/37 ::/38 ::/39 +pass show +pass replace ::/40 ::/41 ::/42 ::/43 ::/44 ::/45 ::/46 ::/47 +pass show +pass replace ::/48 ::/49 ::/50 ::/51 ::/52 ::/53 ::/54 ::/55 +pass show +pass replace ::/56 ::/57 ::/58 ::/59 ::/60 ::/61 ::/62 ::/63 +pass show +pass replace ::/64 ::/65 ::/66 ::/67 ::/68 ::/69 ::/70 ::/71 +pass show +pass replace ::/72 ::/73 ::/74 ::/75 ::/76 ::/77 ::/78 ::/79 +pass show +pass replace ::/80 ::/81 ::/82 ::/83 ::/84 ::/85 ::/86 ::/87 +pass show +pass replace ::/88 ::/89 ::/90 ::/91 ::/92 ::/93 ::/94 ::/95 +pass show +pass replace ::/96 ::/97 ::/98 ::/99 ::/100 ::/101 ::/102 ::/103 +pass show +pass replace ::/104 ::/105 ::/106 ::/107 ::/108 ::/109 ::/110 ::/111 +pass show +pass replace ::/112 ::/113 ::/114 ::/115 ::/116 ::/117 ::/118 ::/119 +pass show +pass replace ::/120 ::/121 ::/122 ::/123 ::/124 ::/125 ::/126 ::/127 +pass show diff --git a/regress/sbin/pfctl/pfr5.ok b/regress/sbin/pfctl/pfr5.ok new file mode 100644 index 00000000000..50e7cf70520 --- /dev/null +++ b/regress/sbin/pfctl/pfr5.ok @@ -0,0 +1,821 @@ +# create +1 table added. +# replace -n ::/0 ::/1 ::/2 ::/3 ::/4 ::/5 ::/6 ::/7 +8 addresses added (dummy). +# replace -nf- +8 addresses added (dummy). +# replace -nqv +A ::/0 +A ::/1 +A ::/2 +A ::/3 +A ::/4 +A ::/5 +A ::/6 +A ::/7 +# replace -nqvv +A ::/0 +A ::/1 +A ::/2 +A ::/3 +A ::/4 +A ::/5 +A ::/6 +A ::/7 +# replace +8 addresses added. +# show + ::/0 + ::/7 + ::/6 + ::/5 + ::/4 + ::/3 + ::/2 + ::/1 +# replace -n ::/8 ::/9 ::/10 ::/11 ::/12 ::/13 ::/14 ::/15 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/8 +A ::/9 +A ::/10 +A ::/11 +A ::/12 +A ::/13 +A ::/14 +A ::/15 +D ::/1 +D ::/2 +D ::/3 +D ::/4 +D ::/5 +D ::/6 +D ::/7 +D ::/0 +# replace -nqvv +A ::/8 +A ::/9 +A ::/10 +A ::/11 +A ::/12 +A ::/13 +A ::/14 +A ::/15 +D ::/1 +D ::/2 +D ::/3 +D ::/4 +D ::/5 +D ::/6 +D ::/7 +D ::/0 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/15 + ::/14 + ::/13 + ::/12 + ::/11 + ::/10 + ::/9 + ::/8 +# replace -n ::/16 ::/17 ::/18 ::/19 ::/20 ::/21 ::/22 ::/23 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/16 +A ::/17 +A ::/18 +A ::/19 +A ::/20 +A ::/21 +A ::/22 +A ::/23 +D ::/8 +D ::/9 +D ::/10 +D ::/11 +D ::/12 +D ::/13 +D ::/14 +D ::/15 +# replace -nqvv +A ::/16 +A ::/17 +A ::/18 +A ::/19 +A ::/20 +A ::/21 +A ::/22 +A ::/23 +D ::/8 +D ::/9 +D ::/10 +D ::/11 +D ::/12 +D ::/13 +D ::/14 +D ::/15 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/23 + ::/22 + ::/21 + ::/20 + ::/19 + ::/18 + ::/17 + ::/16 +# replace -n ::/24 ::/25 ::/26 ::/27 ::/28 ::/29 ::/30 ::/31 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/24 +A ::/25 +A ::/26 +A ::/27 +A ::/28 +A ::/29 +A ::/30 +A ::/31 +D ::/16 +D ::/17 +D ::/18 +D ::/19 +D ::/20 +D ::/21 +D ::/22 +D ::/23 +# replace -nqvv +A ::/24 +A ::/25 +A ::/26 +A ::/27 +A ::/28 +A ::/29 +A ::/30 +A ::/31 +D ::/16 +D ::/17 +D ::/18 +D ::/19 +D ::/20 +D ::/21 +D ::/22 +D ::/23 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/31 + ::/30 + ::/29 + ::/28 + ::/27 + ::/26 + ::/25 + ::/24 +# replace -n ::/32 ::/33 ::/34 ::/35 ::/36 ::/37 ::/38 ::/39 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/32 +A ::/33 +A ::/34 +A ::/35 +A ::/36 +A ::/37 +A ::/38 +A ::/39 +D ::/24 +D ::/25 +D ::/26 +D ::/27 +D ::/28 +D ::/29 +D ::/30 +D ::/31 +# replace -nqvv +A ::/32 +A ::/33 +A ::/34 +A ::/35 +A ::/36 +A ::/37 +A ::/38 +A ::/39 +D ::/24 +D ::/25 +D ::/26 +D ::/27 +D ::/28 +D ::/29 +D ::/30 +D ::/31 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/39 + ::/38 + ::/37 + ::/36 + ::/35 + ::/34 + ::/33 + ::/32 +# replace -n ::/40 ::/41 ::/42 ::/43 ::/44 ::/45 ::/46 ::/47 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/40 +A ::/41 +A ::/42 +A ::/43 +A ::/44 +A ::/45 +A ::/46 +A ::/47 +D ::/32 +D ::/33 +D ::/34 +D ::/35 +D ::/36 +D ::/37 +D ::/38 +D ::/39 +# replace -nqvv +A ::/40 +A ::/41 +A ::/42 +A ::/43 +A ::/44 +A ::/45 +A ::/46 +A ::/47 +D ::/32 +D ::/33 +D ::/34 +D ::/35 +D ::/36 +D ::/37 +D ::/38 +D ::/39 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/47 + ::/46 + ::/45 + ::/44 + ::/43 + ::/42 + ::/41 + ::/40 +# replace -n ::/48 ::/49 ::/50 ::/51 ::/52 ::/53 ::/54 ::/55 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/48 +A ::/49 +A ::/50 +A ::/51 +A ::/52 +A ::/53 +A ::/54 +A ::/55 +D ::/40 +D ::/41 +D ::/42 +D ::/43 +D ::/44 +D ::/45 +D ::/46 +D ::/47 +# replace -nqvv +A ::/48 +A ::/49 +A ::/50 +A ::/51 +A ::/52 +A ::/53 +A ::/54 +A ::/55 +D ::/40 +D ::/41 +D ::/42 +D ::/43 +D ::/44 +D ::/45 +D ::/46 +D ::/47 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/55 + ::/54 + ::/53 + ::/52 + ::/51 + ::/50 + ::/49 + ::/48 +# replace -n ::/56 ::/57 ::/58 ::/59 ::/60 ::/61 ::/62 ::/63 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/56 +A ::/57 +A ::/58 +A ::/59 +A ::/60 +A ::/61 +A ::/62 +A ::/63 +D ::/48 +D ::/49 +D ::/50 +D ::/51 +D ::/52 +D ::/53 +D ::/54 +D ::/55 +# replace -nqvv +A ::/56 +A ::/57 +A ::/58 +A ::/59 +A ::/60 +A ::/61 +A ::/62 +A ::/63 +D ::/48 +D ::/49 +D ::/50 +D ::/51 +D ::/52 +D ::/53 +D ::/54 +D ::/55 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/63 + ::/62 + ::/61 + ::/60 + ::/59 + ::/58 + ::/57 + ::/56 +# replace -n ::/64 ::/65 ::/66 ::/67 ::/68 ::/69 ::/70 ::/71 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/64 +A ::/65 +A ::/66 +A ::/67 +A ::/68 +A ::/69 +A ::/70 +A ::/71 +D ::/56 +D ::/57 +D ::/58 +D ::/59 +D ::/60 +D ::/61 +D ::/62 +D ::/63 +# replace -nqvv +A ::/64 +A ::/65 +A ::/66 +A ::/67 +A ::/68 +A ::/69 +A ::/70 +A ::/71 +D ::/56 +D ::/57 +D ::/58 +D ::/59 +D ::/60 +D ::/61 +D ::/62 +D ::/63 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/71 + ::/70 + ::/69 + ::/68 + ::/67 + ::/66 + ::/65 + ::/64 +# replace -n ::/72 ::/73 ::/74 ::/75 ::/76 ::/77 ::/78 ::/79 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/72 +A ::/73 +A ::/74 +A ::/75 +A ::/76 +A ::/77 +A ::/78 +A ::/79 +D ::/64 +D ::/65 +D ::/66 +D ::/67 +D ::/68 +D ::/69 +D ::/70 +D ::/71 +# replace -nqvv +A ::/72 +A ::/73 +A ::/74 +A ::/75 +A ::/76 +A ::/77 +A ::/78 +A ::/79 +D ::/64 +D ::/65 +D ::/66 +D ::/67 +D ::/68 +D ::/69 +D ::/70 +D ::/71 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/79 + ::/78 + ::/77 + ::/76 + ::/75 + ::/74 + ::/73 + ::/72 +# replace -n ::/80 ::/81 ::/82 ::/83 ::/84 ::/85 ::/86 ::/87 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/80 +A ::/81 +A ::/82 +A ::/83 +A ::/84 +A ::/85 +A ::/86 +A ::/87 +D ::/72 +D ::/73 +D ::/74 +D ::/75 +D ::/76 +D ::/77 +D ::/78 +D ::/79 +# replace -nqvv +A ::/80 +A ::/81 +A ::/82 +A ::/83 +A ::/84 +A ::/85 +A ::/86 +A ::/87 +D ::/72 +D ::/73 +D ::/74 +D ::/75 +D ::/76 +D ::/77 +D ::/78 +D ::/79 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/87 + ::/86 + ::/85 + ::/84 + ::/83 + ::/82 + ::/81 + ::/80 +# replace -n ::/88 ::/89 ::/90 ::/91 ::/92 ::/93 ::/94 ::/95 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/88 +A ::/89 +A ::/90 +A ::/91 +A ::/92 +A ::/93 +A ::/94 +A ::/95 +D ::/80 +D ::/81 +D ::/82 +D ::/83 +D ::/84 +D ::/85 +D ::/86 +D ::/87 +# replace -nqvv +A ::/88 +A ::/89 +A ::/90 +A ::/91 +A ::/92 +A ::/93 +A ::/94 +A ::/95 +D ::/80 +D ::/81 +D ::/82 +D ::/83 +D ::/84 +D ::/85 +D ::/86 +D ::/87 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/95 + ::/94 + ::/93 + ::/92 + ::/91 + ::/90 + ::/89 + ::/88 +# replace -n ::/96 ::/97 ::/98 ::/99 ::/100 ::/101 ::/102 ::/103 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/96 +A ::/97 +A ::/98 +A ::/99 +A ::/100 +A ::/101 +A ::/102 +A ::/103 +D ::/88 +D ::/89 +D ::/90 +D ::/91 +D ::/92 +D ::/93 +D ::/94 +D ::/95 +# replace -nqvv +A ::/96 +A ::/97 +A ::/98 +A ::/99 +A ::/100 +A ::/101 +A ::/102 +A ::/103 +D ::/88 +D ::/89 +D ::/90 +D ::/91 +D ::/92 +D ::/93 +D ::/94 +D ::/95 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/103 + ::/102 + ::/101 + ::/100 + ::/99 + ::/98 + ::/97 + ::/96 +# replace -n ::/104 ::/105 ::/106 ::/107 ::/108 ::/109 ::/110 ::/111 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/104 +A ::/105 +A ::/106 +A ::/107 +A ::/108 +A ::/109 +A ::/110 +A ::/111 +D ::/96 +D ::/97 +D ::/98 +D ::/99 +D ::/100 +D ::/101 +D ::/102 +D ::/103 +# replace -nqvv +A ::/104 +A ::/105 +A ::/106 +A ::/107 +A ::/108 +A ::/109 +A ::/110 +A ::/111 +D ::/96 +D ::/97 +D ::/98 +D ::/99 +D ::/100 +D ::/101 +D ::/102 +D ::/103 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/111 + ::/110 + ::/109 + ::/108 + ::/107 + ::/106 + ::/105 + ::/104 +# replace -n ::/112 ::/113 ::/114 ::/115 ::/116 ::/117 ::/118 ::/119 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/112 +A ::/113 +A ::/114 +A ::/115 +A ::/116 +A ::/117 +A ::/118 +A ::/119 +D ::/104 +D ::/105 +D ::/106 +D ::/107 +D ::/108 +D ::/109 +D ::/110 +D ::/111 +# replace -nqvv +A ::/112 +A ::/113 +A ::/114 +A ::/115 +A ::/116 +A ::/117 +A ::/118 +A ::/119 +D ::/104 +D ::/105 +D ::/106 +D ::/107 +D ::/108 +D ::/109 +D ::/110 +D ::/111 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/119 + ::/118 + ::/117 + ::/116 + ::/115 + ::/114 + ::/113 + ::/112 +# replace -n ::/120 ::/121 ::/122 ::/123 ::/124 ::/125 ::/126 ::/127 +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nf- +8 addresses added (dummy). +8 addresses deleted (dummy). +# replace -nqv +A ::/120 +A ::/121 +A ::/122 +A ::/123 +A ::/124 +A ::/125 +A ::/126 +A ::/127 +D ::/112 +D ::/113 +D ::/114 +D ::/115 +D ::/116 +D ::/117 +D ::/118 +D ::/119 +# replace -nqvv +A ::/120 +A ::/121 +A ::/122 +A ::/123 +A ::/124 +A ::/125 +A ::/126 +A ::/127 +D ::/112 +D ::/113 +D ::/114 +D ::/115 +D ::/116 +D ::/117 +D ::/118 +D ::/119 +# replace +8 addresses added. +8 addresses deleted. +# show + ::/127 + ::/126 + ::/125 + ::/124 + ::/123 + ::/122 + ::/121 + ::/120 +# table +regress +# table -v +-pa-- regress +# kill +1 table deleted. diff --git a/regress/sbin/pfctl/pfr6.in b/regress/sbin/pfctl/pfr6.in new file mode 100644 index 00000000000..3d7d97a442d --- /dev/null +++ b/regress/sbin/pfctl/pfr6.in @@ -0,0 +1,13 @@ +# negated addresses and networks +pass add 1.1.1.1 !1.1.1.2 10.10 !10.11 ::1 !::2 +pass show +pass replace 1.1.1.1 !1.1.1.2 !!1.1.1.3 !!!1.1.1.4 +pass show +pass replace fe80::/16 !fe81::/16 !!fe82::/16 !!!fe83::/16 +pass show +pass replace 10 !10.10 10.10.10 !10.10.10.10 +pass add fe80::/16 !fe80:fe80::/32 fe80:fe80:fe80::/48 +pass show +pass test 10.1.1.1 10.10.10.1 +fail test 11.1.1.1 10.10.1.1 10.10.10.10 +fail test 10.1.1.1 11.1.1.1 diff --git a/regress/sbin/pfctl/pfr6.ok b/regress/sbin/pfctl/pfr6.ok new file mode 100644 index 00000000000..196f3728a09 --- /dev/null +++ b/regress/sbin/pfctl/pfr6.ok @@ -0,0 +1,152 @@ +# create +1 table added. +# add -n 1.1.1.1 !1.1.1.2 10.10 !10.11 ::1 !::2 +6/6 addresses added (dummy). +# add -nf- +6/6 addresses added (dummy). +# add -nqv +A 1.1.1.1 +A !1.1.1.2 +A 10.10.0.0/16 +A !10.11.0.0/16 +A ::1 +A !::2 +# add -nqvv +A 1.1.1.1 +A !1.1.1.2 +A 10.10.0.0/16 +A !10.11.0.0/16 +A ::1 +A !::2 +# add +6/6 addresses added. +# show + 1.1.1.1 + !1.1.1.2 + 10.10.0.0/16 + !10.11.0.0/16 + ::1 + !::2 +# replace -n 1.1.1.1 !1.1.1.2 !!1.1.1.3 !!!1.1.1.4 +2 addresses added (dummy). +4 addresses deleted (dummy). +# replace -nf- +2 addresses added (dummy). +4 addresses deleted (dummy). +# replace -nqv +A 1.1.1.3 +A !1.1.1.4 +D !::2 +D ::1 +D !10.11.0.0/16 +D 10.10.0.0/16 +# replace -nqvv + 1.1.1.1 + !1.1.1.2 +A 1.1.1.3 +A !1.1.1.4 +D !::2 +D ::1 +D !10.11.0.0/16 +D 10.10.0.0/16 +# replace +2 addresses added. +4 addresses deleted. +# show + 1.1.1.1 + !1.1.1.2 + 1.1.1.3 + !1.1.1.4 +# replace -n fe80::/16 !fe81::/16 !!fe82::/16 !!!fe83::/16 +4 addresses added (dummy). +4 addresses deleted (dummy). +# replace -nf- +4 addresses added (dummy). +4 addresses deleted (dummy). +# replace -nqv +A fe80::/16 +A !fe81::/16 +A fe82::/16 +A !fe83::/16 +D !1.1.1.4 +D 1.1.1.3 +D !1.1.1.2 +D 1.1.1.1 +# replace -nqvv +A fe80::/16 +A !fe81::/16 +A fe82::/16 +A !fe83::/16 +D !1.1.1.4 +D 1.1.1.3 +D !1.1.1.2 +D 1.1.1.1 +# replace +4 addresses added. +4 addresses deleted. +# show + fe80::/16 + !fe81::/16 + fe82::/16 + !fe83::/16 +# replace -n 10 !10.10 10.10.10 !10.10.10.10 +4 addresses added (dummy). +4 addresses deleted (dummy). +# replace -nf- +4 addresses added (dummy). +4 addresses deleted (dummy). +# replace -nqv +A 10.0.0.0/8 +A !10.10.0.0/16 +A 10.10.10.0/24 +A !10.10.10.10 +D !fe83::/16 +D fe82::/16 +D !fe81::/16 +D fe80::/16 +# replace -nqvv +A 10.0.0.0/8 +A !10.10.0.0/16 +A 10.10.10.0/24 +A !10.10.10.10 +D !fe83::/16 +D fe82::/16 +D !fe81::/16 +D fe80::/16 +# replace +4 addresses added. +4 addresses deleted. +# add -n fe80::/16 !fe80:fe80::/32 fe80:fe80:fe80::/48 +3/3 addresses added (dummy). +# add -nf- +3/3 addresses added (dummy). +# add -nqv +A fe80::/16 +A !fe80:fe80::/32 +A fe80:fe80:fe80::/48 +# add -nqvv +A fe80::/16 +A !fe80:fe80::/32 +A fe80:fe80:fe80::/48 +# add +3/3 addresses added. +# show + 10.0.0.0/8 + !10.10.0.0/16 + 10.10.10.0/24 + !10.10.10.10 + fe80::/16 + !fe80:fe80::/32 + fe80:fe80:fe80::/48 +# test +2/2 addresses match. +# test +0/3 addresses match. +# test +1/2 addresses match. +# table +regress +# table -v +-pa-- regress +# kill +1 table deleted. diff --git a/regress/sbin/pfctl/pfr7.in b/regress/sbin/pfctl/pfr7.in new file mode 100644 index 00000000000..39521b46d2a --- /dev/null +++ b/regress/sbin/pfctl/pfr7.in @@ -0,0 +1,4 @@ +# invalid addresses +fail add 1.2.3.4.5 +fail add 10.1.2.3/33 +fail add :80 diff --git a/regress/sbin/pfctl/pfr7.ok b/regress/sbin/pfctl/pfr7.ok new file mode 100644 index 00000000000..9993ec36ec8 --- /dev/null +++ b/regress/sbin/pfctl/pfr7.ok @@ -0,0 +1,14 @@ +# create +1 table added. +# add +pfctl: illegal address: "1.2.3.4.5" +# add +pfctl: illegal netmask: "33" +# add +pfctl: illegal address: ":80" +# table +regress +# table -v +-pa-- regress +# kill +1 table deleted. diff --git a/regress/sbin/pfctl/pfr8.in b/regress/sbin/pfctl/pfr8.in new file mode 100644 index 00000000000..49ef4af4776 --- /dev/null +++ b/regress/sbin/pfctl/pfr8.in @@ -0,0 +1,3 @@ +# hostname translations +pass add localhost +fail add invalid$host diff --git a/regress/sbin/pfctl/pfr8.ok b/regress/sbin/pfctl/pfr8.ok new file mode 100644 index 00000000000..bda9e7be09c --- /dev/null +++ b/regress/sbin/pfctl/pfr8.ok @@ -0,0 +1,22 @@ +# create +1 table added. +# add -n localhost +2/2 addresses added (dummy). +# add -nf- +2/2 addresses added (dummy). +# add -nqv +A ::1 +A 127.0.0.1 +# add -nqvv +A ::1 +A 127.0.0.1 +# add +2/2 addresses added. +# add +pfctl: illegal address: "invalid$host" +# table +regress +# table -v +-pa-- regress +# kill +1 table deleted. diff --git a/regress/sbin/pfctl/pfr9.in b/regress/sbin/pfctl/pfr9.in new file mode 100644 index 00000000000..8b11c82e9c6 --- /dev/null +++ b/regress/sbin/pfctl/pfr9.in @@ -0,0 +1,8 @@ +# duplicate handling +pass add 1.2.3.4 ::1 1.2.3.4 ::1 +pass add 1.2.3.4 ::1 1.2.3.4 ::1 +pass delete 1.2.3.4 ::1 1.2.3.4 ::1 +pass delete 1.2.3.4 ::1 1.2.3.4 ::1 +pass replace 1.2.3.4 ::1 1.2.3.4 ::1 +pass replace 1.2.3.4 ::1 1.2.3.4 ::1 +pass show diff --git a/regress/sbin/pfctl/pfr9.ok b/regress/sbin/pfctl/pfr9.ok new file mode 100644 index 00000000000..88fba9efbb7 --- /dev/null +++ b/regress/sbin/pfctl/pfr9.ok @@ -0,0 +1,97 @@ +# create +1 table added. +# add -n 1.2.3.4 ::1 1.2.3.4 ::1 +2/4 addresses added (dummy). +# add -nf- +2/4 addresses added (dummy). +# add -nqv +A 1.2.3.4 +A ::1 +X 1.2.3.4 +X ::1 +# add -nqvv +A 1.2.3.4 +A ::1 +X 1.2.3.4 +X ::1 +# add +2/4 addresses added. +# add -n 1.2.3.4 ::1 1.2.3.4 ::1 +0/4 addresses added (dummy). +# add -nf- +0/4 addresses added (dummy). +# add -nqv +# add -nqvv + 1.2.3.4 + ::1 + 1.2.3.4 + ::1 +# add +0/4 addresses added. +# delete -n 1.2.3.4 ::1 1.2.3.4 ::1 +2/4 addresses deleted (dummy). +# delete -nf- +2/4 addresses deleted (dummy). +# delete -nqv +D 1.2.3.4 +D ::1 +X 1.2.3.4 +X ::1 +# delete -nqvv +D 1.2.3.4 +D ::1 +X 1.2.3.4 +X ::1 +# delete +2/4 addresses deleted. +# delete -n 1.2.3.4 ::1 1.2.3.4 ::1 +0/4 addresses deleted (dummy). +# delete -nf- +0/4 addresses deleted (dummy). +# delete -nqv +# delete -nqvv + 1.2.3.4 + ::1 + 1.2.3.4 + ::1 +# delete +0/4 addresses deleted. +# replace -n 1.2.3.4 ::1 1.2.3.4 ::1 +2 addresses added (dummy). +# replace -nf- +2 addresses added (dummy). +# replace -nqv +A 1.2.3.4 +A ::1 +X 1.2.3.4 +X ::1 +# replace -nqvv +A 1.2.3.4 +A ::1 +X 1.2.3.4 +X ::1 +# replace +2 addresses added. +# replace -n 1.2.3.4 ::1 1.2.3.4 ::1 +no changes (dummy). +# replace -nf- +no changes (dummy). +# replace -nqv +X 1.2.3.4 +X ::1 +# replace -nqvv + 1.2.3.4 + ::1 +X 1.2.3.4 +X ::1 +# replace +no changes. +# show + 1.2.3.4 + ::1 +# table +regress +# table -v +-pa-- regress +# kill +1 table deleted. |