From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft 4/4] tests: add test entries for conntrack zones
Date: Tue, 28 Feb 2017 01:03:48 +0100 [thread overview]
Message-ID: <1488240228-1536-4-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1488240228-1536-1-git-send-email-pablo@netfilter.org>
From: Florian Westphal <fw@strlen.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
Just a rebase on top of series to store byteorder for set data in
NFTA_SET_USERDATA.
tests/py/any/ct.t | 13 +++++++++++++
tests/py/any/ct.t.payload | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+)
diff --git a/tests/py/any/ct.t b/tests/py/any/ct.t
index 2cfbfe13ccd2..6f32d29c0c40 100644
--- a/tests/py/any/ct.t
+++ b/tests/py/any/ct.t
@@ -100,6 +100,19 @@ ct label 127;ok
ct label set 127;ok
ct label 128;fail
+ct zone 0;ok
+ct zone 23;ok
+ct zone 65536;fail
+ct both zone 1;fail
+ct original zone 1;ok
+ct reply zone 1;ok
+
+ct zone set 1;ok
+ct original zone set 1;ok
+ct reply zone set 1;ok
+ct zone set mark map { 1 : 1, 2 : 2 };ok;ct zone set mark map { 0x00000001 : 1, 0x00000002 : 2}
+ct both zone set 1;fail
+
ct invalid;fail
ct invalid original;fail
ct set invalid original 42;fail
diff --git a/tests/py/any/ct.t.payload b/tests/py/any/ct.t.payload
index 3370bcac0594..e4c7f62b69f5 100644
--- a/tests/py/any/ct.t.payload
+++ b/tests/py/any/ct.t.payload
@@ -402,6 +402,50 @@ ip test-ip4 output
[ immediate reg 1 0x00000000 0x00000000 0x00000000 0x80000000 ]
[ ct set label with reg 1 ]
+# ct zone 0
+ip test-ip4 output
+ [ ct load zone => reg 1 ]
+ [ cmp eq reg 1 0x00000000 ]
+
+# ct zone 23
+ip test-ip4 output
+ [ ct load zone => reg 1 ]
+ [ cmp eq reg 1 0x00000017 ]
+
+# ct original zone 1
+ip test-ip4 output
+ [ ct load zone => reg 1 , dir original ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ct reply zone 1
+ip test-ip4 output
+ [ ct load zone => reg 1 , dir reply ]
+ [ cmp eq reg 1 0x00000001 ]
+
+# ct zone set 1
+ip test-ip4 output
+ [ immediate reg 1 0x00000001 ]
+ [ ct set zone with reg 1 ]
+
+# ct original zone set 1
+ip test-ip4 output
+ [ immediate reg 1 0x00000001 ]
+ [ ct set zone with reg 1 , dir original ]
+
+# ct reply zone set 1
+ip test-ip4 output
+ [ immediate reg 1 0x00000001 ]
+ [ ct set zone with reg 1 , dir reply ]
+
+# ct zone set mark map { 1 : 1, 2 : 2 }
+__map%d test-ip4 b
+__map%d test-ip4 0
+ element 00000001 : 00000001 0 [end] element 00000002 : 00000002 0 [end]
+ip test-ip4 output
+ [ meta load mark => reg 1 ]
+ [ lookup reg 1 set __map%d dreg 1 ]
+ [ ct set zone with reg 1 ]
+
# notrack
ip test-ip4 output
[ notrack ]
--
2.1.4
prev parent reply other threads:[~2017-02-28 2:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-28 0:03 [PATCH nft 1/4] src: add conntrack zone support Pablo Neira Ayuso
2017-02-28 0:03 ` [PATCH nft 2/4] ct: refactor print function so it can be re-used for ct statement Pablo Neira Ayuso
2017-02-28 0:03 ` [PATCH nft 3/4] src: support zone set statement with optional direction Pablo Neira Ayuso
2017-02-28 0:03 ` Pablo Neira Ayuso [this message]
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=1488240228-1536-4-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--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).