From ed66d9966294a3bab6c8611e369861ba57374743 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Tue, 28 Feb 2017 00:59:07 +0100 Subject: src: support zone set statement with optional direction nft automatically understands 'ct zone set 1' but when a direction is specified too we get a parser error since they are currently only allowed for plain ct expressions. This permits the existing syntax ('ct original zone') for all tokens with an optional direction also for set statements. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso --- src/netlink_delinearize.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/netlink_delinearize.c') diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c index 57b8fa51..39347e01 100644 --- a/src/netlink_delinearize.c +++ b/src/netlink_delinearize.c @@ -659,6 +659,7 @@ static void netlink_parse_ct_stmt(struct netlink_parse_ctx *ctx, uint32_t key; struct stmt *stmt; struct expr *expr; + int8_t dir = -1; sreg = netlink_parse_register(nle, NFTNL_EXPR_CT_SREG); expr = netlink_get_register(ctx, loc, sreg); @@ -666,8 +667,11 @@ static void netlink_parse_ct_stmt(struct netlink_parse_ctx *ctx, return netlink_error(ctx, loc, "ct statement has no expression"); + if (nftnl_expr_is_set(nle, NFTNL_EXPR_CT_DIR)) + dir = nftnl_expr_get_u8(nle, NFTNL_EXPR_CT_DIR); + key = nftnl_expr_get_u32(nle, NFTNL_EXPR_CT_KEY); - stmt = ct_stmt_alloc(loc, key, expr); + stmt = ct_stmt_alloc(loc, key, dir, expr); expr_set_type(expr, stmt->ct.tmpl->dtype, stmt->ct.tmpl->byteorder); ctx->stmt = stmt; -- cgit v1.2.3