From bee5cc27d8c26d34fac23bc728c69ea8f7c343d1 Mon Sep 17 00:00:00 2001 From: sashan Date: Mon, 25 Oct 2021 14:56:47 +0000 Subject: [PATCH] - add regression tests for pfctl '$rn' macro expansion OK @bluhm --- regress/sbin/pfctl/Makefile | 6 +-- regress/sbin/pfctl/pf114.in | 16 ++++++++ regress/sbin/pfctl/pf114.loaded | 64 ++++++++++++++++++++++++++++++ regress/sbin/pfctl/pf114.ok | 16 ++++++++ regress/sbin/pfctl/pf114.optimized | 8 ++++ 5 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 regress/sbin/pfctl/pf114.in create mode 100644 regress/sbin/pfctl/pf114.loaded create mode 100644 regress/sbin/pfctl/pf114.ok create mode 100644 regress/sbin/pfctl/pf114.optimized diff --git a/regress/sbin/pfctl/Makefile b/regress/sbin/pfctl/Makefile index 7beb24d0101..61816a858f8 100644 --- a/regress/sbin/pfctl/Makefile +++ b/regress/sbin/pfctl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.232 2021/09/17 05:59:16 anton Exp $ +# $OpenBSD: Makefile,v 1.233 2021/10/25 14:56:47 sashan Exp $ # TARGETS # pf: feed pfNN.in through pfctl and check whether the output matches pfNN.ok @@ -17,7 +17,7 @@ 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 34 35 36 38 39 40 41 44 46 47 48 49 50 PFTESTS+=52 53 54 55 56 57 60 61 65 66 67 68 69 70 71 72 73 PFTESTS+=74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 -PFTESTS+=97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 +PFTESTS+=97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 114 PFFAIL=1 2 3 4 5 6 7 8 11 12 13 14 15 16 17 19 20 23 25 27 PFFAIL+=30 37 38 39 40 41 42 43 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 PFFAIL+=63 64 65 66 67 @@ -25,7 +25,7 @@ PFSIMPLE=1 2 PFSETUP=1 4 PFLOAD=1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 23 24 25 26 27 28 29 PFLOAD+=30 31 32 34 36 38 39 40 44 46 47 48 49 54 56 60 61 65 66 67 68 69 70 71 -PFLOAD+=72 73 74 75 76 77 78 79 80 81 82 84 87 88 89 90 91 92 99 100 101 +PFLOAD+=72 73 74 75 76 77 78 79 80 81 82 84 87 88 89 90 91 92 99 100 101 114 PFTABLE=1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 PFOPT=1 2 6 PFIF2IP=1 2 3 diff --git a/regress/sbin/pfctl/pf114.in b/regress/sbin/pfctl/pf114.in new file mode 100644 index 00000000000..b006b82c1d7 --- /dev/null +++ b/regress/sbin/pfctl/pf114.in @@ -0,0 +1,16 @@ +pass in on lo0 from 127.1.0.0/16 +pass in on lo0 from 127.2.0.0/16 +pass in on lo0 from 127.3.0.0/16 +pass in on lo0 from 127.4.0.0/16 +pass in on lo0 from 127.5.0.0/16 +pass in on lo0 from 127.6.0.0/16 +pass in on lo0 from 127.7.0.0/16 +pass in on lo0 from 127.8.0.0/16 +pass in on lo0 from 127.9.0.0/16 +pass in on lo0 from 127.10.0.0/16 +pass in on lo0 from 127.11.0.0/16 +pass in on lo0 from 127.12.0.0/16 +pass in on lo0 from 127.13.0.0/16 +pass in on lo0 from 127.14.0.0/16 +pass in on lo0 from 127.15.0.0/16 +pass label "ruleNo:$nr" diff --git a/regress/sbin/pfctl/pf114.loaded b/regress/sbin/pfctl/pf114.loaded new file mode 100644 index 00000000000..c903178e2ef --- /dev/null +++ b/regress/sbin/pfctl/pf114.loaded @@ -0,0 +1,64 @@ +@0 pass in on lo0 inet from 127.1.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@1 pass in on lo0 inet from 127.2.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@2 pass in on lo0 inet from 127.3.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@3 pass in on lo0 inet from 127.4.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@4 pass in on lo0 inet from 127.5.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@5 pass in on lo0 inet from 127.6.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@6 pass in on lo0 inet from 127.7.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@7 pass in on lo0 inet from 127.8.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@8 pass in on lo0 inet from 127.9.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@9 pass in on lo0 inet from 127.10.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@10 pass in on lo0 inet from 127.11.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@11 pass in on lo0 inet from 127.12.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@12 pass in on lo0 inet from 127.13.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@13 pass in on lo0 inet from 127.14.0.0/16 to any flags S/SA + [ Skip steps: i=15 d=15 r=end f=15 p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@14 pass in on lo0 inet from 127.15.0.0/16 to any flags S/SA + [ Skip steps: r=end p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@15 pass all flags S/SA label "ruleNo:15" + [ Skip steps: i=end d=end r=end f=end p=end sa=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] diff --git a/regress/sbin/pfctl/pf114.ok b/regress/sbin/pfctl/pf114.ok new file mode 100644 index 00000000000..7fd157de03e --- /dev/null +++ b/regress/sbin/pfctl/pf114.ok @@ -0,0 +1,16 @@ +pass in on lo0 inet from 127.1.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.2.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.3.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.4.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.5.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.6.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.7.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.8.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.9.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.10.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.11.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.12.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.13.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.14.0.0/16 to any flags S/SA +pass in on lo0 inet from 127.15.0.0/16 to any flags S/SA +pass all flags S/SA label "ruleNo:15" diff --git a/regress/sbin/pfctl/pf114.optimized b/regress/sbin/pfctl/pf114.optimized new file mode 100644 index 00000000000..2ca90102275 --- /dev/null +++ b/regress/sbin/pfctl/pf114.optimized @@ -0,0 +1,8 @@ +@0 pass in on lo0 inet from <__automatic_0:15> to any flags S/SA + [ Skip steps: r=end p=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] +@1 pass all flags S/SA label "ruleNo:1" + [ Skip steps: i=end d=end r=end f=end p=end sa=end da=end sp=end dp=end ] + [ queue: qname= qid=0 pqname= pqid=0 ] + [ Evaluations: 0 Packets: 0 Bytes: 0 States: 0 ] -- 2.20.1