From 25ccb4587de81e1b348e4e2f5404e70097ea8ec9 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 28 May 2018 18:51:01 +0200 Subject: JSON: Review set elem expressions * There is no need to prefix element-specific properties with 'elem_', they can't conflict. * In json_parse_set_stmt(), searching for above properties is pointless since that's already done by called function. * Fix potential NULL-pointer deref in json_parse_set_elem_expr_stmt(): json_parse_flagged_expr() may return NULL. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- tests/py/ip/flowtable.t.json | 2 +- tests/py/ip/flowtable.t.json.output | 24 ++++++++++++++++++++++++ tests/py/ip6/flowtable.t.json | 4 ++-- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 tests/py/ip/flowtable.t.json.output (limited to 'tests') diff --git a/tests/py/ip/flowtable.t.json b/tests/py/ip/flowtable.t.json index ca4b5f61..5e11172e 100644 --- a/tests/py/ip/flowtable.t.json +++ b/tests/py/ip/flowtable.t.json @@ -4,7 +4,7 @@ "meter": { "key": { "elem": { - "elem_timeout": 30, + "timeout": 30, "val": { "payload": { "field": "saddr", diff --git a/tests/py/ip/flowtable.t.json.output b/tests/py/ip/flowtable.t.json.output new file mode 100644 index 00000000..004349a8 --- /dev/null +++ b/tests/py/ip/flowtable.t.json.output @@ -0,0 +1,24 @@ +# meter xyz { ip saddr timeout 30s counter} +[ + { + "meter": { + "key": { + "elem": { + "timeout": 30, + "val": { + "payload": { + "field": "saddr", + "name": "ip" + } + } + } + }, + "name": "xyz", + "size": 65535, + "stmt": { + "counter": null + } + } + } +] + diff --git a/tests/py/ip6/flowtable.t.json b/tests/py/ip6/flowtable.t.json index e3d05339..863669eb 100644 --- a/tests/py/ip6/flowtable.t.json +++ b/tests/py/ip6/flowtable.t.json @@ -4,7 +4,7 @@ "meter": { "key": { "elem": { - "elem_timeout": 600, + "timeout": 600, "val": { "concat": [ { @@ -34,7 +34,7 @@ "meter": { "key": { "elem": { - "elem_timeout": 600, + "timeout": 600, "val": { "concat": [ { -- cgit v1.2.3