rule: print chain and flowtable devices in quotes
Pablo Neira Ayuso
maintainerPATCH 1/1 rule: print chain and flowtable devices in quotes
Print devices in quotes, for consistency with:
- the existing chain listing with single device:
type filter hook ingress device "lo" priority filter; policy accept
- the ifname datatype used in sets.
In general, tokens that are user-defined, not coming in the datatype symbol list, are enclosed in quotes.
Fixes 3fdc7541fba0 ("src: add multidevice support for netdev chain")
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/rule.c | 4 ++-- tests/shell/features/flowtable_counter.sh | 2 +- .../testcases/chains/dumps/0042chain_variable_0.nft | 4 ++-- .../testcases/flowtable/dumps/0001flowtable_0.nft | 2 +- .../flowtable/dumps/0002create_flowtable_0.nft | 2 +- .../flowtable/dumps/0003add_after_flush_0.nft | 2 +- .../flowtable/dumps/0005delete_in_use_1.nft | 2 +- .../flowtable/dumps/0012flowtable_variable_0.nft | 4 ++-- .../flowtable/dumps/0013addafterdelete_0.nft | 2 +- .../flowtable/dumps/0014addafterdelete_0.nft | 2 +- tests/shell/testcases/listing/0020flowtable_0 | 12 ++++++------ .../testcases/listing/dumps/0020flowtable_0.nft | 4 ++-- 12 files changed, 21 insertions(+), 21 deletions(-)
src/rule.c +2 -2
@@ -1062,7 +1062,7 @@ static void chain_print_declaration(const struct chain *chain, }else if (chain->dev_array_len >1 ) {nft_print (octx," devices = { " );for (i =0 ; i < chain->dev_array_len; i++) { -nft_print (octx,"%s" , chain->dev_array[i]); +nft_print (octx,"\"%s\"" , chain->dev_array[i]);if (i +1 != chain->dev_array_len)nft_print (octx,", " ); }
@@ -2149,7 +2149,7 @@ static void flowtable_print_declaration(const struct flowtable *flowtable,if (flowtable->dev_array_len >0 ) {nft_print (octx,"%s%sdevices = { " , opts->tab, opts->tab);for (i =0 ; i < flowtable->dev_array_len; i++) { -nft_print (octx,"%s" , flowtable->dev_array[i]); +nft_print (octx,"\"%s\"" , flowtable->dev_array[i]);if (i +1 != flowtable->dev_array_len)nft_print (octx,", " ); }
tests/shell/features/flowtable_counter.sh +1 -1
@@ -6,7 +6,7 @@ EXPECTED="table ip filter2 { flowtable main_ft2 { hook ingress priority filter - devices = { lo } + devices = { \"lo\" } counter } }"
tests/shell/testcases/chains/dumps/0042chain_variable_0.nft +2 -2
@@ -5,12 +5,12 @@ table netdev filter1 { } table netdev filter2 { chain Main_Ingress2 { - type filter hook ingress devices = { d23456789012345, lo } priority -500; policy accept; + type filter hook ingress devices = { "d23456789012345", "lo" } priority -500; policy accept; } } table netdev filter3 { chain Main_Ingress3 { - type filter hook ingress devices = { d23456789012345, lo } priority -500; policy accept; + type filter hook ingress devices = { "d23456789012345", "lo" } priority -500; policy accept; } chain Main_Egress3 {
tests/shell/testcases/flowtable/dumps/0001flowtable_0.nft +1 -1
@@ -1,7 +1,7 @@ table inet t { flowtable f { hook ingress priority filter + 10 - devices = { lo } + devices = { "lo" } } chain c {
tests/shell/testcases/flowtable/dumps/0002create_flowtable_0.nft +1 -1
@@ -1,6 +1,6 @@ table ip t { flowtable f { hook ingress priority filter + 10 - devices = { lo } + devices = { "lo" } } }
tests/shell/testcases/flowtable/dumps/0003add_after_flush_0.nft +1 -1
@@ -1,6 +1,6 @@ table ip x { flowtable y { hook ingress priority filter - devices = { lo } + devices = { "lo" } } }
tests/shell/testcases/flowtable/dumps/0005delete_in_use_1.nft +1 -1
@@ -1,7 +1,7 @@ table ip x { flowtable y { hook ingress priority filter - devices = { lo } + devices = { "lo" } } chain x {
tests/shell/testcases/flowtable/dumps/0012flowtable_variable_0.nft +2 -2
@@ -1,14 +1,14 @@ table ip filter1 { flowtable Main_ft1 { hook ingress priority filter - devices = { lo } + devices = { "lo" } counter } } table ip filter2 { flowtable Main_ft2 { hook ingress priority filter - devices = { lo } + devices = { "lo" } counter } }
tests/shell/testcases/flowtable/dumps/0013addafterdelete_0.nft +1 -1
@@ -1,6 +1,6 @@ table inet filter { flowtable f { hook ingress priority filter - 1 - devices = { lo } + devices = { "lo" } } }
tests/shell/testcases/flowtable/dumps/0014addafterdelete_0.nft +1 -1
@@ -1,7 +1,7 @@ table inet filter { flowtable f { hook ingress priority filter - 1 - devices = { lo } + devices = { "lo" } counter }
tests/shell/testcases/listing/0020flowtable_0 +6 -6
@@ -8,11 +8,11 @@ set -e FLOWTABLES="flowtable f { hook ingress priority filter - devices = { lo } + devices = { \"lo\" } } flowtable f2 { hook ingress priority filter - devices = { d0 } + devices = { \"d0\" } }" RULESET="table inet filter {
@@ -25,23 +25,23 @@ table ip filter { EXPECTED="table inet filter { flowtable f { hook ingress priority filter - devices = { lo } + devices = { \"lo\" } } }" EXPECTED2="table ip filter { flowtable f2 { hook ingress priority filter - devices = { d0 } + devices = { \"d0\" } } }" EXPECTED3="table ip filter { flowtable f { hook ingress priority filter - devices = { lo } + devices = { \"lo\" } } flowtable f2 { hook ingress priority filter - devices = { d0 } + devices = { \"d0\" } } }"
tests/shell/testcases/listing/dumps/0020flowtable_0.nft +2 -2
@@ -1,7 +1,7 @@ table inet filter { flowtable f { hook ingress priority filter - devices = { lo } + devices = { "lo" } } flowtable f2 {
@@ -11,7 +11,7 @@ table inet filter { table ip filter { flowtable f { hook ingress priority filter - devices = { lo } + devices = { "lo" } } flowtable f2 {
Signature · 1 line
2.30.2
Quoted 10 lines · Pablo Neira Ayuso
Print devices in quotes, for consistency with:
- the existing chain listing with single device:
type filter hook ingress device "lo" priority filter; policy accept
- the ifname datatype used in sets.
In general, tokens that are user-defined, not coming in the datatype symbol list, are enclosed in quotes.
Thanks a lot Pablo. I checked tests/py and they still pass after this also.
Acked-by Florian Westphal <[email protected]>