From 788c986343bc24bd0272e8aa409121ffe51f1ef3 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 15 Aug 2016 13:14:18 +0200 Subject: src: quote user-defined strings when used from rule selectors The following selectors display strings using quotes: * meta iifname * meta oifname * meta ibriport * meta obriport However, the following do not: * meta oif * meta iif * meta skuid * meta skgid * meta iifgroup * meta oifgroup * meta rtclassid * ct label Given they refer to user-defined values, neither keywords nor internal built-in known values, let's quote the output of this. This patch modifies symbolic_constant_print() so we can signal this to indicate if the string needs to be quoted. Signed-off-by: Pablo Neira Ayuso --- tests/py/ip/ip.t.payload | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/py/ip/ip.t.payload') diff --git a/tests/py/ip/ip.t.payload b/tests/py/ip/ip.t.payload index 75e85c18..4c7bd7df 100644 --- a/tests/py/ip/ip.t.payload +++ b/tests/py/ip/ip.t.payload @@ -416,28 +416,28 @@ ip test-ip4 input [ bitwise reg 1 = (reg=1 & 0x0000000f ) ^ 0x00000000 ] [ cmp eq reg 1 0x0000000f ] -# iif lo ip daddr set 127.0.0.1 +# iif "lo" ip daddr set 127.0.0.1 ip test-ip4 input [ meta load iif => reg 1 ] [ cmp eq reg 1 0x00000001 ] [ immediate reg 1 0x0100007f ] [ payload write reg 1 => 4b @ network header + 16 csum_type 1 csum_off 10 ] -# iif lo ip checksum set 0 +# iif "lo" ip checksum set 0 ip test-ip4 input [ meta load iif => reg 1 ] [ cmp eq reg 1 0x00000001 ] [ immediate reg 1 0x00000000 ] [ payload write reg 1 => 2b @ network header + 10 csum_type 1 csum_off 10 ] -# iif lo ip id set 0 +# iif "lo" ip id set 0 ip test-ip4 input [ meta load iif => reg 1 ] [ cmp eq reg 1 0x00000001 ] [ immediate reg 1 0x00000000 ] [ payload write reg 1 => 2b @ network header + 4 csum_type 1 csum_off 10 ] -# iif lo ip ecn set 1 +# iif "lo" ip ecn set 1 ip test-ip4 input [ meta load iif => reg 1 ] [ cmp eq reg 1 0x00000001 ] @@ -445,7 +445,7 @@ ip test-ip4 input [ bitwise reg 1 = (reg=1 & 0x0000fcff ) ^ 0x00000100 ] [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 ] -# iif lo ip ecn set ce +# iif "lo" ip ecn set ce ip test-ip4 input [ meta load iif => reg 1 ] [ cmp eq reg 1 0x00000001 ] @@ -453,7 +453,7 @@ ip test-ip4 input [ bitwise reg 1 = (reg=1 & 0x0000fcff ) ^ 0x00000300 ] [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 ] -# iif lo ip dscp set af23 +# iif "lo" ip dscp set af23 ip test-ip4 input [ meta load iif => reg 1 ] [ cmp eq reg 1 0x00000001 ] @@ -461,7 +461,7 @@ ip test-ip4 input [ bitwise reg 1 = (reg=1 & 0x000003ff ) ^ 0x00005800 ] [ payload write reg 1 => 2b @ network header + 0 csum_type 1 csum_off 10 ] -# iif lo ip dscp set cs0 +# iif "lo" ip dscp set cs0 ip test-ip4 input [ meta load iif => reg 1 ] [ cmp eq reg 1 0x00000001 ] -- cgit v1.2.3