]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
netlink_linearize: exthdr op must be u32
authorFlorian Westphal <fw@strlen.de>
Mon, 11 Dec 2017 09:06:55 +0000 (10:06 +0100)
committerFlorian Westphal <fw@strlen.de>
Mon, 11 Dec 2017 13:26:06 +0000 (14:26 +0100)
libnftnl casts this to u32. Broke exthdr expressions on bigendian.

Reported-by: Li Shuang <shuali@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/netlink_linearize.c

index cf6ffdb05ebf196e3b15221237bb047a658e309a..99a4dde22adbd182e7b5eacc2a37892b015604eb 100644 (file)
@@ -178,7 +178,7 @@ static void netlink_gen_exthdr(struct netlink_linearize_ctx *ctx,
        nftnl_expr_set_u32(nle, NFTNL_EXPR_EXTHDR_OFFSET, offset / BITS_PER_BYTE);
        nftnl_expr_set_u32(nle, NFTNL_EXPR_EXTHDR_LEN,
                           div_round_up(expr->len, BITS_PER_BYTE));
-       nftnl_expr_set_u8(nle, NFTNL_EXPR_EXTHDR_OP, expr->exthdr.op);
+       nftnl_expr_set_u32(nle, NFTNL_EXPR_EXTHDR_OP, expr->exthdr.op);
        nftnl_expr_set_u32(nle, NFTNL_EXPR_EXTHDR_FLAGS, expr->exthdr.flags);
        nftnl_rule_add_expr(ctx->nlr, nle);
 }
@@ -839,7 +839,7 @@ static void netlink_gen_exthdr_stmt(struct netlink_linearize_ctx *ctx,
        nftnl_expr_set_u32(nle, NFTNL_EXPR_EXTHDR_OFFSET, offset / BITS_PER_BYTE);
        nftnl_expr_set_u32(nle, NFTNL_EXPR_EXTHDR_LEN,
                           div_round_up(expr->len, BITS_PER_BYTE));
-       nftnl_expr_set_u8(nle, NFTNL_EXPR_EXTHDR_OP, expr->exthdr.op);
+       nftnl_expr_set_u32(nle, NFTNL_EXPR_EXTHDR_OP, expr->exthdr.op);
        nftnl_rule_add_expr(ctx->nlr, nle);
 }