From 710bc48c30ffd5279455cf9cd104c91736d5eb60 Mon Sep 17 00:00:00 2001 From: mikeb Date: Tue, 19 May 2015 17:16:20 +0000 Subject: [PATCH] Test divert-to rules' address handling (pfctl/parse.y -r1.648) --- regress/sbin/pfctl/Makefile | 6 +++--- regress/sbin/pfctl/pf104.in | 10 ++++++++++ regress/sbin/pfctl/pf104.ok | 7 +++++++ regress/sbin/pfctl/pfail55.in | 1 + regress/sbin/pfctl/pfail55.ok | 1 + regress/sbin/pfctl/pfail56.in | 1 + regress/sbin/pfctl/pfail56.ok | 1 + 7 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 regress/sbin/pfctl/pf104.in create mode 100644 regress/sbin/pfctl/pf104.ok create mode 100644 regress/sbin/pfctl/pfail55.in create mode 100644 regress/sbin/pfctl/pfail55.ok create mode 100644 regress/sbin/pfctl/pfail56.in create mode 100644 regress/sbin/pfctl/pfail56.ok diff --git a/regress/sbin/pfctl/Makefile b/regress/sbin/pfctl/Makefile index b835b513840..a93b147207c 100644 --- a/regress/sbin/pfctl/Makefile +++ b/regress/sbin/pfctl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.222 2014/11/13 17:35:30 pelikan Exp $ +# $OpenBSD: Makefile,v 1.223 2015/05/19 17:16:20 mikeb Exp $ # TARGETS # pf: feed pfNN.in through pfctl and check whether the output matches pfNN.ok @@ -16,9 +16,9 @@ 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 +PFTESTS+=97 98 99 100 101 102 103 104 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 +PFFAIL+=30 37 38 39 40 41 42 43 47 48 49 50 51 52 53 54 55 56 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 diff --git a/regress/sbin/pfctl/pf104.in b/regress/sbin/pfctl/pf104.in new file mode 100644 index 00000000000..91bd43e3a4b --- /dev/null +++ b/regress/sbin/pfctl/pf104.in @@ -0,0 +1,10 @@ +# This test assumes that localhost points to 127.0.0.1 first +pass in proto tcp to port 25 divert-to localhost port 8025 +# Test IPv4 addresses +pass in proto tcp to port 25 divert-to 127.0.0.1 port 8025 +pass in inet proto tcp to port 25 divert-to 127.0.0.1 port 8025 +pass in inet proto tcp to port 25 divert-to localhost port 8025 +# Test IPv6 addresses +pass in proto tcp to port 25 divert-to ::1 port 8025 +pass in inet6 proto tcp to port 25 divert-to ::1 port 8025 +pass in inet6 proto tcp to port 25 divert-to localhost port 8025 diff --git a/regress/sbin/pfctl/pf104.ok b/regress/sbin/pfctl/pf104.ok new file mode 100644 index 00000000000..66f87d787b4 --- /dev/null +++ b/regress/sbin/pfctl/pf104.ok @@ -0,0 +1,7 @@ +pass in inet proto tcp from any to any port = 25 flags S/SA divert-to 127.0.0.1 port 8025 +pass in inet proto tcp from any to any port = 25 flags S/SA divert-to 127.0.0.1 port 8025 +pass in inet proto tcp from any to any port = 25 flags S/SA divert-to 127.0.0.1 port 8025 +pass in inet proto tcp from any to any port = 25 flags S/SA divert-to 127.0.0.1 port 8025 +pass in inet6 proto tcp from any to any port = 25 flags S/SA divert-to ::1 port 8025 +pass in inet6 proto tcp from any to any port = 25 flags S/SA divert-to ::1 port 8025 +pass in inet6 proto tcp from any to any port = 25 flags S/SA divert-to ::1 port 8025 diff --git a/regress/sbin/pfctl/pfail55.in b/regress/sbin/pfctl/pfail55.in new file mode 100644 index 00000000000..91fec6c7360 --- /dev/null +++ b/regress/sbin/pfctl/pfail55.in @@ -0,0 +1 @@ +pass in inet6 proto tcp to port 25 divert-to 127.0.0.1 port 8025 diff --git a/regress/sbin/pfctl/pfail55.ok b/regress/sbin/pfctl/pfail55.ok new file mode 100644 index 00000000000..eec355ad3bd --- /dev/null +++ b/regress/sbin/pfctl/pfail55.ok @@ -0,0 +1 @@ +stdin:1: address family mismatch for divert diff --git a/regress/sbin/pfctl/pfail56.in b/regress/sbin/pfctl/pfail56.in new file mode 100644 index 00000000000..240c8d374d1 --- /dev/null +++ b/regress/sbin/pfctl/pfail56.in @@ -0,0 +1 @@ +pass in inet proto tcp to port 25 divert-to ::1 port 8025 diff --git a/regress/sbin/pfctl/pfail56.ok b/regress/sbin/pfctl/pfail56.ok new file mode 100644 index 00000000000..eec355ad3bd --- /dev/null +++ b/regress/sbin/pfctl/pfail56.ok @@ -0,0 +1 @@ +stdin:1: address family mismatch for divert -- 2.20.1