From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH 1/4] tests: restrict ct saddr test to inet family
Date: Fri, 16 Jun 2017 22:34:08 +0200 [thread overview]
Message-ID: <20170616203411.16408-2-fw@strlen.de> (raw)
In-Reply-To: <20170616203411.16408-1-fw@strlen.de>
any/ct.t: ERROR: line 94: src/nft add rule --debug=netlink ip6
test-ip6 output meta nfproto ipv4 ct original saddr 1.2.3.4: This rule should not have failed.
Actually, this failure is "ok; we can't find upper layer protocol
in this case, but even if we'd "fix" this it is still non-sensical,
meta nfproto ipv4, but family is ipv6 --> rule would never match.
First move this to an inet-specific test.
A followup patch will reject meta nfproto for all families except inet.
Reported-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
tests/py/any/ct.t | 1 -
tests/py/any/ct.t.payload | 7 -------
tests/py/inet/ct.t | 10 ++++++++++
tests/py/inet/ct.t.payload | 13 +++++++++++++
4 files changed, 23 insertions(+), 8 deletions(-)
create mode 100644 tests/py/inet/ct.t
create mode 100644 tests/py/inet/ct.t.payload
diff --git a/tests/py/any/ct.t b/tests/py/any/ct.t
index 20f047a2963b..3a58162d2846 100644
--- a/tests/py/any/ct.t
+++ b/tests/py/any/ct.t
@@ -91,7 +91,6 @@ ct bytes original reply;fail
# missing direction
ct saddr 1.2.3.4;fail
-meta nfproto ipv4 ct original saddr 1.2.3.4;ok
# wrong base (ip6 but ipv4 address given)
meta nfproto ipv6 ct original saddr 1.2.3.4;fail
diff --git a/tests/py/any/ct.t.payload b/tests/py/any/ct.t.payload
index 80513c803557..20acbb9b63d1 100644
--- a/tests/py/any/ct.t.payload
+++ b/tests/py/any/ct.t.payload
@@ -373,13 +373,6 @@ ip test-ip4 output
[ byteorder reg 1 = hton(reg 1, 8, 8) ]
[ cmp lt reg 1 0x00000000 0xf4010000 ]
-# meta nfproto ipv4 ct original saddr 1.2.3.4
-ip test-ip4 output
- [ meta load nfproto => reg 1 ]
- [ cmp eq reg 1 0x00000002 ]
- [ ct load src => reg 1 , dir original ]
- [ cmp eq reg 1 0x04030201 ]
-
# ct status expected,seen-reply,assured,confirmed,snat,dnat,dying
ip test-ip4 output
[ ct load status => reg 1 ]
diff --git a/tests/py/inet/ct.t b/tests/py/inet/ct.t
new file mode 100644
index 000000000000..c56c3bc86151
--- /dev/null
+++ b/tests/py/inet/ct.t
@@ -0,0 +1,10 @@
+:input;type filter hook input priority 0
+:ingress;type filter hook ingress device lo priority 0
+
+*inet;test-inet;input
+
+meta nfproto ipv4 ct original saddr 1.2.3.4;ok
+meta nfproto ipv6 ct original saddr ::1;ok
+
+# missing protocol context
+ct original saddr ::1;fail
diff --git a/tests/py/inet/ct.t.payload b/tests/py/inet/ct.t.payload
new file mode 100644
index 000000000000..21c74581de3a
--- /dev/null
+++ b/tests/py/inet/ct.t.payload
@@ -0,0 +1,13 @@
+# meta nfproto ipv4 ct original saddr 1.2.3.4
+ip test-ip4 output
+ [ meta load nfproto => reg 1 ]
+ [ cmp eq reg 1 0x00000002 ]
+ [ ct load src => reg 1 , dir original ]
+ [ cmp eq reg 1 0x04030201 ]
+
+# meta nfproto ipv6 ct original saddr ::1
+inet test-inet input
+ [ meta load nfproto => reg 1 ]
+ [ cmp eq reg 1 0x0000000a ]
+ [ ct load src => reg 1 , dir original ]
+ [ cmp eq reg 1 0x00000000 0x00000000 0x00000000 0x01000000 ]
--
2.13.0
next prev parent reply other threads:[~2017-06-16 20:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-16 20:34 [PATCH nft 0/4] restrict meta nfproto to inet family Florian Westphal
2017-06-16 20:34 ` Florian Westphal [this message]
2017-06-16 20:34 ` [PATCH 2/4] tests: remove two non-sensical rules Florian Westphal
2017-06-16 20:34 ` [PATCH 3/4] tests: restrict meta nfproto test cases to inet family Florian Westphal
2017-06-16 20:34 ` [PATCH 4/4] evaluate: reject meta nfproto outside of " Florian Westphal
2017-06-18 9:52 ` Pablo Neira Ayuso
2017-06-18 9:35 ` [PATCH nft 0/4] restrict meta nfproto to " Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170616203411.16408-2-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).