scanner: allow prefix in ip6 scope
Florian Westphal
maintainerPATCH 1/1 scanner: allow prefix in ip6 scope
'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")
Signed-off-by Florian Westphal <[email protected]>
--- 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
src/scanner.l +1 -1
@@ -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; }
tests/shell/testcases/parsing/prefix new file +6 -0
@@ -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
Signature · 1 line
2.35.1