All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: fw@strlen.de, linux@slavino.sk
Subject: [PATCH nft] parser_bison: simplify syntax to list all sets in table
Date: Sat, 11 Jan 2025 15:37:57 +0100	[thread overview]
Message-ID: <20250111143757.65308-1-pablo@netfilter.org> (raw)

Revisit f99ccda252fa ("parser: allow listing sets in one table") to add
an alias to list all sets in a given table, eg.

 # nft list sets ip x
 table ip x {
        set s1 {
                type ipv4_addr
        }
        set s2 {
                type ipv4_addr
        }
 }

This is similar to 275989737ec4 ("parser_bison: simplify reset syntax").

Update nft(8) manpage too.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 doc/nft.txt        | 2 ++
 src/parser_bison.y | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/doc/nft.txt b/doc/nft.txt
index 846ccfb28b92..12de0181ab91 100644
--- a/doc/nft.txt
+++ b/doc/nft.txt
@@ -588,6 +588,8 @@ section describes nft set syntax in more detail.
 *add set* ['family'] 'table' 'set' *{ type* 'type' | *typeof* 'expression' *;* [*flags* 'flags' *;*] [*timeout* 'timeout' *;*] [*gc-interval* 'gc-interval' *;*] [*elements = {* 'element'[*,* ...] *} ;*] [*size* 'size' *;*] [*comment* 'comment' *;*'] [*policy* 'policy' *;*] [*auto-merge ;*] *}*
 {*delete* | *destroy* | *list* | *flush* | *reset* } *set* ['family'] 'table' 'set'
 *list sets* ['family']
+*list sets* ['family'] 'table'
+*list set* ['family'] 'table' 'set'
 *delete set* ['family'] 'table' *handle* 'handle'
 {*add* | *delete* | *destroy* } *element* ['family'] 'table' 'set' *{* 'element'[*,* ...] *}*
 
diff --git a/src/parser_bison.y b/src/parser_bison.y
index c8714812532d..ac8de398f8a7 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -1590,8 +1590,13 @@ list_cmd		:	TABLE		table_spec
 			{
 				$$ = cmd_alloc(CMD_LIST, CMD_OBJ_SETS, &$2, &@$, NULL);
 			}
+			|	SETS		table_spec
+			{
+				$$ = cmd_alloc(CMD_LIST, CMD_OBJ_SETS, &$2, &@$, NULL);
+			}
 			|	SETS		TABLE	table_spec
 			{
+				/* alias of previous rule. */
 				$$ = cmd_alloc(CMD_LIST, CMD_OBJ_SETS, &$3, &@$, NULL);
 			}
 			|	SET		set_spec
-- 
2.30.2


             reply	other threads:[~2025-01-11 14:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-11 14:37 Pablo Neira Ayuso [this message]
2025-01-11 16:24 ` [PATCH nft] parser_bison: simplify syntax to list all sets in table Florian Westphal
2025-01-11 22:45   ` Pablo Neira Ayuso

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=20250111143757.65308-1-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=linux@slavino.sk \
    --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.