From 1b8953e75c20437b5c563d86c3ba11d1b24e3ec4 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 9 May 2019 13:35:41 +0200 Subject: json: Fix tproxy support regarding latest changes Family may be specified also if no address is given at the same time, make parser/printer tolerant to that. Also fix for missing/incorrect JSON equivalents in tests/py. While being at it, fix two issues in non-JSON tests: * Ruleset is printed in numeric mode, so use 'l4proto 6' instead of 'l4proto tcp' in rules to avoid having to specify expected output for that unrelated bit. * In ip and ip6 family tables, family parameter is not deserialized on output. Fixes: 3edb96200690b ("parser_bison: missing tproxy syntax with port only for inet family") Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- tests/py/ip/tproxy.t.json | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'tests/py/ip/tproxy.t.json') diff --git a/tests/py/ip/tproxy.t.json b/tests/py/ip/tproxy.t.json index 1936b5f4..4635fc1f 100644 --- a/tests/py/ip/tproxy.t.json +++ b/tests/py/ip/tproxy.t.json @@ -13,8 +13,7 @@ }, { "tproxy": { - "addr": "192.0.2.1", - "family": "ip" + "addr": "192.0.2.1" } } ] @@ -35,7 +34,6 @@ { "tproxy": { "addr": "192.0.2.1", - "family": "ip", "port": 50080 } } @@ -104,3 +102,25 @@ } } ] + +# ip protocol 6 tproxy ip to :50080 +[ + { + "match": { + "left": { + "payload": { + "field": "protocol", + "protocol": "ip" + } + }, + "op": "==", + "right": 6 + } + }, + { + "tproxy": { + "family": "ip", + "port": 50080 + } + } +] -- cgit v1.2.3