From: Florian Westphal Date: Mon, 11 Dec 2017 09:06:55 +0000 (+0100) Subject: netlink_linearize: exthdr op must be u32 X-Git-Tag: v0.8.1~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80f5d7fd66895c651c9d1e35b2353f3020ffb538;p=thirdparty%2Fnftables.git netlink_linearize: exthdr op must be u32 libnftnl casts this to u32. Broke exthdr expressions on bigendian. Reported-by: Li Shuang Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso --- diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c index cf6ffdb05..99a4dde22 100644 --- a/src/netlink_linearize.c +++ b/src/netlink_linearize.c @@ -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); }