netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft] netlink_linearize: exthdr op must be u32
@ 2017-12-11  9:19 Florian Westphal
  2017-12-11 12:47 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2017-12-11  9:19 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

libnftnl casts this to u32. Broke exthdr expressions on bigendian.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 src/netlink_linearize.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index cf6ffdb05ebf..99a4dde22adb 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);
 }
 
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [nftables] vmap and bit-sized headers
@ 2018-01-11 15:30 Florian Westphal
  2018-01-11 15:30 ` [PATCH nft] netlink_linearize: exthdr op must be u32 Florian Westphal
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2018-01-11 15:30 UTC (permalink / raw)
  To: netfilter-devel

nftables doesn't support vmap with bit-sized headers, such as flow label or dscp:

nft add rule ip filter input ip dscp vmap \{ 4 : accept, 63 : continue \}
BUG: invalid binary operation 5

Unlike plain 'ip dscp { ..' we do not have a relational operation,
so binop_transfer() is never invoked to fix up the shifts.

I tried to fix this without success, this is the best I could come up with.
Please consider this a bug report only, altough I am resonable sure the
first 2 patches are correct.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-15 11:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-11  9:19 [PATCH nft] netlink_linearize: exthdr op must be u32 Florian Westphal
2017-12-11 12:47 ` Pablo Neira Ayuso
2017-12-11 12:48   ` Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2018-01-11 15:30 [nftables] vmap and bit-sized headers Florian Westphal
2018-01-11 15:30 ` [PATCH nft] netlink_linearize: exthdr op must be u32 Florian Westphal
2018-01-15 11:00   ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).