From d4e06f5bb9511c6a3a00191f74a99ba0c58093a6 Mon Sep 17 00:00:00 2001 From: Alvaro Neira Ayuso Date: Wed, 17 Sep 2014 09:20:28 +0200 Subject: src: add specific byteorder to the struct proto_hdr_template If we try to add a rule like: nft add rule filter input udp length {55-9999} nftable shows: BUG: invalid byte order conversion 0 => 2 nft: src/evaluate.c:153: byteorder_conversion_op: Assertion `0' failed. Some of the existing payload fields rely on BYTEORDER_INVALID. Therefore, if we try to convert it in evaluation step, we hit this bug. This patch allows to add a specific byteorder to the struct proto_hdr_template. If we create a expression with a invalid byteorder, we will use the byteorder added to the proto_hdr_template structure. Signed-off-by: Alvaro Neira Ayuso Signed-off-by: Patrick McHardy --- include/proto.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/proto.h') diff --git a/include/proto.h b/include/proto.h index bd3701e3..cc1f51f0 100644 --- a/include/proto.h +++ b/include/proto.h @@ -2,6 +2,7 @@ #define NFTABLES_PROTO_H #include +#include #include /** @@ -38,13 +39,15 @@ struct proto_hdr_template { const struct datatype *dtype; uint16_t offset; uint16_t len; + enum byteorder byteorder; enum nft_meta_keys meta_key; }; -#define PROTO_HDR_TEMPLATE(__token, __dtype, __offset, __len) \ +#define PROTO_HDR_TEMPLATE(__token, __dtype, __byteorder, __offset, __len)\ { \ .token = (__token), \ .dtype = (__dtype), \ + .byteorder = (__byteorder), \ .offset = (__offset), \ .len = (__len), \ } -- cgit v1.2.3