From 757b3ab08b8b22f230fb8e481bec78ecbfbb335a Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Thu, 7 Jan 2016 13:23:33 +0100 Subject: nft: swap key and direction in ct_dir syntax old: ct saddr original 1.2.3.4 new: ct original saddr 1.2.3.4 The advantage is that this allows to add ct keys where direction is optional without creating ambiguities in the parser. So we can have ct packets gt 42 ct original packets gt 42 Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso --- src/ct.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/ct.c') diff --git a/src/ct.c b/src/ct.c index 515e3ebf..ff6cd61b 100644 --- a/src/ct.c +++ b/src/ct.c @@ -209,19 +209,18 @@ static void ct_expr_print(const struct expr *expr) { const struct symbolic_constant *s; - printf("ct %s", ct_templates[expr->ct.key].token); - + printf("ct "); if (expr->ct.direction < 0) - return; + goto done; for (s = ct_dir_tbl.symbols; s->identifier != NULL; s++) { if (expr->ct.direction == (int) s->value) { - printf(" %s", s->identifier); - return; + printf("%s ", s->identifier); + break; } } - - printf(" %d", expr->ct.direction); + done: + printf("%s", ct_templates[expr->ct.key].token); } static bool ct_expr_cmp(const struct expr *e1, const struct expr *e2) -- cgit v1.2.3