From: Phil Sutter <phil@nwl.cc>
To: netfilter-devel@vger.kernel.org
Cc: Florian Westphal <fwestpha@redhat.com>,
Pablo Neira Ayuso <pablo@netfilter.org>
Subject: [iptables PATCH] tests: shell: Test delinearization of native nftables expressions
Date: Thu, 22 Sep 2022 19:04:32 +0200 [thread overview]
Message-ID: <20220922170432.5414-1-phil@nwl.cc> (raw)
Even if iptables-nft doesn't generate them anymore, it should continue
to correctly parse them. Make sure this is tested for.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
.../nft-only/0010-native-delinearize_0 | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100755 iptables/tests/shell/testcases/nft-only/0010-native-delinearize_0
diff --git a/iptables/tests/shell/testcases/nft-only/0010-native-delinearize_0 b/iptables/tests/shell/testcases/nft-only/0010-native-delinearize_0
new file mode 100755
index 0000000000000..cca36fd88d6c7
--- /dev/null
+++ b/iptables/tests/shell/testcases/nft-only/0010-native-delinearize_0
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+[[ $XT_MULTI == *xtables-nft-multi ]] || { echo "skip $XT_MULTI"; exit 0; }
+nft -v >/dev/null || exit 0
+
+set -e
+
+nft -f - <<EOF
+table ip filter {
+ chain FORWARD {
+ type filter hook forward priority filter;
+ limit rate 10/day counter
+ udp dport 42 counter
+ }
+}
+EOF
+
+EXPECT="*filter
+:INPUT ACCEPT [0:0]
+:FORWARD ACCEPT [0:0]
+:OUTPUT ACCEPT [0:0]
+-A FORWARD -m limit --limit 10/day
+-A FORWARD -p udp -m udp --dport 42
+COMMIT"
+
+diff -u -Z <(echo -e "$EXPECT") <($XT_MULTI iptables-save | grep -v '^#')
--
2.34.1
next reply other threads:[~2022-09-22 17:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-22 17:04 Phil Sutter [this message]
2022-09-22 20:15 ` [iptables PATCH] tests: shell: Test delinearization of native nftables expressions Florian Westphal
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=20220922170432.5414-1-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=fwestpha@redhat.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).