Skip to contentSkip to conversation

switch l4 dependency to meta l4proto

PATCH Superseded Florian Westphal 2 participants 23 messages May 9, 2017 – May 17, 2017 netfilter

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

cover switch l4 dependency to meta l4proto

Currently nft inserts different types of dependencies for l4 protocols, depending on the family.

For inet, nft inserts 'meta l4proto' to e.g. check for tcp. For ip, nft uses 'ip protocol' instead.
For ipv6, 'ip6 nexthdr' is used.

And the latter is a problem, because this means that
'tcp dport 22' will only match tcp packets that do not have a ipv6 extension header.

This first switches implicit ipv6 dependency to 'meta l4proto', so the last transport header protocol will be considered instead of the first ipv6 nexthdr value.

For ip, this problem doesn't exist, however, since it makes things a bit simpler when nft creates the same l4 dependency for ip/ip6/inet/bridge and so on the later patches in this series will also switch ipv4 over to meta expression.

 src/evaluate.c            |    8 ++++++++
 src/netlink_delinearize.c |    6 ++++++
 src/payload.c             |   24 +++++++++++++++++++++++-
 src/proto.c               |    6 ++++--
 4 files changed, 41 insertions(+), 3 deletions(-)

[ diffstat exludes test/ intentionally.
Also, last patch uses -C mode to avoid a huge 7000 line diff. ]

author maintainer
#1 lore raw

PATCH 1/10 src: allow update of net base w. meta l4proto icmpv6

nft add rule ip6 f i meta l4proto ipv6-icmp icmpv6 type nd-router-advert <cmdline>:1:50-60: Error: conflicting protocols specified: unknown vs. icmpv6

add icmpv6 to nexthdr list so base gets updated correctly.

---
 src/proto.c | 1 +
 1 file changed, 1 insertion(+)
src/proto.c +1 -0
index 79e9dbf2b33e..fcdfbe73c735 100644
@@ -779,6 +779,7 @@ const struct proto_desc proto_inet_service = {
 		PROTO_LINK(IPPROTO_TCP,		&proto_tcp),
 		PROTO_LINK(IPPROTO_DCCP,	&proto_dccp),
 		PROTO_LINK(IPPROTO_SCTP,	&proto_sctp),
+		PROTO_LINK(IPPROTO_ICMPV6,	&proto_icmp6),
 	},
 	.templates	= {
 		[0]	= PROTO_META_TEMPLATE("l4proto", &inet_protocol_type, NFT_META_L4PROTO, 8),
Signature · 1 line
2.10.2
maintainer Acked-by on v1 1/10
#2 lore raw

Re: [PATCH nft 01/10] src: allow update of net base w. meta l4proto icmpv6

Quoted 4 lines · Florian Westphal

nft add rule ip6 f i meta l4proto ipv6-icmp icmpv6 type nd-router-advert <cmdline>:1:50-60: Error: conflicting protocols specified: unknown vs. icmpv6

add icmpv6 to nexthdr list so base gets updated correctly.

I would like to see a new test coming with this patch. So we can easily relate the fix with the new test.

Quoted 2 lines
Quoted 22 lines
 src/proto.c | 1 +
 1 file changed, 1 insertion(+)
src/proto.c +1 -0
index 79e9dbf2b33e..fcdfbe73c735 100644
@@ -779,6 +779,7 @@ const struct proto_desc proto_inet_service = {
 		PROTO_LINK(IPPROTO_TCP,		&proto_tcp),
 		PROTO_LINK(IPPROTO_DCCP,	&proto_dccp),
 		PROTO_LINK(IPPROTO_SCTP,	&proto_sctp),
+		PROTO_LINK(IPPROTO_ICMPV6,	&proto_icmp6),
 	},
 	.templates	= {
 		[0]	= PROTO_META_TEMPLATE("l4proto", &inet_protocol_type, NFT_META_L4PROTO, 8),
Signature · 6 lines
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#3 lore raw

PATCH 2/10 src: ipv6: switch implicit dependencies to meta l4proto

In reply to Florian Westphal

when using rule like

ip6 filter input tcp dport 22
nft generates:
[ payload load 1b @ network header + 6 => reg 1 ] [ cmp eq reg 1 0x00000006 ]
[ payload load 2b @ transport header + 2 => reg 1 ] [ cmp eq reg 1 0x00001600 ]

which is: ip6 filter input ip6 nexthdr tcp dport 22
IOW, such a rule won't match if e.g. a fragment header is in place.

This changes ip6_proto to use 'meta l4proto' which is the protocol header found by exthdr walk.

A side effect is that for bridge we get a shorter dependency chain as it no longer needs to prepend 'ether proto ipv6' for old 'ip6 nexthdr' dep.

---
 src/proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/proto.c +1 -1
index fcdfbe73c735..3b20a5fd35b1 100644
@@ -707,7 +707,6 @@ const struct proto_desc proto_icmp6 = {
 const struct proto_desc proto_ip6 = {
 	.name		= "ip6",
 	.base		= PROTO_BASE_NETWORK_HDR,
-	.protocol_key	= IP6HDR_NEXTHDR,
 	.protocols	= {
 		PROTO_LINK(IPPROTO_ESP,		&proto_esp),
 		PROTO_LINK(IPPROTO_AH,		&proto_ah),
@@ -720,6 +719,7 @@ const struct proto_desc proto_ip6 = {
 		PROTO_LINK(IPPROTO_ICMPV6,	&proto_icmp6),
 	},
 	.templates	= {
+		[0]	= PROTO_META_TEMPLATE("l4proto", &inet_protocol_type, NFT_META_L4PROTO, 8),
 		[IP6HDR_VERSION]	= HDR_BITFIELD("version", &integer_type, 0, 4),
 		[IP6HDR_DSCP]		= HDR_BITFIELD("dscp", &dscp_type, 4, 6),
 		[IP6HDR_ECN]		= HDR_BITFIELD("ecn", &ecn_type, 10, 2),
Signature · 1 line
2.10.2
maintainer Acked-by on v1 2/10
#4 lore raw

Re: [PATCH nft 02/10] src: ipv6: switch implicit dependencies to meta l4proto

Quoted 9 lines · Florian Westphal

when using rule like

ip6 filter input tcp dport 22
nft generates:
[ payload load 1b @ network header + 6 => reg 1 ] [ cmp eq reg 1 0x00000006 ]
[ payload load 2b @ transport header + 2 => reg 1 ] [ cmp eq reg 1 0x00001600 ]

Quoted 8 lines

which is: ip6 filter input ip6 nexthdr tcp dport 22
IOW, such a rule won't match if e.g. a fragment header is in place.

This changes ip6_proto to use 'meta l4proto' which is the protocol header found by exthdr walk.

A side effect is that for bridge we get a shorter dependency chain as it no longer needs to prepend 'ether proto ipv6' for old 'ip6 nexthdr' dep.

Same comment regarding tests, I would prefer to see tests are amended in this patch too.

Quoted 1 line
Quoted 31 lines
---
 src/proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/proto.c +1 -1
index fcdfbe73c735..3b20a5fd35b1 100644
@@ -707,7 +707,6 @@ const struct proto_desc proto_icmp6 = {
 const struct proto_desc proto_ip6 = {
 	.name		= "ip6",
 	.base		= PROTO_BASE_NETWORK_HDR,
-	.protocol_key	= IP6HDR_NEXTHDR,
 	.protocols	= {
 		PROTO_LINK(IPPROTO_ESP,		&proto_esp),
 		PROTO_LINK(IPPROTO_AH,		&proto_ah),
@@ -720,6 +719,7 @@ const struct proto_desc proto_ip6 = {
 		PROTO_LINK(IPPROTO_ICMPV6,	&proto_icmp6),
 	},
 	.templates	= {
+		[0]	= PROTO_META_TEMPLATE("l4proto", &inet_protocol_type, NFT_META_L4PROTO, 8),
 		[IP6HDR_VERSION]	= HDR_BITFIELD("version", &integer_type, 0, 4),
 		[IP6HDR_DSCP]		= HDR_BITFIELD("dscp", &dscp_type, 4, 6),
 		[IP6HDR_ECN]		= HDR_BITFIELD("ecn", &ecn_type, 10, 2),
Signature · 6 lines
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#5 lore raw

PATCH 3/10 src: treat ip6 nexthdr as a protocol

In reply to Florian Westphal

ip6 nexthdr tcp tcp dport 22
will now inject a (useless) meta l4 dependency as ip6 nexthdr is no longer flagged as EXPR_F_PROTOCOL.

Avoid this if user really specified a test for ip6hdr->nexthdr.

---
 src/payload.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
src/payload.c +18 -1
index 55128fee1498..3a3fe8de97cf 100644
@@ -117,6 +117,23 @@ static const struct expr_ops payload_expr_ops = {
 	.pctx_update	= payload_expr_pctx_update,
 };
 
+/*
+ * ipv6 is special case, we normally use 'meta l4proto' to fetch the last
+ * l4 header of the ipv6 extension header chain so we will also match
+ * tcp after a fragmentation header, for instance.
+ *
+ * If user specifically asks for nexthdr x, treat is as a full
+ * dependency rather than injecting another (useless) meta l4 one.
+ */
+static bool proto_key_is_protocol(const struct proto_desc *desc, unsigned int type)
+{
+	if (type == desc->protocol_key ||
+	    (desc == &proto_ip6 && type == IP6HDR_NEXTHDR))
+		return true;
+
+	return false;
+}
+
 struct expr *payload_expr_alloc(const struct location *loc,
 				const struct proto_desc *desc,
 				unsigned int type)
@@ -129,7 +146,7 @@ struct expr *payload_expr_alloc(const struct location *loc,
 	if (desc != NULL) {
 		tmpl = &desc->templates[type];
 		base = desc->base;
-		if (type == desc->protocol_key)
+		if (proto_key_is_protocol(desc, type))
 			flags = EXPR_F_PROTOCOL;
 	} else {
 		tmpl = &proto_unknown_template;
Signature · 1 line
2.10.2
#6 lore raw

Re: [PATCH nft 03/10] src: treat ip6 nexthdr as a protocol

Quoted 5 lines · Florian Westphal

ip6 nexthdr tcp tcp dport 22
will now inject a (useless) meta l4 dependency as ip6 nexthdr is no longer flagged as EXPR_F_PROTOCOL.

Avoid this if user really specified a test for ip6hdr->nexthdr.

But ipv6_find_hdr() is actually fetching the layer 4 protocol number from the fragment.

Shouldn't we do the same with ip4h->protocol to keep things consistent? I mean, no meta l4 dependency but just real check for this header field if specified.

author maintainer
#7 lore raw

PATCH 4/10 tests: fix up meta l4proto change for ip6 family

In reply to Florian Westphal

After previous commit nft generates meta l4proto for ipv6 dependencies instead of checking the (first) nexthdr value.

This fixes up all tests cases accordingly except one which fails with

ip6/reject.t: ... 12: 'ip6 nexthdr 6 reject with tcp reset' mismatches 'meta l4proto 6 reject with tcp reset' This will be fixed by removing the implicit dependency in a followup patch.

---
 tests/py/bridge/icmpX.t.payload       |   4 +-
 tests/py/inet/ah.t.payload.ip6        |  60 +++++++-------
 tests/py/inet/comp.t.payload.ip6      |  34 ++++----
 tests/py/inet/dccp.t.payload.ip6      |  36 ++++----
 tests/py/inet/esp.t.payload.ip6       |  30 +++----
 tests/py/inet/ether.t.payload.ip6     |   6 +-
 tests/py/inet/icmpX.t.payload         |   4 +-
 tests/py/inet/sctp.t.payload.ip6      |  64 +++++++-------
 tests/py/inet/tcp.t.payload.ip6       | 152 +++++++++++++++++-----------------
 tests/py/inet/udp.t.payload.ip6       |  72 ++++++++--------
 tests/py/inet/udplite.t.payload.ip6   |  52 ++++++------
 tests/py/ip6/dnat.t.payload.ip6       |   6 +-
 tests/py/ip6/ether.t.payload          |   6 +-
 tests/py/ip6/icmpv6.t.payload.ip6     | 132 ++++++++++++++---------------
 tests/py/ip6/masquerade.t.payload.ip6 |  28 +++----
 tests/py/ip6/redirect.t.payload.ip6   |  38 ++++-----
 tests/py/ip6/reject.t.payload.ip6     |   2 +-
 tests/py/ip6/snat.t.payload.ip6       |   4 +-
 tests/py/ip6/tcpopt.t.payload         |  52 ++++++------
 19 files changed, 389 insertions(+), 393 deletions(-)
tests/py/bridge/icmpX.t.payload +1 -3
index 19efdd85c43b..b351f7b008b7 100644
@@ -27,9 +27,7 @@ bridge test-bridge input
 
 # icmpv6 type echo-request
 bridge test-bridge input
-  [ payload load 2b @ link header + 12 => reg 1 ]
-  [ cmp eq reg 1 0x0000dd86 ]
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000003a ]
   [ payload load 1b @ transport header + 0 => reg 1 ]
   [ cmp eq reg 1 0x00000080 ]
tests/py/inet/ah.t.payload.ip6 +30 -30

239 lines not on this page · raw message

tests/py/inet/comp.t.payload.ip6 +17 -17
index a325d8cdc9ad..3048d822d3f7 100644
@@ -1,27 +1,27 @@
 # comp nexthdr != esp
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 1b @ transport header + 0 => reg 1 ]
   [ cmp neq reg 1 0x00000032 ]
 
 # comp flags 0x0
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 1b @ transport header + 1 => reg 1 ]
   [ cmp eq reg 1 0x00000000 ]
 
 # comp flags != 0x23
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 1b @ transport header + 1 => reg 1 ]
   [ cmp neq reg 1 0x00000023 ]
 
 # comp flags 0x33-0x45
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 1b @ transport header + 1 => reg 1 ]
   [ cmp gte reg 1 0x00000033 ]
@@ -29,7 +29,7 @@ ip6 test-ip6 input
 
 # comp flags != 0x33-0x45
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 1b @ transport header + 1 => reg 1 ]
   [ range neq reg 1 0x00000033 0x00000045 ]
@@ -39,7 +39,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 00000033  : 0 [end]	element 00000055  : 0 [end]	element 00000067  : 0 [end]	element 00000088  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 1b @ transport header + 1 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -49,7 +49,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 00000033  : 0 [end]	element 00000055  : 0 [end]	element 00000067  : 0 [end]	element 00000088  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 1b @ transport header + 1 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
@@ -59,7 +59,7 @@ __set%d test-ip6 7
 __set%d test-ip6 0
 	element 00000000  : 1 [end]	element 00000033  : 0 [end]	element 00000056  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 1b @ transport header + 1 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -69,28 +69,28 @@ __set%d test-ip6 7
 __set%d test-ip6 0
 	element 00000000  : 1 [end]	element 00000033  : 0 [end]	element 00000056  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 1b @ transport header + 1 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
 
 # comp cpi 22
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
 
 # comp cpi != 233
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp neq reg 1 0x0000e900 ]
 
 # comp cpi 33-45
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp gte reg 1 0x00002100 ]
@@ -98,7 +98,7 @@ ip6 test-ip6 input
 
 # comp cpi != 33-45
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ range neq reg 1 0x00002100 0x00002d00 ]
@@ -108,7 +108,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 00002100  : 0 [end]	element 00003700  : 0 [end]	element 00004300  : 0 [end]	element 00005800  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -118,7 +118,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 00002100  : 0 [end]	element 00003700  : 0 [end]	element 00004300  : 0 [end]	element 00005800  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
@@ -128,7 +128,7 @@ __set%d test-ip6 7
 __set%d test-ip6 0
 	element 00000000  : 1 [end]	element 00002100  : 0 [end]	element 00003800  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -138,7 +138,7 @@ __set%d test-ip6 7
 __set%d test-ip6 0
 	element 00000000  : 1 [end]	element 00002100  : 0 [end]	element 00003800  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000006c ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
tests/py/inet/dccp.t.payload.ip6 +18 -18
index 0f8aab11d69d..0fa441043a7a 100644
@@ -1,6 +1,6 @@
 # dccp sport 21-35
 ip test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ cmp gte reg 1 0x00001500 ]
@@ -8,7 +8,7 @@ ip test-ip6 input
 
 # dccp sport != 21-35
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ range neq reg 1 0x00001500 0x00002300 ]
@@ -18,7 +18,7 @@ __set%d test-ip4 3
 __set%d test-ip4 0
 	element 00001700  : 0 [end]	element 00001800  : 0 [end]	element 00001900  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -28,7 +28,7 @@ __set%d test-ip4 3
 __set%d test-ip4 0
 	element 00001700  : 0 [end]	element 00001800  : 0 [end]	element 00001900  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
@@ -38,7 +38,7 @@ __set%d test-ip4 7
 __set%d test-ip4 0
 	element 00000000  : 1 [end]	element 00001400  : 0 [end]	element 00003300  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -48,14 +48,14 @@ __set%d test-ip4 7
 __set%d test-ip4 0
 	element 00000000  : 1 [end]	element 00001400  : 0 [end]	element 00003300  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
 
 # dccp sport ftp-data - re-mail-ck
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ cmp gte reg 1 0x00001400 ]
@@ -63,7 +63,7 @@ ip6 test-ip6 input
 
 # dccp sport 20-50
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ cmp gte reg 1 0x00001400 ]
@@ -74,7 +74,7 @@ __set%d test-ip4 7
 __set%d test-ip4 0
 	element 00000000  : 1 [end]	element 00001400  : 0 [end]	element 00003300  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -84,7 +84,7 @@ __set%d test-ip4 7
 __set%d test-ip4 0
 	element 00000000  : 1 [end]	element 00001400  : 0 [end]	element 00003300  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
@@ -94,7 +94,7 @@ __set%d test-ip4 3
 __set%d test-ip4 0
 	element 00001700  : 0 [end]	element 00001800  : 0 [end]	element 00001900  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -104,7 +104,7 @@ __set%d test-ip4 3
 __set%d test-ip4 0
 	element 00001700  : 0 [end]	element 00001800  : 0 [end]	element 00001900  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
@@ -114,7 +114,7 @@ __set%d test-ip4 7
 __set%d test-ip4 0
 	element 00000000  : 1 [end]	element 00001400  : 0 [end]	element 00003300  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -124,7 +124,7 @@ __set%d test-ip4 7
 __set%d test-ip4 0
 	element 00000000  : 1 [end]	element 00001400  : 0 [end]	element 00003300  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
@@ -134,7 +134,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 00000000  : 0 [end]	element 00000002  : 0 [end]	element 00000004  : 0 [end]	element 00000006  : 0 [end]	element 00000008  : 0 [end]	element 0000000a  : 0 [end]	element 0000000c  : 0 [end]	element 0000000e  : 0 [end]	element 00000010  : 0 [end]	element 00000012  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 1b @ transport header + 8 => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x0000001e ) ^ 0x00000000 ]
@@ -145,7 +145,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 00000000  : 0 [end]	element 00000002  : 0 [end]	element 00000004  : 0 [end]	element 00000006  : 0 [end]	element 00000008  : 0 [end]	element 0000000a  : 0 [end]	element 0000000c  : 0 [end]	element 0000000e  : 0 [end]	element 00000010  : 0 [end]	element 00000012  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 1b @ transport header + 8 => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x0000001e ) ^ 0x00000000 ]
@@ -153,7 +153,7 @@ ip6 test-ip6 input
 
 # dccp type request
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 1b @ transport header + 8 => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x0000001e ) ^ 0x00000000 ]
@@ -161,7 +161,7 @@ ip6 test-ip6 input
 
 # dccp type != request
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000021 ]
   [ payload load 1b @ transport header + 8 => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x0000001e ) ^ 0x00000000 ]
tests/py/inet/esp.t.payload.ip6 +15 -15
index 47584921af09..a9ed233c8f5d 100644
@@ -1,20 +1,20 @@
 # esp spi 100
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 0 => reg 1 ]
   [ cmp eq reg 1 0x64000000 ]
 
 # esp spi != 100
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 0 => reg 1 ]
   [ cmp neq reg 1 0x64000000 ]
 
 # esp spi 111-222
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 0 => reg 1 ]
   [ cmp gte reg 1 0x6f000000 ]
@@ -22,7 +22,7 @@ ip6 test-ip6 input
 
 # esp spi != 111-222
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 0 => reg 1 ]
   [ range neq reg 1 0x6f000000 0xde000000 ]
@@ -32,7 +32,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 64000000  : 0 [end]	element 66000000  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -42,7 +42,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 64000000  : 0 [end]	element 66000000  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
@@ -52,7 +52,7 @@ __set%d test-ip6 7
 __set%d test-ip6 0
 	element 00000000  : 1 [end]	element 64000000  : 0 [end]	element 67000000  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -62,21 +62,21 @@ __set%d test-ip6 7
 __set%d test-ip6 0
 	element 00000000  : 1 [end]	element 64000000  : 0 [end]	element 67000000  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 0 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
 
 # esp sequence 22
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 4 => reg 1 ]
   [ cmp eq reg 1 0x16000000 ]
 
 # esp sequence 22-24
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 4 => reg 1 ]
   [ cmp gte reg 1 0x16000000 ]
@@ -84,7 +84,7 @@ ip6 test-ip6 input
 
 # esp sequence != 22-24
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 4 => reg 1 ]
   [ range neq reg 1 0x16000000 0x18000000 ]
@@ -94,7 +94,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 16000000  : 0 [end]	element 18000000  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 4 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -104,7 +104,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 16000000  : 0 [end]	element 18000000  : 0 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 4 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
@@ -114,7 +114,7 @@ __set%d test-ip6 7
 __set%d test-ip6 0
 	element 00000000  : 1 [end]	element 16000000  : 0 [end]	element 1a000000  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 4 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -124,7 +124,7 @@ __set%d test-ip6 7
 __set%d test-ip6 0
 	element 00000000  : 1 [end]	element 16000000  : 0 [end]	element 1a000000  : 1 [end]
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000032 ]
   [ payload load 4b @ transport header + 4 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
tests/py/inet/ether.t.payload.ip6 +3 -3
index 9065952d2646..a3a8905e6372 100644
@@ -1,6 +1,6 @@
 # tcp dport 22 iiftype ether ether saddr 00:0f:54:0c:11:4 meta nfproto ipv4 accept
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
@@ -14,7 +14,7 @@ ip6 test-ip6 input
 
 # tcp dport 22 iiftype ether ether saddr 00:0f:54:0c:11:4 accept
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
@@ -26,7 +26,7 @@ ip6 test-ip6 input
 
 # tcp dport 22 ether saddr 00:0f:54:0c:11:04 accept
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
tests/py/inet/icmpX.t.payload +1 -3
index 81ca7744c4e4..4df15d7fb28c 100644
@@ -27,9 +27,7 @@ inet test-inet input
 
 # icmpv6 type echo-request
 inet test-inet input
-  [ meta load nfproto => reg 1 ]
-  [ cmp eq reg 1 0x0000000a ]
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000003a ]
   [ payload load 1b @ transport header + 0 => reg 1 ]
   [ cmp eq reg 1 0x00000080 ]
tests/py/inet/sctp.t.payload.ip6 +32 -32

255 lines not on this page · raw message

tests/py/inet/tcp.t.payload.ip6 +76 -76

607 lines not on this page · raw message

tests/py/inet/udp.t.payload.ip6 +36 -36

287 lines not on this page · raw message

tests/py/inet/udplite.t.payload.ip6 +26 -26

207 lines not on this page · raw message

tests/py/ip6/dnat.t.payload.ip6 +3 -3
index 8bd5819e0360..4d3fafe2bf02 100644
@@ -1,6 +1,6 @@
 # tcp dport 80-90 dnat to [2001:838:35f:1::]-[2001:838:35f:2::]:80-100
 ip6 test-ip6 prerouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp gte reg 1 0x00005000 ]
@@ -13,7 +13,7 @@ ip6 test-ip6 prerouting
 
 # tcp dport 80-90 dnat to [2001:838:35f:1::]-[2001:838:35f:2::]:100
 ip6 test-ip6 prerouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp gte reg 1 0x00005000 ]
@@ -25,7 +25,7 @@ ip6 test-ip6 prerouting
 
 # tcp dport 80-90 dnat to [2001:838:35f:1::]:80
 ip6 test-ip6 prerouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp gte reg 1 0x00005000 ]
tests/py/ip6/ether.t.payload +3 -3
index c7342cc0c79e..592b4ea0e0bc 100644
@@ -1,6 +1,6 @@
 # tcp dport 22 iiftype ether ip6 daddr 1::2 ether saddr 00:0f:54:0c:11:4 accept
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
@@ -14,7 +14,7 @@ ip6 test-ip6 input
 
 # tcp dport 22 ip6 daddr 1::2 ether saddr 00:0f:54:0c:11:04
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
@@ -27,7 +27,7 @@ ip6 test-ip6 input
 
 # tcp dport 22 ether saddr 00:0f:54:0c:11:04 ip6 daddr 1::2
 ip6 test-ip6 input
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
tests/py/ip6/icmpv6.t.payload.ip6 +66 -66

527 lines not on this page · raw message

tests/py/ip6/masquerade.t.payload.ip6 +14 -14
index 31cedf1ff00c..04f328b8c65e 100644
@@ -1,6 +1,6 @@
 # udp dport 53 masquerade
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -8,7 +8,7 @@ ip6 test-ip6 postrouting
 
 # udp dport 53 masquerade random
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -16,7 +16,7 @@ ip6 test-ip6 postrouting
 
 # udp dport 53 masquerade random,persistent
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -24,7 +24,7 @@ ip6 test-ip6 postrouting
 
 # udp dport 53 masquerade random,persistent,fully-random
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -32,7 +32,7 @@ ip6 test-ip6 postrouting
 
 # udp dport 53 masquerade random,fully-random
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -40,7 +40,7 @@ ip6 test-ip6 postrouting
 
 # udp dport 53 masquerade random,fully-random,persistent
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -48,7 +48,7 @@ ip6 test-ip6 postrouting
 
 # udp dport 53 masquerade persistent
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -56,7 +56,7 @@ ip6 test-ip6 postrouting
 
 # udp dport 53 masquerade persistent,random
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -64,7 +64,7 @@ ip6 test-ip6 postrouting
 
 # udp dport 53 masquerade persistent,random,fully-random
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -72,7 +72,7 @@ ip6 test-ip6 postrouting
 
 # udp dport 53 masquerade persistent,fully-random
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -80,7 +80,7 @@ ip6 test-ip6 postrouting
 
 # udp dport 53 masquerade persistent,fully-random,random
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -91,7 +91,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 00000100  : 0 [end]	element 00000200  : 0 [end]	element 00000300  : 0 [end]	element 00000400  : 0 [end]	element 00000500  : 0 [end]	element 00000600  : 0 [end]	element 00000700  : 0 [end]	element 00000800  : 0 [end]	element 00006500  : 0 [end]	element 0000ca00  : 0 [end]	element 00002f01  : 0 [end]	element 0000e903  : 0 [end]	element 0000d207  : 0 [end]	element 0000bb0b  : 0 [end]
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -102,7 +102,7 @@ ip6 test-ip6 postrouting
   [ payload load 16b @ network header + 24 => reg 1 ]
   [ cmp gte reg 1 0x000000fe 0x00000000 0x00000000 0x01000000 ]
   [ cmp lte reg 1 0x000000fe 0x00000000 0x00000000 0x00020000 ]
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -119,7 +119,7 @@ ip6 test-ip6 postrouting
   [ ct load state => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x0000000a ) ^ 0x00000000 ]
   [ cmp neq reg 1 0x00000000 ]
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __map%d dreg 0 ]
tests/py/ip6/redirect.t.payload.ip6 +19 -19
index f256326acf4b..8731194f729e 100644
@@ -4,7 +4,7 @@ ip6 test-ip6 output
 
 # udp dport 954 redirect
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x0000ba03 ]
@@ -19,7 +19,7 @@ ip6 test-ip6 output
 
 # udp dport 53 redirect random
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -27,7 +27,7 @@ ip6 test-ip6 output
 
 # udp dport 53 redirect random,persistent
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -35,7 +35,7 @@ ip6 test-ip6 output
 
 # udp dport 53 redirect random,persistent,fully-random
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -43,7 +43,7 @@ ip6 test-ip6 output
 
 # udp dport 53 redirect random,fully-random
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -51,7 +51,7 @@ ip6 test-ip6 output
 
 # udp dport 53 redirect random,fully-random,persistent
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -59,7 +59,7 @@ ip6 test-ip6 output
 
 # udp dport 53 redirect persistent
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -67,7 +67,7 @@ ip6 test-ip6 output
 
 # udp dport 53 redirect persistent,random
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -75,7 +75,7 @@ ip6 test-ip6 output
 
 # udp dport 53 redirect persistent,random,fully-random
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -83,7 +83,7 @@ ip6 test-ip6 output
 
 # udp dport 53 redirect persistent,fully-random
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -91,7 +91,7 @@ ip6 test-ip6 output
 
 # udp dport 53 redirect persistent,fully-random,random
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -99,7 +99,7 @@ ip6 test-ip6 output
 
 # udp dport 1234 redirect to :1234
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x0000d204 ]
@@ -110,7 +110,7 @@ ip6 test-ip6 output
 ip6 test-ip6 output
   [ payload load 16b @ network header + 24 => reg 1 ]
   [ cmp eq reg 1 0x000000fe 0x00000000 0x00000000 0xfeca0000 ]
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00000e27 ]
@@ -127,7 +127,7 @@ ip6 test-ip6 output
 
 # tcp dport 39128 redirect to :993
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x0000d898 ]
@@ -136,7 +136,7 @@ ip6 test-ip6 output
 
 # tcp dport 9128 redirect to :993 random
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x0000a823 ]
@@ -145,7 +145,7 @@ ip6 test-ip6 output
 
 # tcp dport 9128 redirect to :993 fully-random,persistent
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x0000a823 ]
@@ -157,7 +157,7 @@ __set%d test-ip6 3
 __set%d test-ip6 0
 	element 00000100  : 0 [end]	element 00000200  : 0 [end]	element 00000300  : 0 [end]	element 00000400  : 0 [end]	element 00000500  : 0 [end]	element 00000600  : 0 [end]	element 00000700  : 0 [end]	element 00000800  : 0 [end]	element 00006500  : 0 [end]	element 0000ca00  : 0 [end]	element 00002f01  : 0 [end]	element 0000e903  : 0 [end]	element 0000d207  : 0 [end]	element 0000bb0b  : 0 [end]
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -168,7 +168,7 @@ ip6 test-ip6 output
   [ payload load 16b @ network header + 24 => reg 1 ]
   [ cmp gte reg 1 0x000000fe 0x00000000 0x00000000 0x01000000 ]
   [ cmp lte reg 1 0x000000fe 0x00000000 0x00000000 0x00020000 ]
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -185,7 +185,7 @@ ip6 test-ip6 output
   [ ct load state => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x0000000a ) ^ 0x00000000 ]
   [ cmp neq reg 1 0x00000000 ]
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __map%d dreg 0 ]
tests/py/ip6/reject.t.payload.ip6 +1 -1
index fcae382b89c6..0ba5f7ee5bfd 100644
@@ -28,7 +28,7 @@ ip6 test-ip6 output
 
 # reject with tcp reset
 ip6 test-ip6 output
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ reject type 1 code 0 ]
 
tests/py/ip6/snat.t.payload.ip6 +2 -2
index ea403638dd8f..537e6682aa38 100644
@@ -1,6 +1,6 @@
 # tcp dport 80-90 snat to [2001:838:35f:1::]-[2001:838:35f:2::]:80-100
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp gte reg 1 0x00005000 ]
@@ -13,7 +13,7 @@ ip6 test-ip6 postrouting
 
 # tcp dport 80-90 snat to [2001:838:35f:1::]-[2001:838:35f:2::]:100
 ip6 test-ip6 postrouting
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp gte reg 1 0x00005000 ]
tests/py/ip6/tcpopt.t.payload +26 -26

106 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.10.2

Part of the diff is not shown here. View the raw message.

#8 lore raw

Re: [PATCH nft 04/10] tests: fix up meta l4proto change for ip6 family

Quoted 36 lines · Florian Westphal

After previous commit nft generates meta l4proto for ipv6 dependencies instead of checking the (first) nexthdr value.

This fixes up all tests cases accordingly except one which fails with

ip6/reject.t: ... 12: 'ip6 nexthdr 6 reject with tcp reset' mismatches 'meta l4proto 6 reject with tcp reset' This will be fixed by removing the implicit dependency in a followup patch.

---
 tests/py/bridge/icmpX.t.payload       |   4 +-
 tests/py/inet/ah.t.payload.ip6        |  60 +++++++-------
 tests/py/inet/comp.t.payload.ip6      |  34 ++++----
 tests/py/inet/dccp.t.payload.ip6      |  36 ++++----
 tests/py/inet/esp.t.payload.ip6       |  30 +++----
 tests/py/inet/ether.t.payload.ip6     |   6 +-
 tests/py/inet/icmpX.t.payload         |   4 +-
 tests/py/inet/sctp.t.payload.ip6      |  64 +++++++-------
 tests/py/inet/tcp.t.payload.ip6       | 152 +++++++++++++++++-----------------
 tests/py/inet/udp.t.payload.ip6       |  72 ++++++++--------
 tests/py/inet/udplite.t.payload.ip6   |  52 ++++++------
 tests/py/ip6/dnat.t.payload.ip6       |   6 +-
 tests/py/ip6/ether.t.payload          |   6 +-
 tests/py/ip6/icmpv6.t.payload.ip6     | 132 ++++++++++++++---------------
 tests/py/ip6/masquerade.t.payload.ip6 |  28 +++----
 tests/py/ip6/redirect.t.payload.ip6   |  38 ++++-----
 tests/py/ip6/reject.t.payload.ip6     |   2 +-
 tests/py/ip6/snat.t.payload.ip6       |   4 +-
 tests/py/ip6/tcpopt.t.payload         |  52 ++++++------
 19 files changed, 389 insertions(+), 393 deletions(-)
tests/py/bridge/icmpX.t.payload +0 -0
index 19efdd85c43b..b351f7b008b7 100644

tests/py/bridge/icmpX.t.payload bridge test-bridge input · line 33

Quoted 10 lines
tests/py/bridge/icmpX.t.payload +1 -3
@@ -27,9 +27,7 @@ bridge test-bridge input
 
 # icmpv6 type echo-request
 bridge test-bridge input
-  [ payload load 2b @ link header + 12 => reg 1 ]
-  [ cmp eq reg 1 0x0000dd86 ]
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000003a ]
   [ payload load 1b @ transport header + 0 => reg 1 ]
   [ cmp eq reg 1 0x00000080 ]

I think this is not correct.

Before this patch, we restricted this to match on IPv6 traffic.

Now, we can match an IPv4 packet carrying an ICMPv6 protocol, this is obviously handcrafted (incorrect) packet, but this rule would match.

So I think the implicit check for IPv6 via ethertype should still remain there, right?

What patch are these test updates related to? Is it 1/10?

author maintainer
#9 lore raw

Re: [PATCH nft 04/10] tests: fix up meta l4proto change for ip6 family

Quoted 10 lines · Pablo Neira Ayuso
Quoted 9 lines · Florian Westphal

After previous commit nft generates meta l4proto for ipv6 dependencies instead of checking the (first) nexthdr value.

This fixes up all tests cases accordingly except one which fails with

ip6/reject.t: ... 12: 'ip6 nexthdr 6 reject with tcp reset' mismatches 'meta l4proto 6 reject with tcp reset' This will be fixed by removing the implicit dependency in a followup patch.

[..]

Quoted 10 lines

tests/py/bridge/icmpX.t.payload bridge test-bridge input · line 33

Quoted 9 lines
 # icmpv6 type echo-request
 bridge test-bridge input
tests/py/bridge/icmpX.t.payload +1 -3
-  [ payload load 2b @ link header + 12 => reg 1 ]
-  [ cmp eq reg 1 0x0000dd86 ]
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000003a ]
   [ payload load 1b @ transport header + 0 => reg 1 ]
   [ cmp eq reg 1 0x00000080 ]
Quoted 3 lines

I think this is not correct.

Before this patch, we restricted this to match on IPv6 traffic.

Right.

Quoted 2 lines

Now, we can match an IPv4 packet carrying an ICMPv6 protocol, this is obviously handcrafted (incorrect) packet, but this rule would match.

Yes. I am not sure what the correct or desired behaviour is.

Simply speaking we're asked to check if transport protocol is 58, and thats what this does.

If you prefer special-casing this I can look into it, probably best thing is to inject 'meta nfproto ip6' test.

What would you expect in these cases (note, ip family):

a) add rule filter input meta l4proto icmpv6
b) add rule filter input meta l4proto icmpv6 icmpv6 type echo-request
c) add rule filter input icmpv6 type echo-request

with master only a) is accepted.
With patch #1 of the series, b) is also accepted.

Quoted 2 lines

So I think the implicit check for IPv6 via ethertype should still remain there, right?

Maybe, I am not sure.

Quoted 1 line

What patch are these test updates related to? Is it 1/10?

2 and 3 (mainly 2, patch 3 gets rid of useless extra dependency, so fixing this up after 2 means I need another fixup patch after 3).

If you prefer that I can do this, no problem.

#10 lore raw

Re: [PATCH nft 04/10] tests: fix up meta l4proto change for ip6 family

Hi Florian,

Quoted 29 lines · Florian Westphal
Quoted 10 lines · Pablo Neira Ayuso
Quoted 9 lines · Florian Westphal

After previous commit nft generates meta l4proto for ipv6 dependencies instead of checking the (first) nexthdr value.

This fixes up all tests cases accordingly except one which fails with

ip6/reject.t: ... 12: 'ip6 nexthdr 6 reject with tcp reset' mismatches 'meta l4proto 6 reject with tcp reset' This will be fixed by removing the implicit dependency in a followup patch.

[..]

Quoted 10 lines

tests/py/bridge/icmpX.t.payload bridge test-bridge input · line 33

Quoted 9 lines
 # icmpv6 type echo-request
 bridge test-bridge input
tests/py/bridge/icmpX.t.payload +1 -3
-  [ payload load 2b @ link header + 12 => reg 1 ]
-  [ cmp eq reg 1 0x0000dd86 ]
-  [ payload load 1b @ network header + 6 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x0000003a ]
   [ payload load 1b @ transport header + 0 => reg 1 ]
   [ cmp eq reg 1 0x00000080 ]
Quoted 3 lines

I think this is not correct.

Before this patch, we restricted this to match on IPv6 traffic.

Right.

Quoted 7 lines
Quoted 2 lines

Now, we can match an IPv4 packet carrying an ICMPv6 protocol, this is obviously handcrafted (incorrect) packet, but this rule would match.

Yes. I am not sure what the correct or desired behaviour is.

Simply speaking we're asked to check if transport protocol is 58, and thats what this does.

Right. However, this forces users to add explicit ip6 nexthdr or meta protocol to restrict this IPv6. My concern here is that this loose matching, for something that from a protocol perspective is incorrect.

Quoted 2 lines

If you prefer special-casing this I can look into it, probably best thing is to inject 'meta nfproto ip6' test.

For inet, yes. For bridge and netdev families the dependency would be different.

I suspect this is working now with your patches to use meta for the implicit dependencies. I would point to the patch that adds icmp and icmpv6 as protocol to proto_inet_service as the one removing this special casing.

Quoted 8 lines

What would you expect in these cases (note, ip family):

a) add rule filter input meta l4proto icmpv6
b) add rule filter input meta l4proto icmpv6 icmpv6 type echo-request
c) add rule filter input icmpv6 type echo-request

with master only a) is accepted.
With patch #1 of the series, b) is also accepted.

b) and c) are equivalent. Since c) should generate both the meta protocol and the meta l4proto dependency.

Then, we should allow this too:

meta protocol ip meta l4proto icmpv6

so we can match IPv4 packets that container ICMPv6 packet. I know, this is crazy, but we should users to match this. A handcrafted packet may look like that.

I think this logic should be placed somewhere at payload_gen_dependency().

author maintainer
#11 lore raw

Re: [PATCH nft 04/10] tests: fix up meta l4proto change for ip6 family

Quoted 11 lines · Pablo Neira Ayuso
Quoted 8 lines

What would you expect in these cases (note, ip family):

a) add rule filter input meta l4proto icmpv6
b) add rule filter input meta l4proto icmpv6 icmpv6 type echo-request
c) add rule filter input icmpv6 type echo-request

with master only a) is accepted.
With patch #1 of the series, b) is also accepted.

b) and c) are equivalent. Since c) should generate both the meta protocol and the meta l4proto dependency.

Hmm. I suspect you mean c) should be rejected?
(ip family!), so user would have to specify

Quoted 3 lines

Then, we should allow this too:

meta protocol ip meta l4proto icmpv6

Explicitly to indicate ip->protocol == 58 is asked for.

Quoted 3 lines

so we can match IPv4 packets that container ICMPv6 packet. I know, this is crazy, but we should users to match this. A handcrafted packet may look like that.

Yes and yeas.

Quoted 1 line

I think this logic should be placed somewhere at payload_gen_dependency().

Ok, I will rework this series accordingly, i.e.:

add rule filter input icmpv6 type echo-request

will:
- pull in meta l4proto dependency for ip6 family
- pull in meta l4proto dependency PLUS ipv6 dependency in inet/bridge/netdev families
- fail with invalid protocol base error in ip family

the last case should work in ip family iff user specifies the nexthdr value specifically.

Does that seem ok to you?

Thanks,
Florian

#12 lore raw

Re: [PATCH nft 04/10] tests: fix up meta l4proto change for ip6 family

Quoted 7 lines · Florian Westphal
Quoted 6 lines · Pablo Neira Ayuso
Quoted 6 lines

What would you expect in these cases (note, ip family):

a) add rule filter input meta l4proto icmpv6
b) add rule filter input meta l4proto icmpv6 icmpv6 type echo-request
c) add rule filter input icmpv6 type echo-request

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

with master only a) is accepted.
With patch #1 of the series, b) is also accepted.

b) and c) are equivalent. Since c) should generate both the meta protocol and the meta l4proto dependency.

Hmm. I suspect you mean c) should be rejected?
(ip family!), so user would have to specify

Oh, I thought these examples above are inet.

Yes, we should reject this from ip family.

Quoted 5 lines
Quoted 3 lines

Then, we should allow this too:

meta protocol ip meta l4proto icmpv6

Explicitly to indicate ip->protocol == 58 is asked for.

Exactly.

Quoted 11 lines
Quoted 3 lines

so we can match IPv4 packets that container ICMPv6 packet. I know, this is crazy, but we should users to match this. A handcrafted packet may look like that.

Yes and yeas.

Quoted 1 line

I think this logic should be placed somewhere at payload_gen_dependency().

Ok, I will rework this series accordingly, i.e.:

add rule filter input icmpv6 type echo-request

This above should be ip6 family, right?

Quoted 10 lines

will:
- pull in meta l4proto dependency for ip6 family
- pull in meta l4proto dependency PLUS ipv6 dependency in inet/bridge/netdev families
- fail with invalid protocol base error in ip family

the last case should work in ip family iff user specifies the nexthdr value specifically.

Does that seem ok to you?

Sounds great, thanks.

author maintainer
#13 lore raw

Re: [PATCH nft 04/10] tests: fix up meta l4proto change for ip6 family

Quoted 35 lines · Pablo Neira Ayuso
Quoted 7 lines · Florian Westphal
Quoted 6 lines · Pablo Neira Ayuso
Quoted 6 lines

What would you expect in these cases (note, ip family):

a) add rule filter input meta l4proto icmpv6
b) add rule filter input meta l4proto icmpv6 icmpv6 type echo-request
c) add rule filter input icmpv6 type echo-request

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

with master only a) is accepted.
With patch #1 of the series, b) is also accepted.

b) and c) are equivalent. Since c) should generate both the meta protocol and the meta l4proto dependency.

Hmm. I suspect you mean c) should be rejected?
(ip family!), so user would have to specify

Oh, I thought these examples above are inet.

Yes, we should reject this from ip family.

Quoted 5 lines
Quoted 3 lines

Then, we should allow this too:

meta protocol ip meta l4proto icmpv6

Explicitly to indicate ip->protocol == 58 is asked for.

Exactly.

Quoted 6 lines
Quoted 3 lines

so we can match IPv4 packets that container ICMPv6 packet. I know, this is crazy, but we should users to match this. A handcrafted packet may look like that.

Yes and yeas.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I think this logic should be placed somewhere at payload_gen_dependency().

Ok, I will rework this series accordingly, i.e.:

add rule filter input icmpv6 type echo-request

This above should be ip6 family, right?

Actually i meant

add rule $family filter input icmpv6 type echo-request

... to have the example below illustrate the difference in behaviour and dependency injection.

Quoted 6 lines
Quoted 6 lines

will:
- pull in meta l4proto dependency for ip6 family
- pull in meta l4proto dependency PLUS ipv6 dependency in inet/bridge/netdev families
- fail with invalid protocol base error in ip family

Quoted 6 lines
Quoted 4 lines

the last case should work in ip family iff user specifies the nexthdr value specifically.

Does that seem ok to you?

Sounds great, thanks.

Good, I will work on this tomorrow then.

I won't push any of the patches for the time being, so expect a v2.

author maintainer
#14 lore raw

PATCH 5/10 tests: meta: add icmpv6 test case

In reply to Florian Westphal
---
 tests/py/any/meta.t         | 1 +
 tests/py/any/meta.t.payload | 7 +++++++
 2 files changed, 8 insertions(+)
tests/py/any/meta.t +1 -0
index c3ac0a4c267a..2ff942ff039d 100644
@@ -38,6 +38,7 @@ meta l4proto { 33, 55, 67, 88};ok;meta l4proto { 33, 55, 67, 88}
 meta l4proto != { 33, 55, 67, 88};ok
 meta l4proto { 33-55};ok
 meta l4proto != { 33-55};ok
+meta l4proto ipv6-icmp icmpv6 type nd-router-advert;ok;icmpv6 type nd-router-advert
 
 meta priority root;ok
 meta priority none;ok
tests/py/any/meta.t.payload +7 -0
index e432656624b6..871f1ada5abe 100644
@@ -187,6 +187,13 @@ ip test-ip4 input
   [ byteorder reg 1 = hton(reg 1, 2, 1) ]
   [ lookup reg 1 set __set%d 0x1 ]
 
+# meta l4proto ipv6-icmp icmpv6 type nd-router-advert
+ip test-ip4 input
+  [ meta load l4proto => reg 1 ]
+  [ cmp eq reg 1 0x0000003a ]
+  [ payload load 1b @ transport header + 0 => reg 1 ]
+  [ cmp eq reg 1 0x00000086 ]
+
 # meta mark 0x4
 ip test-ip4 input
   [ meta load mark => reg 1 ]
Signature · 1 line
2.10.2
author maintainer
#15 lore raw

PATCH 6/10 netlink_delinearize: reject: remove dependency for tcp-resets

In reply to Florian Westphal

We can remove a l4 dependency in ip/ipv6 families.

---
 src/netlink_delinearize.c | 6 ++++++
 tests/py/ip6/reject.t     | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
src/netlink_delinearize.c +6 -0
index f0288cd49914..49dc6a6016ba 100644
@@ -1856,10 +1856,16 @@ static void stmt_reject_postprocess(struct rule_pp_ctx *rctx)
 	case NFPROTO_IPV4:
 		stmt->reject.family = rctx->pctx.family;
 		stmt->reject.expr->dtype = &icmp_code_type;
+		if (stmt->reject.type == NFT_REJECT_TCP_RST)
+			__payload_dependency_kill(&rctx->pdctx,
+						  PROTO_BASE_TRANSPORT_HDR);
 		break;
 	case NFPROTO_IPV6:
 		stmt->reject.family = rctx->pctx.family;
 		stmt->reject.expr->dtype = &icmpv6_code_type;
+		if (stmt->reject.type == NFT_REJECT_TCP_RST)
+			__payload_dependency_kill(&rctx->pdctx,
+						  PROTO_BASE_TRANSPORT_HDR);
 		break;
 	case NFPROTO_INET:
 		if (stmt->reject.type == NFT_REJECT_ICMPX_UNREACH) {
tests/py/ip6/reject.t +1 -1
index 7d21aa8ef160..de09fd978418 100644
@@ -9,7 +9,7 @@ reject with icmpv6 type addr-unreachable;ok
 reject with icmpv6 type port-unreachable;ok;reject
 reject with icmpv6 type policy-fail;ok
 reject with icmpv6 type reject-route;ok
-reject with tcp reset;ok;ip6 nexthdr 6 reject with tcp reset
+reject with tcp reset;ok
 
 reject with icmpv6 type host-unreachable;fail
 reject with icmp type host-unreachable;fail
Signature · 1 line
2.10.2
author maintainer
#16 lore raw

PATCH 7/10 tests: add ip reject with tcp and check for mark too

In reply to Florian Westphal

... to avoid resetting e.g. the ssh session to the vm that runs nft-test.py.

---
 tests/py/bridge/reject.t            | 2 +-
 tests/py/bridge/reject.t.payload    | 4 +++-
 tests/py/inet/reject.t              | 2 +-
 tests/py/inet/reject.t.payload.inet | 4 +++-
 tests/py/ip/reject.t                | 1 +
 tests/py/ip/reject.t.payload        | 8 ++++++++
 tests/py/ip6/reject.t               | 2 +-
 tests/py/ip6/reject.t.payload.ip6   | 4 +++-
 8 files changed, 21 insertions(+), 6 deletions(-)
tests/py/bridge/reject.t +1 -1
index 4fa6ac0b3278..67deac8d3b5e 100644
@@ -16,7 +16,7 @@ reject with icmpv6 type admin-prohibited;ok;ether type ip6 reject with icmpv6 ty
 reject with icmpv6 type addr-unreachable;ok;ether type ip6 reject with icmpv6 type addr-unreachable
 reject with icmpv6 type port-unreachable;ok;ether type ip6 reject
 
-ip protocol tcp reject with tcp reset;ok;ip protocol 6 reject with tcp reset
+mark 12345 ip protocol tcp reject with tcp reset;ok;mark 0x00003039 ip protocol 6 reject with tcp reset
 
 reject;ok
 ether type ip reject;ok
tests/py/bridge/reject.t.payload +3 -1
index f5a0e6a82963..b984f6f8de4d 100644
@@ -64,8 +64,10 @@ bridge test-bridge input
   [ cmp eq reg 1 0x0000dd86 ]
   [ reject type 0 code 4 ]
 
-# ip protocol tcp reject with tcp reset
+# mark 12345 ip protocol tcp reject with tcp reset
 bridge test-bridge input
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x00003039 ]
   [ payload load 2b @ link header + 12 => reg 1 ]
   [ cmp eq reg 1 0x00000008 ]
   [ payload load 1b @ network header + 9 => reg 1 ]
tests/py/inet/reject.t +1 -1
index 638f329cf4d5..7679407e6f8d 100644
@@ -16,7 +16,7 @@ reject with icmpv6 type admin-prohibited;ok;meta nfproto ipv6 reject with icmpv6
 reject with icmpv6 type addr-unreachable;ok;meta nfproto ipv6 reject with icmpv6 type addr-unreachable
 reject with icmpv6 type port-unreachable;ok;meta nfproto ipv6 reject
 
-reject with tcp reset;ok;meta l4proto 6 reject with tcp reset
+mark 12345 reject with tcp reset;ok;meta l4proto 6 mark 0x00003039 reject with tcp reset
 
 reject;ok
 meta nfproto ipv4 reject;ok
tests/py/inet/reject.t.payload.inet +3 -1
index 5770330d9072..7a6468e81f9e 100644
@@ -64,10 +64,12 @@ inet test-inet input
   [ cmp eq reg 1 0x0000000a ]
   [ reject type 0 code 4 ]
 
-# reject with tcp reset
+# mark 12345 reject with tcp reset
 inet test-inet input
   [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x00003039 ]
   [ reject type 1 code 0 ]
 
 # reject
tests/py/ip/reject.t +1 -0
index 6006f0541cb8..7befe697fa23 100644
@@ -10,6 +10,7 @@ reject with icmp type port-unreachable;ok;reject
 reject with icmp type net-prohibited;ok
 reject with icmp type host-prohibited;ok
 reject with icmp type admin-prohibited;ok
+mark 0x80000000 reject with tcp reset;ok
 
 reject with icmp type no-route;fail
 reject with icmpv6 type no-route;fail
tests/py/ip/reject.t.payload +8 -0
index d5e87665ebc5..ec94b4c1a1c5 100644
@@ -30,3 +30,11 @@ ip test-ip4 output
 ip test-ip4 output
   [ reject type 0 code 13 ]
 
+# mark 0x80000000 reject with tcp reset
+ip test-ip4 output
+  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x80000000 ]
+  [ reject type 1 code 0 ]
+
tests/py/ip6/reject.t +1 -1
index de09fd978418..a95f2e3fe14a 100644
@@ -9,7 +9,7 @@ reject with icmpv6 type addr-unreachable;ok
 reject with icmpv6 type port-unreachable;ok;reject
 reject with icmpv6 type policy-fail;ok
 reject with icmpv6 type reject-route;ok
-reject with tcp reset;ok
+mark 0x80000000 reject with tcp reset;ok
 
 reject with icmpv6 type host-unreachable;fail
 reject with icmp type host-unreachable;fail
tests/py/ip6/reject.t.payload.ip6 +3 -1
index 0ba5f7ee5bfd..dd4491ae47a8 100644
@@ -26,9 +26,11 @@ ip6 test-ip6 output
 ip6 test-ip6 output
   [ reject type 0 code 6 ]
 
-# reject with tcp reset
+# mark 0x80000000 reject with tcp reset
 ip6 test-ip6 output
   [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x80000000 ]
   [ reject type 1 code 0 ]
 
Signature · 1 line
2.10.2
#17 lore raw

Re: [PATCH nft 07/10] tests: add ip reject with tcp and check for mark too

Quoted 2 lines · Florian Westphal

... to avoid resetting e.g. the ssh session to the vm that runs nft-test.py.

Oh, this is breaking your testbed, right? OK, that's fine.

Quoted 137 lines
---
 tests/py/bridge/reject.t            | 2 +-
 tests/py/bridge/reject.t.payload    | 4 +++-
 tests/py/inet/reject.t              | 2 +-
 tests/py/inet/reject.t.payload.inet | 4 +++-
 tests/py/ip/reject.t                | 1 +
 tests/py/ip/reject.t.payload        | 8 ++++++++
 tests/py/ip6/reject.t               | 2 +-
 tests/py/ip6/reject.t.payload.ip6   | 4 +++-
 8 files changed, 21 insertions(+), 6 deletions(-)
tests/py/bridge/reject.t +1 -1
index 4fa6ac0b3278..67deac8d3b5e 100644
@@ -16,7 +16,7 @@ reject with icmpv6 type admin-prohibited;ok;ether type ip6 reject with icmpv6 ty
 reject with icmpv6 type addr-unreachable;ok;ether type ip6 reject with icmpv6 type addr-unreachable
 reject with icmpv6 type port-unreachable;ok;ether type ip6 reject
 
-ip protocol tcp reject with tcp reset;ok;ip protocol 6 reject with tcp reset
+mark 12345 ip protocol tcp reject with tcp reset;ok;mark 0x00003039 ip protocol 6 reject with tcp reset
 
 reject;ok
 ether type ip reject;ok
tests/py/bridge/reject.t.payload +3 -1
index f5a0e6a82963..b984f6f8de4d 100644
@@ -64,8 +64,10 @@ bridge test-bridge input
   [ cmp eq reg 1 0x0000dd86 ]
   [ reject type 0 code 4 ]
 
-# ip protocol tcp reject with tcp reset
+# mark 12345 ip protocol tcp reject with tcp reset
 bridge test-bridge input
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x00003039 ]
   [ payload load 2b @ link header + 12 => reg 1 ]
   [ cmp eq reg 1 0x00000008 ]
   [ payload load 1b @ network header + 9 => reg 1 ]
tests/py/inet/reject.t +1 -1
index 638f329cf4d5..7679407e6f8d 100644
@@ -16,7 +16,7 @@ reject with icmpv6 type admin-prohibited;ok;meta nfproto ipv6 reject with icmpv6
 reject with icmpv6 type addr-unreachable;ok;meta nfproto ipv6 reject with icmpv6 type addr-unreachable
 reject with icmpv6 type port-unreachable;ok;meta nfproto ipv6 reject
 
-reject with tcp reset;ok;meta l4proto 6 reject with tcp reset
+mark 12345 reject with tcp reset;ok;meta l4proto 6 mark 0x00003039 reject with tcp reset
 
 reject;ok
 meta nfproto ipv4 reject;ok
tests/py/inet/reject.t.payload.inet +3 -1
index 5770330d9072..7a6468e81f9e 100644
@@ -64,10 +64,12 @@ inet test-inet input
   [ cmp eq reg 1 0x0000000a ]
   [ reject type 0 code 4 ]
 
-# reject with tcp reset
+# mark 12345 reject with tcp reset
 inet test-inet input
   [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x00003039 ]
   [ reject type 1 code 0 ]
 
 # reject
tests/py/ip/reject.t +1 -0
index 6006f0541cb8..7befe697fa23 100644
@@ -10,6 +10,7 @@ reject with icmp type port-unreachable;ok;reject
 reject with icmp type net-prohibited;ok
 reject with icmp type host-prohibited;ok
 reject with icmp type admin-prohibited;ok
+mark 0x80000000 reject with tcp reset;ok
 
 reject with icmp type no-route;fail
 reject with icmpv6 type no-route;fail
tests/py/ip/reject.t.payload +8 -0
index d5e87665ebc5..ec94b4c1a1c5 100644
@@ -30,3 +30,11 @@ ip test-ip4 output
 ip test-ip4 output
   [ reject type 0 code 13 ]
 
+# mark 0x80000000 reject with tcp reset
+ip test-ip4 output
+  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ cmp eq reg 1 0x00000006 ]
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x80000000 ]
+  [ reject type 1 code 0 ]
+
tests/py/ip6/reject.t +1 -1
index de09fd978418..a95f2e3fe14a 100644
@@ -9,7 +9,7 @@ reject with icmpv6 type addr-unreachable;ok
 reject with icmpv6 type port-unreachable;ok;reject
 reject with icmpv6 type policy-fail;ok
 reject with icmpv6 type reject-route;ok
-reject with tcp reset;ok
+mark 0x80000000 reject with tcp reset;ok
 
 reject with icmpv6 type host-unreachable;fail
 reject with icmp type host-unreachable;fail
tests/py/ip6/reject.t.payload.ip6 +3 -1
index 0ba5f7ee5bfd..dd4491ae47a8 100644
@@ -26,9 +26,11 @@ ip6 test-ip6 output
 ip6 test-ip6 output
   [ reject type 0 code 6 ]
 
-# reject with tcp reset
+# mark 0x80000000 reject with tcp reset
 ip6 test-ip6 output
   [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
+  [ meta load mark => reg 1 ]
+  [ cmp eq reg 1 0x80000000 ]
   [ reject type 1 code 0 ]
 
Signature · 6 lines
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#18 lore raw

Re: [PATCH nft 07/10] tests: add ip reject with tcp and check for mark too

Quoted 5 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal

... to avoid resetting e.g. the ssh session to the vm that runs nft-test.py.

Oh, this is breaking your testbed, right? OK, that's fine.

Yes, the ssh session gets re-set during these tests.

author maintainer
#19 lore raw

PATCH 8/10 src: add a comment wrt. reject dependency insertion

In reply to Florian Westphal

at first I thought this was a bug but this in fact seems the right thing, add a comment/example why adding dependency as first statement makes sense.

---
 src/evaluate.c | 8 ++++++++
 1 file changed, 8 insertions(+)
src/evaluate.c +8 -0
index 1cfe7675162e..27cee98916db 100644
@@ -2015,6 +2015,14 @@ static int stmt_reject_gen_dependency(struct eval_ctx *ctx, struct stmt *stmt,
 	if (payload_gen_dependency(ctx, payload, &nstmt) < 0)
 		return -1;
 
+	/*
+	 * Unlike payload deps this adds the dependency at the beginning, i.e.
+	 * log ... reject with tcp-reset
+	 * turns into
+	 * meta l4proto tcp log ... reject with tcp-reset
+	 *
+	 * Otherwise we'd log things that won't be rejected.
+	 */
 	list_add(&nstmt->list, &ctx->rule->stmts);
 	return 0;
 }
Signature · 1 line
2.10.2
author maintainer
#20 lore raw

PATCH 9/10 src: ip: switch implicit dependencies to meta l4proto too

In reply to Florian Westphal

after ip6 nexthdr also switch ip to meta l4proto instead of ip protocol.

While its needed for ipv6 (due to extension headers) this isn't needed for ip but it has the advantage that

tcp dport 22

produces same expressions for ip/ip6/inet families.

---
 src/payload.c | 17 +++++++++++------
 src/proto.c   |  3 ++-
 2 files changed, 13 insertions(+), 7 deletions(-)
src/payload.c +11 -6
index 3a3fe8de97cf..5331b5832fd2 100644
@@ -118,17 +118,22 @@ static const struct expr_ops payload_expr_ops = {
 };
 
 /*
- * ipv6 is special case, we normally use 'meta l4proto' to fetch the last
- * l4 header of the ipv6 extension header chain so we will also match
+ * We normally use 'meta l4proto' to fetch the last l4 header of the
+ * ipv6 extension header chain so we will also match
  * tcp after a fragmentation header, for instance.
+ * For consistency we also use meta l4proto for ipv4.
  *
- * If user specifically asks for nexthdr x, treat is as a full
- * dependency rather than injecting another (useless) meta l4 one.
+ * If user specifically asks for nexthdr x, don't add another (useless)
+ * meta dependency.
  */
 static bool proto_key_is_protocol(const struct proto_desc *desc, unsigned int type)
 {
-	if (type == desc->protocol_key ||
-	    (desc == &proto_ip6 && type == IP6HDR_NEXTHDR))
+	if (type == desc->protocol_key)
+		return true;
+
+	if (desc == &proto_ip6 && type == IP6HDR_NEXTHDR)
+		return true;
+	if (desc == &proto_ip && type == IPHDR_PROTOCOL)
 		return true;
 
 	return false;
src/proto.c +2 -1
index 3b20a5fd35b1..2afedf773045 100644
@@ -587,7 +587,6 @@ const struct proto_desc proto_ip = {
 	.name		= "ip",
 	.base		= PROTO_BASE_NETWORK_HDR,
 	.checksum_key	= IPHDR_CHECKSUM,
-	.protocol_key	= IPHDR_PROTOCOL,
 	.protocols	= {
 		PROTO_LINK(IPPROTO_ICMP,	&proto_icmp),
 		PROTO_LINK(IPPROTO_ESP,		&proto_esp),
@@ -600,6 +599,7 @@ const struct proto_desc proto_ip = {
 		PROTO_LINK(IPPROTO_SCTP,	&proto_sctp),
 	},
 	.templates	= {
+		[0]	= PROTO_META_TEMPLATE("l4proto", &inet_protocol_type, NFT_META_L4PROTO, 8),
 		[IPHDR_VERSION]		= HDR_BITFIELD("version", &integer_type, 0, 4),
 		[IPHDR_HDRLENGTH]	= HDR_BITFIELD("hdrlength", &integer_type, 4, 4),
 		[IPHDR_DSCP]            = HDR_BITFIELD("dscp", &dscp_type, 8, 6),
@@ -779,6 +779,7 @@ const struct proto_desc proto_inet_service = {
 		PROTO_LINK(IPPROTO_TCP,		&proto_tcp),
 		PROTO_LINK(IPPROTO_DCCP,	&proto_dccp),
 		PROTO_LINK(IPPROTO_SCTP,	&proto_sctp),
+		PROTO_LINK(IPPROTO_ICMP,	&proto_icmp),
 		PROTO_LINK(IPPROTO_ICMPV6,	&proto_icmp6),
 	},
 	.templates	= {
Signature · 1 line
2.10.2
#21 lore raw

Re: [PATCH nft 09/10] src: ip: switch implicit dependencies to meta l4proto too

Quoted 8 lines · Florian Westphal

after ip6 nexthdr also switch ip to meta l4proto instead of ip protocol.

While its needed for ipv6 (due to extension headers) this isn't needed for ip but it has the advantage that

tcp dport 22

produces same expressions for ip/ip6/inet families.

Oh, this is coming later on... which is what I was asking before, patch order in this series is a bit confusing for review.

Another comment below.

Quoted 60 lines
---
 src/payload.c | 17 +++++++++++------
 src/proto.c   |  3 ++-
 2 files changed, 13 insertions(+), 7 deletions(-)
src/payload.c +11 -6
index 3a3fe8de97cf..5331b5832fd2 100644
@@ -118,17 +118,22 @@ static const struct expr_ops payload_expr_ops = {
 };
 
 /*
- * ipv6 is special case, we normally use 'meta l4proto' to fetch the last
- * l4 header of the ipv6 extension header chain so we will also match
+ * We normally use 'meta l4proto' to fetch the last l4 header of the
+ * ipv6 extension header chain so we will also match
  * tcp after a fragmentation header, for instance.
+ * For consistency we also use meta l4proto for ipv4.
  *
- * If user specifically asks for nexthdr x, treat is as a full
- * dependency rather than injecting another (useless) meta l4 one.
+ * If user specifically asks for nexthdr x, don't add another (useless)
+ * meta dependency.
  */
 static bool proto_key_is_protocol(const struct proto_desc *desc, unsigned int type)
 {
-	if (type == desc->protocol_key ||
-	    (desc == &proto_ip6 && type == IP6HDR_NEXTHDR))
+	if (type == desc->protocol_key)
+		return true;
+
+	if (desc == &proto_ip6 && type == IP6HDR_NEXTHDR)
+		return true;
+	if (desc == &proto_ip && type == IPHDR_PROTOCOL)
 		return true;
 
 	return false;
src/proto.c +1 -1
index 3b20a5fd35b1..2afedf773045 100644
@@ -587,7 +587,6 @@ const struct proto_desc proto_ip = {
 	.name		= "ip",
 	.base		= PROTO_BASE_NETWORK_HDR,
 	.checksum_key	= IPHDR_CHECKSUM,
-	.protocol_key	= IPHDR_PROTOCOL,
 	.protocols	= {
 		PROTO_LINK(IPPROTO_ICMP,	&proto_icmp),
 		PROTO_LINK(IPPROTO_ESP,		&proto_esp),
@@ -600,6 +599,7 @@ const struct proto_desc proto_ip = {
 		PROTO_LINK(IPPROTO_SCTP,	&proto_sctp),
 	},
 	.templates	= {
+		[0]	= PROTO_META_TEMPLATE("l4proto", &inet_protocol_type, NFT_META_L4PROTO, 8),
 		[IPHDR_VERSION]		= HDR_BITFIELD("version", &integer_type, 0, 4),
 		[IPHDR_HDRLENGTH]	= HDR_BITFIELD("hdrlength", &integer_type, 4, 4),
 		[IPHDR_DSCP]            = HDR_BITFIELD("dscp", &dscp_type, 8, 6),

src/proto.c const struct proto_desc proto_inet_service = { · line 783

Quoted 5 lines
src/proto.c +1 -0
@@ -779,6 +779,7 @@ const struct proto_desc proto_inet_service = {
 		PROTO_LINK(IPPROTO_TCP,		&proto_tcp),
 		PROTO_LINK(IPPROTO_DCCP,	&proto_dccp),
 		PROTO_LINK(IPPROTO_SCTP,	&proto_sctp),
+		PROTO_LINK(IPPROTO_ICMP,	&proto_icmp),
 		PROTO_LINK(IPPROTO_ICMPV6,	&proto_icmp6),

We have avoid adding ICMPv4 and ICMPv6 to proto_inet_service because of combinations like, IPv4 packet with ICMPv6 protocol should not match. Same with IPv6 packet with ICMPv4 protocol.

So Arturo came up with the patch to solve this:

commit 0011985554e269e1cc8f8e5b41eb9dcd795ebe8c

Author: Arturo Borrero Gonzalez <[email protected]>
Date:   Wed Jan 25 12:51:08 2017 +0100

payload: explicit network ctx assignment for icmp/icmp6 in special families

My concern here is that we should not match this invalid combination to allow fishy packets go through.

author maintainer
#22 lore raw

PATCH 10/10 tests: fix up meta l4proto change for ip family

In reply to Florian Westphal

We can delete some of the payload files now as ip/ip6/inet produce same implicit meta l4proto dep.

---
 tests/py/bridge/icmpX.t.payload                    |   4 +-
 tests/py/bridge/vlan.t.payload                     |   4 +-
 tests/py/bridge/vlan.t.payload.netdev              |   4 +-
 tests/py/inet/{ah.t.payload.inet => ah.t.payload}  |   0
 tests/py/inet/ah.t.payload.ip                      | 262 --------
 tests/py/inet/ah.t.payload.ip6                     | 262 --------
 tests/py/inet/ah.t.payload.netdev                  | 262 --------
 .../inet/{comp.t.payload.inet => comp.t.payload}   |   0
 tests/py/inet/comp.t.payload.ip                    | 145 -----
 tests/py/inet/comp.t.payload.ip6                   | 145 -----
 tests/py/inet/comp.t.payload.netdev                | 145 -----
 .../inet/{dccp.t.payload.inet => dccp.t.payload}   |   0
 tests/py/inet/dccp.t.payload.ip                    | 169 ------
 tests/py/inet/dccp.t.payload.ip6                   | 169 ------
 tests/py/inet/dccp.t.payload.netdev                | 169 ------
 .../py/inet/{esp.t.payload.inet => esp.t.payload}  |   0
 tests/py/inet/esp.t.payload.ip                     | 131 ----
 tests/py/inet/esp.t.payload.ip6                    | 131 ----
 tests/py/inet/esp.t.payload.netdev                 | 131 ----
 tests/py/inet/ether.t.payload.ip                   |   6 +-
 tests/py/inet/ether.t.payload.ip6                  |  55 --
 tests/py/inet/icmpX.t.payload                      |   4 +-
 tests/py/inet/{ip.t.payload.ip => ip.t.payload}    |   6 +-
 tests/py/inet/ip.t.payload.inet                    |   1 +
 .../py/inet/{map.t.payload.inet => map.t.payload}  |   0
 tests/py/inet/map.t.payload.ip                     |  12 +-
 tests/py/inet/map.t.payload.netdev                 |   2 +-
 .../inet/{sctp.t.payload.inet => sctp.t.payload}   |   0
 tests/py/inet/sctp.t.payload.ip                    | 276 ---------
 tests/py/inet/sctp.t.payload.ip6                   | 276 ---------
 tests/py/inet/sctp.t.payload.netdev                | 276 ---------
 .../py/inet/{tcp.t.payload.inet => tcp.t.payload}  |   0
 tests/py/inet/tcp.t.payload.ip                     | 661 --------------------
 tests/py/inet/tcp.t.payload.ip6                    | 661 --------------------
 tests/py/inet/tcp.t.payload.netdev                 | 669 ---------------------
 .../{tcpopt.t.payload.inet => tcpopt.t.payload}    |   0
 .../py/inet/{udp.t.payload.inet => udp.t.payload}  |   0
 tests/py/inet/udp.t.payload.ip                     | 330 ----------
 tests/py/inet/udp.t.payload.ip6                    | 330 ----------
 tests/py/inet/udp.t.payload.netdev                 | 331 ----------
 .../{udplite.t.payload.inet => udplite.t.payload}  |   0
 tests/py/inet/udplite.t.payload.ip                 | 240 --------
 tests/py/inet/udplite.t.payload.ip6                | 240 --------
 tests/py/inet/udplite.t.payload.netdev             | 240 --------
 tests/py/ip/dnat.t.payload.ip                      |  12 +-
 tests/py/ip/ether.t.payload                        |   6 +-
 tests/py/ip/icmp.t.payload.ip                      | 146 ++---
 tests/py/ip/masquerade.t.payload                   |  28 +-
 tests/py/ip/objects.t.payload                      |   6 +-
 tests/py/ip/redirect.t.payload                     |  44 +-
 tests/py/ip/reject.t.payload                       |   2 +-
 tests/py/ip/snat.t.payload                         |  10 +-
 tests/py/ip/tcp.t.payload                          |   2 +-
 tests/py/ip/tcpopt.t.payload                       |  52 +-
 54 files changed, 174 insertions(+), 6883 deletions(-)
 rename tests/py/inet/{ah.t.payload.inet => ah.t.payload} (100%)
 delete mode 100644 tests/py/inet/ah.t.payload.ip
 delete mode 100644 tests/py/inet/ah.t.payload.ip6
 delete mode 100644 tests/py/inet/ah.t.payload.netdev
 rename tests/py/inet/{comp.t.payload.inet => comp.t.payload} (100%)
 delete mode 100644 tests/py/inet/comp.t.payload.ip
 delete mode 100644 tests/py/inet/comp.t.payload.ip6
 delete mode 100644 tests/py/inet/comp.t.payload.netdev
 rename tests/py/inet/{dccp.t.payload.inet => dccp.t.payload} (100%)
 delete mode 100644 tests/py/inet/dccp.t.payload.ip
 delete mode 100644 tests/py/inet/dccp.t.payload.ip6
 delete mode 100644 tests/py/inet/dccp.t.payload.netdev
 rename tests/py/inet/{esp.t.payload.inet => esp.t.payload} (100%)
 delete mode 100644 tests/py/inet/esp.t.payload.ip
 delete mode 100644 tests/py/inet/esp.t.payload.ip6
 delete mode 100644 tests/py/inet/esp.t.payload.netdev
 delete mode 100644 tests/py/inet/ether.t.payload.ip6
 rename tests/py/inet/{ip.t.payload.ip => ip.t.payload} (86%)
 rename tests/py/inet/{map.t.payload.inet => map.t.payload} (100%)
 rename tests/py/inet/{sctp.t.payload.inet => sctp.t.payload} (100%)
 delete mode 100644 tests/py/inet/sctp.t.payload.ip
 delete mode 100644 tests/py/inet/sctp.t.payload.ip6
 delete mode 100644 tests/py/inet/sctp.t.payload.netdev
 rename tests/py/inet/{tcp.t.payload.inet => tcp.t.payload} (100%)
 delete mode 100644 tests/py/inet/tcp.t.payload.ip
 delete mode 100644 tests/py/inet/tcp.t.payload.ip6
 delete mode 100644 tests/py/inet/tcp.t.payload.netdev
 rename tests/py/inet/{tcpopt.t.payload.inet => tcpopt.t.payload} (100%)
 rename tests/py/inet/{udp.t.payload.inet => udp.t.payload} (100%)
 delete mode 100644 tests/py/inet/udp.t.payload.ip
 delete mode 100644 tests/py/inet/udp.t.payload.ip6
 delete mode 100644 tests/py/inet/udp.t.payload.netdev
 rename tests/py/inet/{udplite.t.payload.inet => udplite.t.payload} (100%)
 delete mode 100644 tests/py/inet/udplite.t.payload.ip
 delete mode 100644 tests/py/inet/udplite.t.payload.ip6
 delete mode 100644 tests/py/inet/udplite.t.payload.netdev
tests/py/bridge/icmpX.t.payload +1 -3
index b351f7b008b7..77e6a4fbf217 100644
@@ -9,9 +9,7 @@ bridge test-bridge input
 
 # icmp type echo-request
 bridge test-bridge input
-  [ payload load 2b @ link header + 12 => reg 1 ]
-  [ cmp eq reg 1 0x00000008 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000001 ]
   [ payload load 1b @ transport header + 0 => reg 1 ]
   [ cmp eq reg 1 0x00000008 ]
tests/py/bridge/vlan.t.payload +2 -2
index 5fce9c16cd9d..cb0e812f8ec3 100644
@@ -134,7 +134,7 @@ bridge test-bridge input
   [ payload load 4b @ network header + 12 => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x00feffff ) ^ 0x00000000 ]
   [ cmp eq reg 1 0x0000000a ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -151,7 +151,7 @@ bridge test-bridge input
   [ payload load 4b @ network header + 12 => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x00feffff ) ^ 0x00000000 ]
   [ cmp eq reg 1 0x0000000a ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
tests/py/bridge/vlan.t.payload.netdev +2 -2
index 45ea2251c934..c57955ec7394 100644
@@ -160,7 +160,7 @@ netdev test-netdev ingress
   [ payload load 4b @ network header + 12 => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x00feffff ) ^ 0x00000000 ]
   [ cmp eq reg 1 0x0000000a ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -179,7 +179,7 @@ netdev test-netdev ingress
   [ payload load 4b @ network header + 12 => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x00feffff ) ^ 0x00000000 ]
   [ cmp eq reg 1 0x0000000a ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
tests/py/inet/ah.t.payload renamed from tests/py/inet/ah.t.payload.inet +0 -0
similarity index 100%
rename from tests/py/inet/ah.t.payload.inet
rename to tests/py/inet/ah.t.payload
tests/py/inet/ah.t.payload.ip deleted +0 -0
deleted file mode 100644
index 594c949ff927..000000000000
tests/py/inet/ah.t.payload.ip6 deleted +0 -0
deleted file mode 100644
index 4d5df6368da4..000000000000
tests/py/inet/ah.t.payload.netdev deleted +0 -0
deleted file mode 100644
index af150969ad87..000000000000
tests/py/inet/comp.t.payload renamed from tests/py/inet/comp.t.payload.inet +0 -0
similarity index 100%
rename from tests/py/inet/comp.t.payload.inet
rename to tests/py/inet/comp.t.payload
tests/py/inet/comp.t.payload.ip deleted +0 -0
deleted file mode 100644
index 9a6194e3bee6..000000000000
tests/py/inet/comp.t.payload.ip6 deleted +0 -0
deleted file mode 100644
index 3048d822d3f7..000000000000
tests/py/inet/comp.t.payload.netdev deleted +0 -0
deleted file mode 100644
index dec38aea6c5a..000000000000
tests/py/inet/dccp.t.payload renamed from tests/py/inet/dccp.t.payload.inet +0 -0
similarity index 100%
rename from tests/py/inet/dccp.t.payload.inet
rename to tests/py/inet/dccp.t.payload
tests/py/inet/dccp.t.payload.ip deleted +0 -0
deleted file mode 100644
index b8844c573904..000000000000
tests/py/inet/dccp.t.payload.ip6 deleted +0 -0
deleted file mode 100644
index 0fa441043a7a..000000000000
tests/py/inet/dccp.t.payload.netdev deleted +0 -0
deleted file mode 100644
index 313693163dca..000000000000
tests/py/inet/esp.t.payload renamed from tests/py/inet/esp.t.payload.inet +0 -0
similarity index 100%
rename from tests/py/inet/esp.t.payload.inet
rename to tests/py/inet/esp.t.payload
tests/py/inet/esp.t.payload.ip deleted +0 -0
deleted file mode 100644
index f8ef9ec830f6..000000000000
tests/py/inet/esp.t.payload.ip6 deleted +0 -0
deleted file mode 100644
index a9ed233c8f5d..000000000000
tests/py/inet/esp.t.payload.netdev deleted +0 -0
deleted file mode 100644
index ad68530be19a..000000000000
tests/py/inet/ether.t.payload.ip +3 -3
index 2d33f0cecbe9..196930fd8ff5 100644
@@ -1,6 +1,6 @@
 # tcp dport 22 iiftype ether ether saddr 00:0f:54:0c:11:4 meta nfproto ipv4 accept
 ip test-ip4 input
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
@@ -14,7 +14,7 @@ ip test-ip4 input
 
 # tcp dport 22 iiftype ether ether saddr 00:0f:54:0c:11:4 accept
 ip test-ip4 input
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
@@ -26,7 +26,7 @@ ip test-ip4 input
 
 # tcp dport 22 ether saddr 00:0f:54:0c:11:04 accept
 ip test-ip4 input
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
tests/py/inet/ether.t.payload.ip6 deleted +0 -0
deleted file mode 100644
index a3a8905e6372..000000000000
tests/py/inet/icmpX.t.payload +1 -3
index 4df15d7fb28c..e951066aa0d6 100644
@@ -9,9 +9,7 @@ inet test-inet input
 
 # icmp type echo-request
 inet test-inet input
-  [ meta load nfproto => reg 1 ]
-  [ cmp eq reg 1 0x00000002 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000001 ]
   [ payload load 1b @ transport header + 0 => reg 1 ]
   [ cmp eq reg 1 0x00000008 ]
tests/py/inet/ip.t.payload renamed from tests/py/inet/ip.t.payload.ip +3 -3
similarity index 86%
rename from tests/py/inet/ip.t.payload.ip
rename to tests/py/inet/ip.t.payload
index f0ef38bcfc33..589a5cd35a80 100644
@@ -1,8 +1,8 @@
 # ip saddr . ip daddr . ether saddr { 1.1.1.1 . 2.2.2.2 . ca:fe:ca:fe:ca:fe }
-__set%d test-ip4 3
-__set%d test-ip4 0
+__set%d test-inet 3
+__set%d test-inet 0
 	element 01010101 02020202 fecafeca 0000feca  : 0 [end]
-ip test-ip4 input
+inet test-ip input
   [ meta load iiftype => reg 1 ]
   [ cmp eq reg 1 0x00000001 ]
   [ payload load 4b @ network header + 12 => reg 1 ]
tests/py/inet/ip.t.payload.inet +1 -0
index e926d03a8e7a..8df41defea0a 100644
@@ -11,3 +11,4 @@ inet test-inet input
   [ payload load 4b @ network header + 16 => reg 9 ]
   [ payload load 6b @ link header + 6 => reg 10 ]
   [ lookup reg 1 set __set%d ]
+
tests/py/inet/map.t.payload renamed from tests/py/inet/map.t.payload.inet +0 -0
similarity index 100%
rename from tests/py/inet/map.t.payload.inet
rename to tests/py/inet/map.t.payload
tests/py/inet/map.t.payload.ip +6 -6
index dfd571d5ec45..595757496d9f 100644
@@ -1,8 +1,8 @@
 # mark set ip saddr map { 10.2.3.2 : 0x0000002a, 10.2.3.1 : 0x00000017}
-__map%d test-ip b
-__map%d test-ip 0
-	element 0103020a  : 00000017 0 [end]	element 0203020a  : 0000002a 0 [end]
-ip test-ip input
+__map%d test-ip4 b
+__map%d test-ip4 0
+	element 0203020a  : 0000002a 0 [end]	element 0103020a  : 00000017 0 [end]
+ip test-ip4 input 
   [ payload load 4b @ network header + 12 => reg 1 ]
   [ lookup reg 1 set __map%d dreg 1 ]
   [ meta set mark with reg 1 ]
@@ -10,8 +10,8 @@ ip test-ip input
 # mark set ip hdrlength map { 5 : 0x00000017, 4 : 0x00000001}
 __map%d test-ip4 b
 __map%d test-ip4 0
-	element 00000004  : 00000001 0 [end]	element 00000005  : 00000017 0 [end]
-ip test-ip4 input
+	element 00000005  : 00000017 0 [end]	element 00000004  : 00000001 0 [end]
+ip test-ip4 input 
   [ payload load 1b @ network header + 0 => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x0000000f ) ^ 0x00000000 ]
   [ lookup reg 1 set __map%d dreg 1 ]
tests/py/inet/map.t.payload.netdev +1 -1
index 1457c5daa574..501fb8eec478 100644
@@ -1,7 +1,7 @@
 # mark set ip saddr map { 10.2.3.2 : 0x0000002a, 10.2.3.1 : 0x00000017}
 __map%d test-netdev b
 __map%d test-netdev 0
-	element 0103020a  : 00000017 0 [end]	element 0203020a  : 0000002a 0 [end]
+	element 0203020a  : 0000002a 0 [end]	element 0103020a  : 00000017 0 [end]
 netdev test-netdev ingress
   [ meta load protocol => reg 1 ]
   [ cmp eq reg 1 0x00000008 ]
tests/py/inet/sctp.t.payload renamed from tests/py/inet/sctp.t.payload.inet +0 -0
similarity index 100%
rename from tests/py/inet/sctp.t.payload.inet
rename to tests/py/inet/sctp.t.payload
tests/py/inet/sctp.t.payload.ip deleted +0 -0
deleted file mode 100644
index 4d8a7246fb04..000000000000
tests/py/inet/sctp.t.payload.ip6 deleted +0 -0
deleted file mode 100644
index 9775804d55ef..000000000000
tests/py/inet/sctp.t.payload.netdev deleted +0 -0
deleted file mode 100644
index ecfcc7252a06..000000000000
tests/py/inet/tcp.t.payload renamed from tests/py/inet/tcp.t.payload.inet +0 -0
similarity index 100%
rename from tests/py/inet/tcp.t.payload.inet
rename to tests/py/inet/tcp.t.payload
tests/py/inet/tcp.t.payload.ip deleted +0 -0
deleted file mode 100644
index 79fd500aef37..000000000000
tests/py/inet/tcp.t.payload.ip6 deleted +0 -0
deleted file mode 100644
index a335f594cbc2..000000000000
tests/py/inet/tcp.t.payload.netdev deleted +0 -0
deleted file mode 100644
index dbf4b131ea45..000000000000
tests/py/inet/tcpopt.t.payload renamed from tests/py/inet/tcpopt.t.payload.inet +0 -0
similarity index 100%
rename from tests/py/inet/tcpopt.t.payload.inet
rename to tests/py/inet/tcpopt.t.payload
tests/py/inet/udp.t.payload renamed from tests/py/inet/udp.t.payload.inet +0 -0
similarity index 100%
rename from tests/py/inet/udp.t.payload.inet
rename to tests/py/inet/udp.t.payload
tests/py/inet/udp.t.payload.ip deleted +0 -0
deleted file mode 100644
index d49fc513ab66..000000000000
tests/py/inet/udp.t.payload.ip6 deleted +0 -0
deleted file mode 100644
index 8edcff4faa29..000000000000
tests/py/inet/udp.t.payload.netdev deleted +0 -0
deleted file mode 100644
index ab0f51a499d8..000000000000
tests/py/inet/udplite.t.payload renamed from tests/py/inet/udplite.t.payload.inet +0 -0
similarity index 100%
rename from tests/py/inet/udplite.t.payload.inet
rename to tests/py/inet/udplite.t.payload
tests/py/inet/udplite.t.payload.ip deleted +0 -0
deleted file mode 100644
index c1ecc9d57e7a..000000000000
tests/py/inet/udplite.t.payload.ip6 deleted +0 -0
deleted file mode 100644
index d2f032e905e0..000000000000
tests/py/inet/udplite.t.payload.netdev deleted +0 -0
deleted file mode 100644
index 565935a27e90..000000000000
tests/py/ip/dnat.t.payload.ip +6 -6
index 7a7f5a82dd5a..1b869d0a002e 100644
@@ -2,7 +2,7 @@
 ip test-ip4 prerouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp gte reg 1 0x00005000 ]
@@ -14,7 +14,7 @@ ip test-ip4 prerouting
 ip test-ip4 prerouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ range neq reg 1 0x00005000 0x00005a00 ]
@@ -28,7 +28,7 @@ __set%d test-ip4 0
 ip test-ip4 prerouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -42,7 +42,7 @@ __set%d test-ip4 0
 ip test-ip4 prerouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
@@ -53,7 +53,7 @@ ip test-ip4 prerouting
 ip test-ip4 prerouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ range neq reg 1 0x00001700 0x00002200 ]
@@ -64,7 +64,7 @@ ip test-ip4 prerouting
 ip test-ip4 prerouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00005100 ]
tests/py/ip/ether.t.payload +3 -3
index 0d234dab1a5b..bd7c8f150632 100644
@@ -1,6 +1,6 @@
 # tcp dport 22 iiftype ether ip daddr 1.2.3.4 ether saddr 00:0f:54:0c:11:4 accept
 ip test-ip input
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
@@ -14,7 +14,7 @@ ip test-ip input
 
 # tcp dport 22 ether saddr 00:0f:54:0c:11:04 ip daddr 1.2.3.4
 ip test-ip input
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
@@ -27,7 +27,7 @@ ip test-ip input
 
 # tcp dport 22 ip daddr 1.2.3.4 ether saddr 00:0f:54:0c:11:04
 ip test-ip input
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
tests/py/ip/icmp.t.payload.ip +73 -73

583 lines not on this page · raw message

tests/py/ip/masquerade.t.payload +14 -14
index ad0ea518ed53..43ac7f70648a 100644
@@ -1,6 +1,6 @@
 # udp dport 53 masquerade
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -8,7 +8,7 @@ ip test-ip4 postrouting
 
 # udp dport 53 masquerade random
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -16,7 +16,7 @@ ip test-ip4 postrouting
 
 # udp dport 53 masquerade random,persistent
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -24,7 +24,7 @@ ip test-ip4 postrouting
 
 # udp dport 53 masquerade random,persistent,fully-random
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -32,7 +32,7 @@ ip test-ip4 postrouting
 
 # udp dport 53 masquerade random,fully-random
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -40,7 +40,7 @@ ip test-ip4 postrouting
 
 # udp dport 53 masquerade random,fully-random,persistent
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -48,7 +48,7 @@ ip test-ip4 postrouting
 
 # udp dport 53 masquerade persistent
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -56,7 +56,7 @@ ip test-ip4 postrouting
 
 # udp dport 53 masquerade persistent,random
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -64,7 +64,7 @@ ip test-ip4 postrouting
 
 # udp dport 53 masquerade persistent,random,fully-random
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -72,7 +72,7 @@ ip test-ip4 postrouting
 
 # udp dport 53 masquerade persistent,fully-random
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -80,7 +80,7 @@ ip test-ip4 postrouting
 
 # udp dport 53 masquerade persistent,fully-random,random
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -91,7 +91,7 @@ __set%d test-ip4 3
 __set%d test-ip4 0
 	element 00000100  : 0 [end]	element 00000200  : 0 [end]	element 00000300  : 0 [end]	element 00000400  : 0 [end]	element 00000500  : 0 [end]	element 00000600  : 0 [end]	element 00000700  : 0 [end]	element 00000800  : 0 [end]	element 00006500  : 0 [end]	element 0000ca00  : 0 [end]	element 00002f01  : 0 [end]	element 0000e903  : 0 [end]	element 0000d207  : 0 [end]	element 0000bb0b  : 0 [end]
 ip test-ip4 postrouting
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -102,7 +102,7 @@ ip test-ip4 postrouting
   [ payload load 4b @ network header + 16 => reg 1 ]
   [ cmp gte reg 1 0x0000000a ]
   [ cmp lte reg 1 0x0403020a ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00003500 ]
@@ -119,7 +119,7 @@ ip test-ip4 postrouting
   [ ct load state => reg 1 ]
   [ bitwise reg 1 = (reg=1 & 0x0000000a ) ^ 0x00000000 ]
   [ cmp neq reg 1 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __map%d dreg 0 ]
tests/py/ip/objects.t.payload +3 -3
index 6499d36348fe..7f16c5ac599e 100644
@@ -9,7 +9,7 @@ __objmap%d test-ip4 43
 __objmap%d test-ip4 0
 	element 0000bb01  : 0 [end]	element 00005000  : 0 [end]	element 00001600  : 0 [end]
 ip test-ip4 output 
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ objref sreg 1 set __objmap%d id 1 ]
@@ -25,7 +25,7 @@ __objmap%d test-ip4 43
 __objmap%d test-ip4 0
 	element 0000bb01  : 0 [end]	element 00005000  : 0 [end]	element 00001600  : 0 [end]
 ip test-ip4 output 
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ objref sreg 1 set __objmap%d id 1 ]
@@ -39,7 +39,7 @@ __objmap%d test-ip4 43
 __objmap%d test-ip4 0
         element 00001500  : 0 [end]     element 00004908  : 0 [end]
 ip test-ip4 output
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ objref sreg 1 set __objmap%d id 1 ]
tests/py/ip/redirect.t.payload +22 -22

175 lines not on this page · raw message

tests/py/ip/reject.t.payload +1 -1
index ec94b4c1a1c5..07e4cc8d71a0 100644
@@ -32,7 +32,7 @@ ip test-ip4 output
 
 # mark 0x80000000 reject with tcp reset
 ip test-ip4 output
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ meta load mark => reg 1 ]
   [ cmp eq reg 1 0x80000000 ]
tests/py/ip/snat.t.payload +5 -5
index 25a505c2112a..789933ffd650 100644
@@ -2,7 +2,7 @@
 ip test-ip4 postrouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp gte reg 1 0x00005000 ]
@@ -14,7 +14,7 @@ ip test-ip4 postrouting
 ip test-ip4 postrouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ range neq reg 1 0x00005000 0x00005a00 ]
@@ -28,7 +28,7 @@ __set%d test-ip4 0
 ip test-ip4 postrouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d ]
@@ -42,7 +42,7 @@ __set%d test-ip4 0
 ip test-ip4 postrouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ lookup reg 1 set __set%d 0x1 ]
@@ -53,7 +53,7 @@ ip test-ip4 postrouting
 ip test-ip4 postrouting
   [ meta load iifname => reg 1 ]
   [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000006 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ range neq reg 1 0x00001700 0x00002200 ]
tests/py/ip/tcp.t.payload +1 -1
index ed0dcc8481ee..58956d984b1b 100644
@@ -10,7 +10,7 @@ ip test-ip input
 ip test-ip input
   [ payload load 1b @ network header + 9 => reg 1 ]
   [ cmp neq reg 1 0x00000006 ]
-  [ payload load 1b @ network header + 9 => reg 1 ]
+  [ meta load l4proto => reg 1 ]
   [ cmp eq reg 1 0x00000011 ]
   [ payload load 2b @ transport header + 2 => reg 1 ]
   [ cmp eq reg 1 0x00001600 ]
tests/py/ip/tcpopt.t.payload +26 -26

207 lines not on this page · raw message

Signature · 1 line
2.10.2