parser_bison: compact and simplify list and reset syntax
Florian Westphal
maintainerPATCH 1/1 parser_bison: compact and simplify list and reset syntax
Works:
list sets
list sets inet
list sets table inet foo
Doesn't work:
list sets inet foo
Same for "list counters", "list quotas", etc.
"reset" keyword however supports this:
reset counters inet foo
and aliased this to
reset counters table inet foo
This is inconsistent and not inuitive.
Moreover, unlike "list sets", "list maps" only supported "list maps" and "list maps inet", without the ability to only list maps of a given table.
Compact this to unify the syntax so it becomes possible to omit the "table" keyword for either reset or list mode.
flowtables, secmarks and synproxys keywords are updated too. "flow table" and "meters" are NOT changed since both of these are deprecated in favor of standard nft sets.
--- doc/nft.txt | 15 +++------ src/parser_bison.y | 79 ++++++++++++---------------------------------- 2 files changed, 26 insertions(+), 68 deletions(-)
doc/nft.txt +5 -10
@@ -587,7 +587,7 @@ section describes nft set syntax in more detail. [verse] *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'] *delete set* ['family'] 'table' *handle* 'handle' {*add* | *delete* | *destroy* } *element* ['family'] 'table' 'set' *{* 'element'[*,* ...] *}*
@@ -641,7 +641,7 @@ MAPS [verse] *add map* ['family'] 'table' 'map' *{ type* 'type' | *typeof* 'expression' [*flags* 'flags' *;*] [*elements = {* 'element'[*,* ...] *} ;*] [*size* 'size' *;*] [*comment* 'comment' *;*'] [*policy* 'policy' *;*] *}* {*delete* | *destroy* | *list* | *flush* | *reset* } *map* ['family'] 'table' 'map' -*list maps* ['family'] +*list maps* ['family'] ['table'] Maps store data based on some specific key used as input. They are uniquely identified by a user-defined name and attached to tables.
@@ -738,7 +738,7 @@ FLOWTABLES ----------- [verse] {*add* | *create*} *flowtable* ['family'] 'table' 'flowtable' *{ hook* 'hook' *priority* 'priority' *; devices = {* 'device'[*,* ...] *} ; }* -*list flowtables* ['family'] +*list flowtables* ['family'] ['table'] {*delete* | *destroy* | *list*} *flowtable* ['family'] 'table' 'flowtable' *delete* *flowtable* ['family'] 'table' *handle* 'handle'
@@ -778,13 +778,8 @@ STATEFUL OBJECTS *destroy* 'counter' ['family'] 'table' *handle* 'handle' *destroy* 'quota' ['family'] 'table' *handle* 'handle' *destroy* 'limit' ['family'] 'table' *handle* 'handle' -*list counters* ['family'] -*list quotas* ['family'] -*list limits* ['family'] -*reset counters* ['family'] -*reset quotas* ['family'] -*reset counters* ['family'] 'table' -*reset quotas* ['family'] 'table' +*list* { *counters* | *limits* | *quotas* } ['family'] ['table'] +*reset* { *counters* | *quotas* } ['family'] ['table'] Stateful objects are attached to tables and are identified by a unique name. They group stateful information from rules, to reference them in rules the
src/parser_bison.y +21 -58
172 lines not on this page · raw message
Signature · 1 line
2.48.0
Hi Florian,
Quoted 7 lines · Florian Westphal
Works:
list sets
list sets inet
list sets table inet fooDoesn't work:
list sets inet foo
[...]
Quoted 2 lines
Compact this to unify the syntax so it becomes possible to omit the "table" keyword for either reset or list mode.
[...]
Thanks Florian.