From 21cfa9a7405f78f424c869e592d21ebdaf379803 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 16 Jan 2014 18:31:16 +0100 Subject: src: use ':' instead of '=>' in dictionaries Replace => by : to make it easier for most shell users, as > implies a redirection, let's avoid possible confusion that may result if you forget to escape it. This works fine if you don't forget to add space between the key and the value. If you forget to add the space, depending on the case, the scanner may recognize it correctly or process it as a string. Signed-off-by: Pablo Neira Ayuso --- src/scanner.l | 1 - 1 file changed, 1 deletion(-) (limited to 'src/scanner.l') diff --git a/src/scanner.l b/src/scanner.l index 936c035e..25fbc610 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -221,7 +221,6 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "@" { return AT; } "$" { return '$'; } "=" { return '='; } -"=>" { return ARROW; } "vmap" { return VMAP; } "include" { return INCLUDE; } -- cgit v1.2.3 From 11884cfb1c0432cc455ff8e3269500e819e0c434 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Thu, 16 Jan 2014 20:01:56 +0000 Subject: set: make set flags output parsable This patch fixes two problems: - the output of "nft list table ..." is not parsable if sets are included because the parser can't parse the flags. - set flags can't be specified during set creation. To fix this, the set output is changed to: - not print each flag on a single line - prefix the flags with "flags " - only show the interval flag since all others are for internal use only The parser is changed to parse the flags specified in a set declaration. This allows to parse empty sets. The following patch will take care of parsing sets that are already populated. Signed-off-by: Patrick McHardy --- src/scanner.l | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/scanner.l') diff --git a/src/scanner.l b/src/scanner.l index 25fbc610..904d6fbc 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -256,6 +256,8 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "position" { return POSITION; } +"interval" { return INTERVAL; } + "counter" { return COUNTER; } "packets" { return PACKETS; } "bytes" { return BYTES; } -- cgit v1.2.3 From bea7aab38f305bb8c2e400d575e6bd0a3c6bbc1f Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Thu, 16 Jan 2014 20:01:56 +0000 Subject: set: make set initializer parsable If a set contains elements, the output is not parsable since the elements = { ... } is not understood by the parser. Fix this and also add support for creating constant sets (which only makes sense when using an initializer). Signed-off-by: Patrick McHardy --- src/scanner.l | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/scanner.l') diff --git a/src/scanner.l b/src/scanner.l index 904d6fbc..c47e6101 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -256,7 +256,9 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "position" { return POSITION; } +"constant" { return CONSTANT; } "interval" { return INTERVAL; } +"elements" { return ELEMENTS; } "counter" { return COUNTER; } "packets" { return PACKETS; } -- cgit v1.2.3