Skip to contentSkip to conversation

switch l4 dependency to meta l4proto

PATCH In review Florian Westphal 2 participants 9 messages May 19, 2017 – May 23, 2017 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

v3 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'. Both are fine. The ip6 family however uses 'ip6 nexthdr', and thats a problem because e.g. tcp dport 22 will not match packets that use ipv6 extension headers.

The series switches both ipv6 and ipv4 to use meta l4 instead so ipv6 will always check the last transport header value.

We could ignore ip as only ipv6 uses extension headers. However, switching ipv4 as well makes things a bit simpler because nft then creates the same l4 dependency for all families.

author maintainer
#1 lore raw

PATCH v3 1/7 payload: split ll proto dependency into helper

will be re-used in folloup patch for icmp/icmpv6 depenency handling.

---
patch was not part of earlier series.

 src/payload.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)
src/payload.c +18 -11
index 55128fee1498..31e5a0244837 100644
@@ -224,21 +224,28 @@ static int payload_add_dependency(struct eval_ctx *ctx,
 }
 
 static const struct proto_desc *
+payload_get_get_ll_hdr(const struct eval_ctx *ctx)
+{
+	switch (ctx->pctx.family) {
+	case NFPROTO_INET:
+		return &proto_inet;
+	case NFPROTO_BRIDGE:
+		return &proto_eth;
+	case NFPROTO_NETDEV:
+		return &proto_netdev;
+	default:
+		break;
+	}
+
+	return NULL;
+}
+
+static const struct proto_desc *
 payload_gen_special_dependency(struct eval_ctx *ctx, const struct expr *expr)
 {
 	switch (expr->payload.base) {
 	case PROTO_BASE_LL_HDR:
-		switch (ctx->pctx.family) {
-		case NFPROTO_INET:
-			return &proto_inet;
-		case NFPROTO_BRIDGE:
-			return &proto_eth;
-		case NFPROTO_NETDEV:
-			return &proto_netdev;
-		default:
-			break;
-		}
-		break;
+		return payload_get_get_ll_hdr(ctx);
 	case PROTO_BASE_TRANSPORT_HDR:
 		if (expr->payload.desc == &proto_icmp)
 			return &proto_ip;
Signature · 1 line
2.13.0
author maintainer
#2 lore raw

PATCH v3 2/7 src: allow update of net base w. meta l4proto icmpv6

In reply to 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.

---
Change since last version:
- add test in same patch.

 src/proto.c                 | 1 +
 tests/py/any/meta.t         | 1 +
 tests/py/any/meta.t.payload | 7 +++++++
 3 files changed, 9 insertions(+)
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),
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.13.0
author maintainer
#3 lore raw

PATCH v3 3/7 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.

Only problem:

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, to avoid this add a small helper that skips the unneded meta dependency in that case.

---
Change since v2: collapsed two patches from v2 into this one, no other changes.

 src/payload.c | 19 ++++++++++++++++++-
 src/proto.c   |  2 +-
 2 files changed, 19 insertions(+), 2 deletions(-)
src/payload.c +18 -1
index 31e5a0244837..38db15ee2664 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;
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.13.0
author maintainer
#4 lore raw

PATCH v3 4/7 payload: enforce ip/ip6 protocol depending on icmp or icmpv6

In reply to Florian Westphal

After some discussion with Pablo we agreed to treat icmp/icmpv6 specially.

in the case of a rule like 'tcp dport 22' the inet, bridge and netdev families only care about the lower layer protocol.

In the icmpv6 case however we'd like to also enforce an ipv6 protocol check (and ipv4 check in icmp case).

This extends payload_gen_special_dependency() to consider this. With this patch:

add rule $pf filter input meta l4proto icmpv6
add rule $pf filter input meta l4proto icmpv6 icmpv6 type echo-request add rule $pf filter input icmpv6 type echo-request

will work in all tables and all families.
For inet/bridge/netdev, an ipv6 protocol dependency is added; this will not match ipv4 packets with ip->protocol == icmpv6, EXCEPT in the case of the ip family.

Its still possible to match icmpv6-in-ipv4 in inet/bridge/netdev with an explicit dependency:

add rule inet f i ip protocol ipv6-icmp meta l4proto ipv6-icmp icmpv6 type ...

Implicit dependencies won't get removed at the moment, so
bridge ... icmp type echo-request
will be shown as
ether type ip meta l4proto 1 icmp type echo-request

---
Patch was not part of v2

 src/payload.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)
src/payload.c +23 -4
index 38db15ee2664..8796ee57fd4c 100644
@@ -264,10 +264,29 @@ payload_gen_special_dependency(struct eval_ctx *ctx, const struct expr *expr)
 	case PROTO_BASE_LL_HDR:
 		return payload_get_get_ll_hdr(ctx);
 	case PROTO_BASE_TRANSPORT_HDR:
-		if (expr->payload.desc == &proto_icmp)
-			return &proto_ip;
-		if (expr->payload.desc == &proto_icmp6)
-			return &proto_ip6;
+		if (expr->payload.desc == &proto_icmp ||
+		    expr->payload.desc == &proto_icmp6) {
+			const struct proto_desc *desc, *desc_upper;
+			struct stmt *nstmt;
+
+			desc = ctx->pctx.protocol[PROTO_BASE_LL_HDR].desc;
+			if (!desc) {
+				desc = payload_get_get_ll_hdr(ctx);
+				if (!desc)
+					break;
+			}
+
+			desc_upper = &proto_ip6;
+			if (expr->payload.desc == &proto_icmp)
+				desc_upper = &proto_ip;
+
+			if (payload_add_dependency(ctx, desc, desc_upper,
+						   expr, &nstmt) < 0)
+				return NULL;
+
+			list_add_tail(&nstmt->list, &ctx->stmt->list);
+			return desc_upper;
+		}
 		return &proto_inet_service;
 	default:
 		break;
Signature · 1 line
2.13.0
author maintainer
#5 lore raw

PATCH v3 5/7 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.

---
Change since v2: alter test cases to keep
ipv6 dependencies in the icmpv6 tests.

 tests/py/bridge/icmpX.t               |   2 +-
 tests/py/bridge/icmpX.t.payload       |   2 +-
 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                 |   2 +-
 tests/py/inet/icmpX.t.payload         |   2 +-
 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 ++++++------
 21 files changed, 391 insertions(+), 391 deletions(-)
tests/py/bridge/icmpX.t +1 -1
index 8c0a59799871..5c76c0f70bd0 100644
@@ -5,4 +5,4 @@
 ip protocol icmp icmp type echo-request;ok;icmp type echo-request
 icmp type echo-request;ok
 ip6 nexthdr icmpv6 icmpv6 type echo-request;ok;icmpv6 type echo-request
-icmpv6 type echo-request;ok
+icmpv6 type echo-request;ok;ether type ip6 meta l4proto 58 icmpv6 type echo-request
tests/py/bridge/icmpX.t.payload +1 -1
index 19efdd85c43b..548cdaa56d82 100644
@@ -29,7 +29,7 @@ bridge test-bridge input
 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 +1 -1
index 1b467a18e764..b95f58c499eb 100644
@@ -5,4 +5,4 @@
 ip protocol icmp icmp type echo-request;ok;icmp type echo-request
 icmp type echo-request;ok
 ip6 nexthdr icmpv6 icmpv6 type echo-request;ok;icmpv6 type echo-request
-icmpv6 type echo-request;ok
+icmpv6 type echo-request;ok;meta nfproto ipv6 meta l4proto 58 icmpv6 type echo-request
tests/py/inet/icmpX.t.payload +1 -1
index 81ca7744c4e4..2ff5b0ec36d6 100644
@@ -29,7 +29,7 @@ inet test-inet input
 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 7426310154f0..dd4491ae47a8 100644
@@ -28,7 +28,7 @@ ip6 test-ip6 output
 
 # mark 0x80000000 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 ]
   [ meta load mark => reg 1 ]
   [ cmp eq reg 1 0x80000000 ]
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

100 lines not on this page · raw message

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

Signature · 1 line
2.13.0

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

author maintainer
#6 lore raw

PATCH v3 6/7 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.

---
No changes since v2.

 src/payload.c | 17 +++++++++++------
 src/proto.c   |  3 ++-
 2 files changed, 13 insertions(+), 7 deletions(-)
src/payload.c +11 -6
index 8796ee57fd4c..11b6df37313c 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.13.0
author maintainer
#7 lore raw

PATCH v3 7/7 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.

---
changes since v2: keep icmp ipv4 dependencies in the inet/bridge/netdev families.

 tests/py/bridge/icmpX.t                            |   2 +-
 tests/py/bridge/icmpX.t.payload                    |   2 +-
 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                              |   2 +-
 tests/py/inet/icmpX.t.payload                      |   2 +-
 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 +-
 56 files changed, 176 insertions(+), 6881 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 +1 -1
index 5c76c0f70bd0..0a1019c3a309 100644
@@ -3,6 +3,6 @@
 *bridge;test-bridge;input
 
 ip protocol icmp icmp type echo-request;ok;icmp type echo-request
-icmp type echo-request;ok
+icmp type echo-request;ok;ether type ip meta l4proto 1 icmp type echo-request
 ip6 nexthdr icmpv6 icmpv6 type echo-request;ok;icmpv6 type echo-request
 icmpv6 type echo-request;ok;ether type ip6 meta l4proto 58 icmpv6 type echo-request
tests/py/bridge/icmpX.t.payload +1 -1
index 548cdaa56d82..0fab1abf61ea 100644
@@ -11,7 +11,7 @@ bridge test-bridge input
 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 -262

262 lines not on this page · raw message

tests/py/inet/ah.t.payload.ip6 deleted +0 -262

262 lines not on this page · raw message

tests/py/inet/ah.t.payload.netdev deleted +0 -262

262 lines not on this page · raw message

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 -145

145 lines not on this page · raw message

tests/py/inet/comp.t.payload.ip6 deleted +0 -145

145 lines not on this page · raw message

tests/py/inet/comp.t.payload.netdev deleted +0 -145

145 lines not on this page · raw message

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 -169

169 lines not on this page · raw message

tests/py/inet/dccp.t.payload.ip6 deleted +0 -169

169 lines not on this page · raw message

tests/py/inet/dccp.t.payload.netdev deleted +0 -169

169 lines not on this page · raw message

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 -131

131 lines not on this page · raw message

tests/py/inet/esp.t.payload.ip6 deleted +0 -131

131 lines not on this page · raw message

tests/py/inet/esp.t.payload.netdev deleted +0 -131

131 lines not on this page · raw message

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 -55

55 lines not on this page · raw message

tests/py/inet/icmpX.t +1 -1
index b95f58c499eb..7617e701a6d7 100644
@@ -3,6 +3,6 @@
 *inet;test-inet;input
 
 ip protocol icmp icmp type echo-request;ok;icmp type echo-request
-icmp type echo-request;ok
+icmp type echo-request;ok;meta nfproto ipv4 meta l4proto 1 icmp type echo-request
 ip6 nexthdr icmpv6 icmpv6 type echo-request;ok;icmpv6 type echo-request
 icmpv6 type echo-request;ok;meta nfproto ipv6 meta l4proto 58 icmpv6 type echo-request
tests/py/inet/icmpX.t.payload +1 -1
index 2ff5b0ec36d6..7c5f6f011d11 100644
@@ -11,7 +11,7 @@ inet test-inet input
 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 -276

276 lines not on this page · raw message

tests/py/inet/sctp.t.payload.ip6 deleted +0 -276

276 lines not on this page · raw message

tests/py/inet/sctp.t.payload.netdev deleted +0 -276

142 lines not on this page · raw message

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 -661

661 lines not on this page · raw message

tests/py/inet/tcp.t.payload.ip6 deleted +0 -661

661 lines not on this page · raw message

tests/py/inet/tcp.t.payload.netdev deleted +0 -669

669 lines not on this page · raw message

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 -330

330 lines not on this page · raw message

tests/py/inet/udp.t.payload.ip6 deleted +0 -330

330 lines not on this page · raw message

tests/py/inet/udp.t.payload.netdev deleted +0 -331

331 lines not on this page · raw message

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 -240

240 lines not on this page · raw message

tests/py/inet/udplite.t.payload.ip6 deleted +0 -240

240 lines not on this page · raw message

tests/py/inet/udplite.t.payload.netdev deleted +0 -240

240 lines not on this page · raw message

tests/py/ip/dnat.t.payload.ip +6 -6
index 7a7f5a82dd5a..1b869d0a002e 100644

Lines of this file are not shown. View the raw message.

tests/py/ip/ether.t.payload +3 -3
index 0d234dab1a5b..bd7c8f150632 100644

Lines of this file are not shown. View the raw message.

tests/py/ip/icmp.t.payload.ip +73 -73

146 lines not on this page · raw message

tests/py/ip/masquerade.t.payload +14 -14
index ad0ea518ed53..43ac7f70648a 100644

Lines of this file are not shown. View the raw message.

tests/py/ip/objects.t.payload +3 -3
index 6499d36348fe..7f16c5ac599e 100644

Lines of this file are not shown. View the raw message.

tests/py/ip/redirect.t.payload +22 -22

44 lines not on this page · raw message

tests/py/ip/reject.t.payload +1 -1
index ec94b4c1a1c5..07e4cc8d71a0 100644

Lines of this file are not shown. View the raw message.

tests/py/ip/snat.t.payload +5 -5
index 25a505c2112a..789933ffd650 100644

Lines of this file are not shown. View the raw message.

tests/py/ip/tcp.t.payload +1 -1
index ed0dcc8481ee..58956d984b1b 100644

Lines of this file are not shown. View the raw message.

tests/py/ip/tcpopt.t.payload +26 -26

52 lines not on this page · raw message

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

Signature · 1 line
2.13.0

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

maintainer Acked-by on the v3 series
#8 lore raw
In reply to Florian Westphal
Quoted 8 lines · Florian Westphal

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'. Both are fine. The ip6 family however uses 'ip6 nexthdr', and thats a problem because e.g. tcp dport 22 will not match packets that use ipv6 extension headers.

Quoted 6 lines

The series switches both ipv6 and ipv4 to use meta l4 instead so ipv6 will always check the last transport header value.

We could ignore ip as only ipv6 uses extension headers. However, switching ipv4 as well makes things a bit simpler because nft then creates the same l4 dependency for all families.

Thanks Florian.