* [PATCH nft] src: add comment support for map too
@ 2020-08-17 11:04 Pablo Neira Ayuso
0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2020-08-17 11:04 UTC (permalink / raw)
To: netfilter-devel
Extend and slightly rework tests/shell to cover this case too.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/parser_bison.y | 5 +++++
| 8 +++-----
| 6 ++++++
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 7e094ff60eac..d4e994175fea 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -1896,6 +1896,11 @@ map_block : /* empty */ { $$ = $<set>-1; }
$1->init = $4;
$$ = $1;
}
+ | map_block comment_spec stmt_separator
+ {
+ $1->comment = $2;
+ $$ = $1;
+ }
| map_block set_mechanism stmt_separator
;
--git a/tests/shell/testcases/sets/0054comments_set_0 b/tests/shell/testcases/sets/0054comments_set_0
index 93a73f0d2fa2..9c8f7875fc83 100755
--- a/tests/shell/testcases/sets/0054comments_set_0
+++ b/tests/shell/testcases/sets/0054comments_set_0
@@ -1,11 +1,9 @@
#!/bin/bash
+set -e
+
# Test that comments are added to sets
$NFT add table t
$NFT add set t s {type ipv4_addr \; flags interval \; comment "test" \;}
-if ! $NFT list ruleset | grep test >/dev/null ; then
- echo "E: missing comment in set" >&2
- exit 1
-fi
-
+$NFT add map t m {type ipv4_addr : ipv4_addr \; flags interval \; comment \"another test\" \;}
--git a/tests/shell/testcases/sets/dumps/0054comments_set_0.nft b/tests/shell/testcases/sets/dumps/0054comments_set_0.nft
index 2ad840039350..79299241f8e6 100644
--- a/tests/shell/testcases/sets/dumps/0054comments_set_0.nft
+++ b/tests/shell/testcases/sets/dumps/0054comments_set_0.nft
@@ -4,4 +4,10 @@ table ip t {
flags interval
comment "test"
}
+
+ map m {
+ type ipv4_addr : ipv4_addr
+ flags interval
+ comment "another test"
+ }
}
--
2.20.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-17 11:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-17 11:04 [PATCH nft] src: add comment support for map too Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).