diff options
author | Florian Westphal <fw@strlen.de> | 2016-01-07 13:23:33 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2016-01-07 13:23:33 +0100 |
commit | 757b3ab08b8b22f230fb8e481bec78ecbfbb335a (patch) | |
tree | 6da3963f04e13807ed3f660639a177306b014155 /src/ct.c | |
parent | c2494dd6daac9a91f090504de6d38b7f404f0c1f (diff) |
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 <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/ct.c')
-rw-r--r-- | src/ct.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -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) |