All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] scanner: allow prefix in ip6 scope
@ 2022-07-06 21:54 Florian Westphal
  0 siblings, 0 replies; only message in thread
From: Florian Westphal @ 2022-07-06 21:54 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

'ip6 prefix' is valid syntax, so make sure scanner recognizes it
also in ip6 context.

Also add test case.

Fixes: a67fce7ffe7e ("scanner: nat: Move to own scope")
Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1619
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 src/scanner.l                        | 2 +-
 tests/shell/testcases/parsing/prefix | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100755 tests/shell/testcases/parsing/prefix

diff --git a/src/scanner.l b/src/scanner.l
index 5741261a690a..1371cd044b65 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -403,7 +403,7 @@ addrstring	({macaddr}|{ip4addr}|{ip6addr})
 }
 
 "log"			{ scanner_push_start_cond(yyscanner, SCANSTATE_STMT_LOG); return LOG; }
-<SCANSTATE_STMT_LOG,SCANSTATE_STMT_NAT,SCANSTATE_IP>"prefix"		{ return PREFIX; }
+<SCANSTATE_STMT_LOG,SCANSTATE_STMT_NAT,SCANSTATE_IP,SCANSTATE_IP6>"prefix"		{ return PREFIX; }
 <SCANSTATE_STMT_LOG>{
 	"snaplen"		{ return SNAPLEN; }
 	"queue-threshold"	{ return QUEUE_THRESHOLD; }
diff --git a/tests/shell/testcases/parsing/prefix b/tests/shell/testcases/parsing/prefix
new file mode 100755
index 000000000000..4580d6b8b37f
--- /dev/null
+++ b/tests/shell/testcases/parsing/prefix
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+$NFT add table ip6 t || exit 1
+$NFT add chain ip6 t c || exit 1
+$NFT add rule ip6 t c 'snat ip6 prefix to ip6 saddr map { 2001:db8:1111::/64 : 2001:db8:2222::/64 }'
+$NFT delete table ip6 t || exit 1
-- 
2.35.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-06 21:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 21:54 [PATCH nft] scanner: allow prefix in ip6 scope Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.