From b4a5b3b3b0a46d9155d0e07e5ab226cf5697cd13 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Wed, 9 Jan 2019 23:26:05 +0100 Subject: [PATCH] src: fix netdev family device name parsing Should use accept/use quotes, else you can't use this with a device name that is shared with a key word, e.g. 'device vm'. Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso (cherry picked from commit b338244abc7f018d79a95657fff88eadee7e9f6b) Conflicts: src/rule.c tests/shell/testcases/chains/dumps/0021prio_0.nft -> Context change due to missing commit c8a0e8c90e2d1 ("src: Set/print standard chain prios with textual names") Signed-off-by: Phil Sutter --- src/parser_bison.y | 2 +- src/rule.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser_bison.y b/src/parser_bison.y index aabf16316ff8b..f86a754deea8e 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -1793,7 +1793,7 @@ prio_spec : NUM { $$ = $1; } | DASH NUM { $$ = -$2; } ; -dev_spec : DEVICE STRING { $$ = $2; } +dev_spec : DEVICE string { $$ = $2; } | /* empty */ { $$ = NULL; } ; diff --git a/src/rule.c b/src/rule.c index c3a2e7cc464bb..0b494e4326be6 100644 --- a/src/rule.c +++ b/src/rule.c @@ -773,7 +773,7 @@ static void chain_print_declaration(const struct chain *chain, nft_print(octx, "\t\ttype %s hook %s", chain->type, hooknum2str(chain->handle.family, chain->hooknum)); if (chain->dev != NULL) - nft_print(octx, " device %s", chain->dev); + nft_print(octx, " device \"%s\"", chain->dev); nft_print(octx, " priority %d; policy %s;\n", chain->priority, chain_policy2str(chain->policy)); } -- 2.21.0