From 7947f4535af129290aa84d8173a8e5b2a296ed82 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 27 Jul 2016 13:36:01 +0200 Subject: parser_bison: keep map flag around when flags are specified If you add a map with timeouts, eg. # nft add table x # nft add map x y { type ipv4_addr : ipv4_addr\; flags timeout\; } The listing shows a set instead of a map: # nft list ruleset table ip x { set y { type ipv4_addr flags timeout } } This patch fixes the parser to keep the map flag around when timeout flag (or any other flags) are specified. This patch also comes with a regression test. Signed-off-by: Pablo Neira Ayuso --- tests/shell/testcases/maps/map_with_flags_0 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 tests/shell/testcases/maps/map_with_flags_0 (limited to 'tests/shell/testcases/maps') diff --git a/tests/shell/testcases/maps/map_with_flags_0 b/tests/shell/testcases/maps/map_with_flags_0 new file mode 100755 index 00000000..8774eb51 --- /dev/null +++ b/tests/shell/testcases/maps/map_with_flags_0 @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +$NFT add table x +$NFT add map x y { type ipv4_addr : ipv4_addr\; flags timeout\; } + +EXPECTED="table ip x { + map y { + type ipv4_addr : ipv4_addr + flags timeout + } +}" + +GET="$($NFT list ruleset)" + +if [ "$EXPECTED" != "$GET" ] ; then + DIFF="$(which diff)" + [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET") + exit 1 +fi -- cgit v1.2.3