[PATCH nft] scanner: allow prefix in ip6 scope

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'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@xxxxxxxxx>
---
 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




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux