Skip to contentSkip to conversation

src/ct: provide fixed data lengh sizes for ip/ip6 keys

PATCH In review Florian Westphal 2 participants 3 messages Jul 12, 2019 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 src/ct: provide fixed data lengh sizes for ip/ip6 keys

nft can load but not list this:

table inet filter {
chain input {
ct original ip daddr {1.2.3.4} accept
}
}

Problem is that the ct template length is 0, so we believe the right hand side is a concatenation because left->len < set->key->len is true. nft then calls abort() during concatenation parsing.

---
 src/ct.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
src/ct.c +4 -4
index 4f7807deea0f..14cc0e5e8a4e 100644
@@ -292,13 +292,13 @@ const struct ct_template ct_templates[__NFT_CT_MAX] = {
 	[NFT_CT_EVENTMASK]	= CT_TEMPLATE("event", &ct_event_type,
 					      BYTEORDER_HOST_ENDIAN, 32),
 	[NFT_CT_SRC_IP]		= CT_TEMPLATE("ip saddr", &ipaddr_type,
-					      BYTEORDER_BIG_ENDIAN, 0),
+					      BYTEORDER_BIG_ENDIAN, 32),
 	[NFT_CT_DST_IP]		= CT_TEMPLATE("ip daddr", &ipaddr_type,
-					      BYTEORDER_BIG_ENDIAN, 0),
+					      BYTEORDER_BIG_ENDIAN, 32),
 	[NFT_CT_SRC_IP6]	= CT_TEMPLATE("ip6 saddr", &ip6addr_type,
-					      BYTEORDER_BIG_ENDIAN, 0),
+					      BYTEORDER_BIG_ENDIAN, 128),
 	[NFT_CT_DST_IP6]	= CT_TEMPLATE("ip6 daddr", &ip6addr_type,
-					      BYTEORDER_BIG_ENDIAN, 0),
+					      BYTEORDER_BIG_ENDIAN, 128),
 };
 
 static void ct_print(enum nft_ct_keys key, int8_t dir, uint8_t nfproto,
Signature · 1 line
2.21.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Florian Westphal

nft can load but not list this:

table inet filter {
chain input {
ct original ip daddr {1.2.3.4} accept
}
}

Quoted 6 lines

Problem is that the ct template length is 0, so we believe the right hand side is a concatenation because left->len < set->key->len is true. nft then calls abort() during concatenation parsing.

Please, add new entry to tests/py before pushing this out.

author maintainer
#2 lore raw
Quoted 13 lines · Pablo Neira Ayuso
Quoted 12 lines · Florian Westphal

nft can load but not list this:

table inet filter {
chain input {
ct original ip daddr {1.2.3.4} accept
}
}

Problem is that the ct template length is 0, so we believe the right hand side is a concatenation because left->len < set->key->len is true. nft then calls abort() during concatenation parsing.

Quoted 5 lines
Quoted 2 lines

Please, add new entry to tests/py before pushing this out.

Will do.