netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [iptables PATCH] tests: shell: Test delinearization of native nftables expressions
@ 2022-09-22 17:04 Phil Sutter
  2022-09-22 20:15 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2022-09-22 17:04 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal, Pablo Neira Ayuso

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [iptables PATCH] tests: shell: Test delinearization of native nftables expressions
  2022-09-22 17:04 [iptables PATCH] tests: shell: Test delinearization of native nftables expressions Phil Sutter
@ 2022-09-22 20:15 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2022-09-22 20:15 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netfilter-devel, Florian Westphal, Pablo Neira Ayuso

Phil Sutter <phil@nwl.cc> wrote:
> Even if iptables-nft doesn't generate them anymore, it should continue
> to correctly parse them. Make sure this is tested for.

I've added this and will merge what I have with this script.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-22 20:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-22 17:04 [iptables PATCH] tests: shell: Test delinearization of native nftables expressions Phil Sutter
2022-09-22 20:15 ` Florian Westphal

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).