All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft] scanner: allow prefix in ip6 scope
Date: Wed,  6 Jul 2022 23:54:21 +0200	[thread overview]
Message-ID: <20220706215421.32531-1-fw@strlen.de> (raw)

'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


                 reply	other threads:[~2022-07-06 21:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220706215421.32531-1-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.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 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.