Skip to contentSkip to conversation

Unmask upper DSCP bits - part 1

PATCH Applied Ido Schimmel 5 participants 28 messages Aug 21, 2024 – Aug 23, 2024

Subsystems (7)
lore
Share & tools
lore

Ido Schimmel

author maintainer
#0 lore raw

cover Unmask upper DSCP bits - part 1

tl;dr - This patchset starts to unmask the upper DSCP bits in the IPv4 flow key in preparation for allowing IPv4 FIB rules to match on DSCP. No functional changes are expected.

The TOS field in the IPv4 flow key ('flowi4_tos') is used during FIB lookup to match against the TOS selector in FIB rules and routes.

It is currently impossible for user space to configure FIB rules that match on the DSCP value as the upper DSCP bits are either masked in the various call sites that initialize the IPv4 flow key or along the path to the FIB core.

In preparation for adding a DSCP selector to IPv4 and IPv6 FIB rules, we need to make sure the entire DSCP value is present in the IPv4 flow key. This patchset starts to unmask the upper DSCP bits in the various places that invoke the core FIB lookup functions directly (patches #1-#7) and in the input route path (patches #8-#12). Future patchsets will do the same in the output route path.

No functional changes are expected as commit 1fa3314c14c6 ("ipv4:
Centralize TOS matching") moved the masking of the upper DSCP bits to the core where 'flowi4_tos' is matched against the TOS selector.

Ido Schimmel (12):
bpf: Unmask upper DSCP bits in bpf_fib_lookup() helper
ipv4: Unmask upper DSCP bits in NETLINK_FIB_LOOKUP family
ipv4: Unmask upper DSCP bits when constructing the Record Route option
netfilter: rpfilter: Unmask upper DSCP bits
netfilter: nft_fib: Unmask upper DSCP bits
ipv4: ipmr: Unmask upper DSCP bits in ipmr_rt_fib_lookup()
ipv4: Unmask upper DSCP bits in fib_compute_spec_dst()
ipv4: Unmask upper DSCP bits in input route lookup
ipv4: Unmask upper DSCP bits in RTM_GETROUTE input route lookup
ipv4: icmp: Pass full DS field to ip_route_input()
ipv4: udp: Unmask upper DSCP bits during early demux
ipv4: Unmask upper DSCP bits when using hints

 net/core/filter.c                 | 3 ++-
 net/ipv4/fib_frontend.c           | 4 ++--
 net/ipv4/icmp.c                   | 2 +-
 net/ipv4/ipmr.c                   | 3 ++-
 net/ipv4/netfilter/ipt_rpfilter.c | 3 ++-
 net/ipv4/netfilter/nft_fib_ipv4.c | 3 ++-
 net/ipv4/route.c                  | 8 ++++----
 net/ipv4/udp.c                    | 3 ++-
 8 files changed, 17 insertions(+), 12 deletions(-)
Signature · 1 line
2.46.0
author maintainer
#1 lore raw

PATCH 1/12 bpf: Unmask upper DSCP bits in bpf_fib_lookup() helper

The helper performs a FIB lookup according to the parameters in the 'params' argument, one of which is 'tos'. According to the test in test_tc_neigh_fib.c, it seems that BPF programs are expected to initialize the 'tos' field to the full 8 bit DS field from the IPv4 header.

Unmask the upper DSCP bits before invoking the IPv4 FIB lookup APIs so that in the future the lookup could be performed according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/core/filter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/filter.c +2 -1
index f3c72cf86099..89f56fac48fb 100644
@@ -84,6 +84,7 @@
 #include <net/netkit.h>
 #include <linux/un.h>
 #include <net/xdp_sock_drv.h>
+#include <net/inet_dscp.h>
 
 #include "dev.h"
 
@@ -5899,7 +5900,7 @@ static int bpf_ipv4_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
 		fl4.flowi4_iif = params->ifindex;
 		fl4.flowi4_oif = 0;
 	}
-	fl4.flowi4_tos = params->tos & IPTOS_RT_MASK;
+	fl4.flowi4_tos = params->tos & INET_DSCP_MASK;
 	fl4.flowi4_scope = RT_SCOPE_UNIVERSE;
 	fl4.flowi4_flags = 0;
 
Signature · 1 line
2.46.0
Reviewed-by on v1 1/12
#2 lore raw

Re: [PATCH net-next 01/12] bpf: Unmask upper DSCP bits in bpf_fib_lookup() helper

Quoted 3 lines · Ido Schimmel

Unmask the upper DSCP bits before invoking the IPv4 FIB lookup APIs so that in the future the lookup could be performed according to the full DSCP value.

author maintainer
#3 lore raw

PATCH 2/12 ipv4: Unmask upper DSCP bits in NETLINK_FIB_LOOKUP family

In reply to Ido Schimmel

The NETLINK_FIB_LOOKUP netlink family can be used to perform a FIB lookup according to user provided parameters and communicate the result back to user space.

Unmask the upper DSCP bits of the user-provided DS field before invoking the IPv4 FIB lookup API so that in the future the lookup could be performed according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/ipv4/fib_frontend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fib_frontend.c +1 -1
index da540ddb7af6..8b740f575da1 100644
@@ -1343,7 +1343,7 @@ static void nl_fib_lookup(struct net *net, struct fib_result_nl *frn)
 	struct flowi4           fl4 = {
 		.flowi4_mark = frn->fl_mark,
 		.daddr = frn->fl_addr,
-		.flowi4_tos = frn->fl_tos & IPTOS_RT_MASK,
+		.flowi4_tos = frn->fl_tos & INET_DSCP_MASK,
 		.flowi4_scope = frn->fl_scope,
 	};
 	struct fib_table *tb;
Signature · 1 line
2.46.0
Reviewed-by on v1 2/12
#4 lore raw

Re: [PATCH net-next 02/12] ipv4: Unmask upper DSCP bits in NETLINK_FIB_LOOKUP family

Quoted 3 lines · Ido Schimmel

Unmask the upper DSCP bits of the user-provided DS field before invoking the IPv4 FIB lookup API so that in the future the lookup could be performed according to the full DSCP value.

author maintainer
#5 lore raw

PATCH 3/12 ipv4: Unmask upper DSCP bits when constructing the Record Route option

In reply to Ido Schimmel

The Record Route IP option records the addresses of the routers that routed the packet. In the case of forwarded packets, the kernel performs a route lookup via fib_lookup() and fills in the preferred source address of the matched route.

Unmask the upper DSCP bits when performing the lookup so that in the future the lookup could be performed according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/route.c +1 -1
index 13c0f1d455f3..9b6528b7b562 100644
@@ -1263,7 +1263,7 @@ void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt)
 		struct flowi4 fl4 = {
 			.daddr = iph->daddr,
 			.saddr = iph->saddr,
-			.flowi4_tos = iph->tos & IPTOS_RT_MASK,
+			.flowi4_tos = iph->tos & INET_DSCP_MASK,
 			.flowi4_oif = rt->dst.dev->ifindex,
 			.flowi4_iif = skb->dev->ifindex,
 			.flowi4_mark = skb->mark,
Signature · 1 line
2.46.0
Reviewed-by on v1 3/12
#6 lore raw

Re: [PATCH net-next 03/12] ipv4: Unmask upper DSCP bits when constructing the Record Route option

Quoted 2 lines · Ido Schimmel

Unmask the upper DSCP bits when performing the lookup so that in the future the lookup could be performed according to the full DSCP value.

author maintainer
#7 lore raw

PATCH 4/12 netfilter: rpfilter: Unmask upper DSCP bits

In reply to Ido Schimmel

The rpfilter match performs a reverse path filter test on a packet by performing a FIB lookup with the source and destination addresses swapped.

Unmask the upper DSCP bits of the DS field of the tested packet so that in the future the FIB lookup could be performed according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/ipv4/netfilter/ipt_rpfilter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/netfilter/ipt_rpfilter.c +2 -1
index ded5bef02f77..1ce7a1655b97 100644
@@ -8,6 +8,7 @@
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
+#include <net/inet_dscp.h>
 #include <linux/ip.h>
 #include <net/ip.h>
 #include <net/ip_fib.h>
@@ -75,7 +76,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par)
 	flow.daddr = iph->saddr;
 	flow.saddr = rpfilter_get_saddr(iph->daddr);
 	flow.flowi4_mark = info->flags & XT_RPFILTER_VALID_MARK ? skb->mark : 0;
-	flow.flowi4_tos = iph->tos & IPTOS_RT_MASK;
+	flow.flowi4_tos = iph->tos & INET_DSCP_MASK;
 	flow.flowi4_scope = RT_SCOPE_UNIVERSE;
 	flow.flowi4_l3mdev = l3mdev_master_ifindex_rcu(xt_in(par));
 	flow.flowi4_uid = sock_net_uid(xt_net(par), NULL);
Signature · 1 line
2.46.0
Reviewed-by on v1 4/12
#8 lore raw

Re: [PATCH net-next 04/12] netfilter: rpfilter: Unmask upper DSCP bits

Quoted 7 lines · Ido Schimmel

The rpfilter match performs a reverse path filter test on a packet by performing a FIB lookup with the source and destination addresses swapped.

Unmask the upper DSCP bits of the DS field of the tested packet so that in the future the FIB lookup could be performed according to the full DSCP value.

author maintainer
#9 lore raw

PATCH 5/12 netfilter: nft_fib: Unmask upper DSCP bits

In reply to Ido Schimmel

In a similar fashion to the iptables rpfilter match, unmask the upper DSCP bits of the DS field of the currently tested packet so that in the future the FIB lookup could be performed according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/ipv4/netfilter/nft_fib_ipv4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/netfilter/nft_fib_ipv4.c +2 -1
index df94bc28c3d7..00da1332bbf1 100644
@@ -10,6 +10,7 @@
 #include <net/netfilter/nf_tables.h>
 #include <net/netfilter/nft_fib.h>
 
+#include <net/inet_dscp.h>
 #include <net/ip_fib.h>
 #include <net/route.h>
 
@@ -108,7 +109,7 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
 	if (priv->flags & NFTA_FIB_F_MARK)
 		fl4.flowi4_mark = pkt->skb->mark;
 
-	fl4.flowi4_tos = iph->tos & IPTOS_RT_MASK;
+	fl4.flowi4_tos = iph->tos & INET_DSCP_MASK;
 
 	if (priv->flags & NFTA_FIB_F_DADDR) {
 		fl4.daddr = iph->daddr;
Signature · 1 line
2.46.0
Reviewed-by on v1 5/12
#10 lore raw

Re: [PATCH net-next 05/12] netfilter: nft_fib: Unmask upper DSCP bits

Quoted 4 lines · Ido Schimmel

In a similar fashion to the iptables rpfilter match, unmask the upper DSCP bits of the DS field of the currently tested packet so that in the future the FIB lookup could be performed according to the full DSCP value.

author maintainer
#11 lore raw

PATCH 6/12 ipv4: ipmr: Unmask upper DSCP bits in ipmr_rt_fib_lookup()

In reply to Ido Schimmel

Unmask the upper DSCP bits when calling ipmr_fib_lookup() so that in the future it could perform the FIB lookup according to the full DSCP value.

Note that ipmr_fib_lookup() performs a FIB rule lookup (returning the relevant routing table) and that IPv4 multicast FIB rules do not support matching on TOS / DSCP. However, it is still worth unmasking the upper DSCP bits in case support for DSCP matching is ever added.

---
 net/ipv4/ipmr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/ipmr.c +2 -1
index 6c750bd13dd8..d5295b69bc0a 100644
@@ -62,6 +62,7 @@
 #include <net/fib_rules.h>
 #include <linux/netconf.h>
 #include <net/rtnh.h>
+#include <net/inet_dscp.h>
 
 #include <linux/nospec.h>
 
@@ -2080,7 +2081,7 @@ static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct sk_buff *skb)
 	struct flowi4 fl4 = {
 		.daddr = iph->daddr,
 		.saddr = iph->saddr,
-		.flowi4_tos = RT_TOS(iph->tos),
+		.flowi4_tos = iph->tos & INET_DSCP_MASK,
 		.flowi4_oif = (rt_is_output_route(rt) ?
 			       skb->dev->ifindex : 0),
 		.flowi4_iif = (rt_is_output_route(rt) ?
Signature · 1 line
2.46.0
Reviewed-by on v1 6/12
#12 lore raw

Re: [PATCH net-next 06/12] ipv4: ipmr: Unmask upper DSCP bits in ipmr_rt_fib_lookup()

Quoted 7 lines · Ido Schimmel

Unmask the upper DSCP bits when calling ipmr_fib_lookup() so that in the future it could perform the FIB lookup according to the full DSCP value.

Note that ipmr_fib_lookup() performs a FIB rule lookup (returning the relevant routing table) and that IPv4 multicast FIB rules do not support matching on TOS / DSCP. However, it is still worth unmasking the upper DSCP bits in case support for DSCP matching is ever added.

Indeed,

author maintainer
#13 lore raw

PATCH 7/12 ipv4: Unmask upper DSCP bits in fib_compute_spec_dst()

In reply to Ido Schimmel

As explained in commit 35ebf65e851c ("ipv4: Create and use fib_compute_spec_dst() helper."), the function is used - for example - to determine the source address for an ICMP reply. If we are responding to a multicast or broadcast packet, the source address is set to the source address that we would use if we were to send a packet to the unicast source of the original packet. This address is determined by performing a FIB lookup and using the preferred source address of the resulting route.

Unmask the upper DSCP bits of the DS field of the packet that triggered the reply so that in the future the FIB lookup could be performed according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/ipv4/fib_frontend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fib_frontend.c +1 -1
index 8b740f575da1..793e6781399a 100644
@@ -293,7 +293,7 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb)
 			.flowi4_iif = LOOPBACK_IFINDEX,
 			.flowi4_l3mdev = l3mdev_master_ifindex_rcu(dev),
 			.daddr = ip_hdr(skb)->saddr,
-			.flowi4_tos = ip_hdr(skb)->tos & IPTOS_RT_MASK,
+			.flowi4_tos = ip_hdr(skb)->tos & INET_DSCP_MASK,
 			.flowi4_scope = scope,
 			.flowi4_mark = vmark ? skb->mark : 0,
 		};
Signature · 1 line
2.46.0
Reviewed-by on v1 7/12
#14 lore raw

Re: [PATCH net-next 07/12] ipv4: Unmask upper DSCP bits in fib_compute_spec_dst()

Quoted 3 lines · Ido Schimmel

Unmask the upper DSCP bits of the DS field of the packet that triggered the reply so that in the future the FIB lookup could be performed according to the full DSCP value.

author maintainer
#15 lore raw

PATCH 8/12 ipv4: Unmask upper DSCP bits in input route lookup

In reply to Ido Schimmel

Unmask the upper DSCP bits in input route lookup so that in the future the lookup could be performed according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/route.c +1 -1
index 9b6528b7b562..73bb61162445 100644
@@ -2470,7 +2470,7 @@ int ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 	struct fib_result res;
 	int err;
 
-	tos &= IPTOS_RT_MASK;
+	tos &= INET_DSCP_MASK;
 	rcu_read_lock();
 	err = ip_route_input_rcu(skb, daddr, saddr, tos, dev, &res);
 	rcu_read_unlock();
Signature · 1 line
2.46.0
Reviewed-by on v1 8/12
#16 lore raw

Re: [PATCH net-next 08/12] ipv4: Unmask upper DSCP bits in input route lookup

Quoted 2 lines · Ido Schimmel

Unmask the upper DSCP bits in input route lookup so that in the future the lookup could be performed according to the full DSCP value.

author maintainer
#17 lore raw

PATCH 9/12 ipv4: Unmask upper DSCP bits in RTM_GETROUTE input route lookup

In reply to Ido Schimmel

Unmask the upper DSCP bits when looking up an input route via the RTM_GETROUTE netlink message so that in the future the lookup could be performed according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/route.c +1 -1
index 73bb61162445..524b70ab77a0 100644
@@ -3286,7 +3286,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 		skb->dev	= dev;
 		skb->mark	= mark;
 		err = ip_route_input_rcu(skb, dst, src,
-					 rtm->rtm_tos & IPTOS_RT_MASK, dev,
+					 rtm->rtm_tos & INET_DSCP_MASK, dev,
 					 &res);
 
 		rt = skb_rtable(skb);
Signature · 1 line
2.46.0
Reviewed-by on v1 9/12
#18 lore raw

Re: [PATCH net-next 09/12] ipv4: Unmask upper DSCP bits in RTM_GETROUTE input route lookup

Quoted 3 lines · Ido Schimmel

Unmask the upper DSCP bits when looking up an input route via the RTM_GETROUTE netlink message so that in the future the lookup could be performed according to the full DSCP value.

author maintainer
#19 lore raw

PATCH 10/12 ipv4: icmp: Pass full DS field to ip_route_input()

In reply to Ido Schimmel

Align the ICMP code to other callers of ip_route_input() and pass the full DS field. In the future this will allow us to perform a route lookup according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/ipv4/icmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/icmp.c +1 -1
index ab6d0d98dbc3..b8f56d03fcbb 100644
@@ -545,7 +545,7 @@ static struct rtable *icmp_route_lookup(struct net *net,
 		orefdst = skb_in->_skb_refdst; /* save old refdst */
 		skb_dst_set(skb_in, NULL);
 		err = ip_route_input(skb_in, fl4_dec.daddr, fl4_dec.saddr,
-				     RT_TOS(tos), rt2->dst.dev);
+				     tos, rt2->dst.dev);
 
 		dst_release(&rt2->dst);
 		rt2 = skb_rtable(skb_in);
Signature · 1 line
2.46.0
Reviewed-by on v1 10/12
#20 lore raw

Re: [PATCH net-next 10/12] ipv4: icmp: Pass full DS field to ip_route_input()

Quoted 3 lines · Ido Schimmel

Align the ICMP code to other callers of ip_route_input() and pass the full DS field. In the future this will allow us to perform a route lookup according to the full DSCP value.

author maintainer
#21 lore raw

PATCH 11/12 ipv4: udp: Unmask upper DSCP bits during early demux

In reply to Ido Schimmel

Unmask the upper DSCP bits when performing source validation for multicast packets during early demux. In the future, this will allow us to perform the FIB lookup which is performed as part of source validation according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/ipv4/udp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/udp.c +2 -1
index ddb86baaea6c..8accbf4cb295 100644
@@ -115,6 +115,7 @@
 #include <net/addrconf.h>
 #include <net/udp_tunnel.h>
 #include <net/gro.h>
+#include <net/inet_dscp.h>
 #if IS_ENABLED(CONFIG_IPV6)
 #include <net/ipv6_stubs.h>
 #endif
@@ -2618,7 +2619,7 @@ int udp_v4_early_demux(struct sk_buff *skb)
 		if (!inet_sk(sk)->inet_daddr && in_dev)
 			return ip_mc_validate_source(skb, iph->daddr,
 						     iph->saddr,
-						     iph->tos & IPTOS_RT_MASK,
+						     iph->tos & INET_DSCP_MASK,
 						     skb->dev, in_dev, &itag);
 	}
 	return 0;
Signature · 1 line
2.46.0
Reviewed-by on v1 11/12
#22 lore raw

Re: [PATCH net-next 11/12] ipv4: udp: Unmask upper DSCP bits during early demux

Quoted 4 lines · Ido Schimmel

Unmask the upper DSCP bits when performing source validation for multicast packets during early demux. In the future, this will allow us to perform the FIB lookup which is performed as part of source validation according to the full DSCP value.

author maintainer
#23 lore raw

PATCH 12/12 ipv4: Unmask upper DSCP bits when using hints

In reply to Ido Schimmel

Unmask the upper DSCP bits when performing source validation and routing a packet using the same route from a previously processed packet (hint). In the future, this will allow us to perform the FIB lookup that is performed as part of source validation according to the full DSCP value.

No functional changes intended since the upper DSCP bits are masked when comparing against the TOS selectors in FIB rules and routes.

---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/route.c +1 -1
index 524b70ab77a0..f6972b24664a 100644
@@ -2160,7 +2160,7 @@ int ip_route_use_hint(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 	if (rt->rt_type != RTN_LOCAL)
 		goto skip_validate_source;
 
-	tos &= IPTOS_RT_MASK;
+	tos &= INET_DSCP_MASK;
 	err = fib_validate_source(skb, saddr, daddr, tos, 0, dev, in_dev, &tag);
 	if (err < 0)
 		goto martian_source;
Signature · 1 line
2.46.0
Reviewed-by on v1 12/12
#24 lore raw

Re: [PATCH net-next 12/12] ipv4: Unmask upper DSCP bits when using hints

Quoted 4 lines · Ido Schimmel

Unmask the upper DSCP bits when performing source validation and routing a packet using the same route from a previously processed packet (hint). In the future, this will allow us to perform the FIB lookup that is performed as part of source validation according to the full DSCP value.

maintainer Reviewed-by on the v1 series
#26 lore raw
In reply to Ido Schimmel
Quoted 19 lines · Ido Schimmel

tl;dr - This patchset starts to unmask the upper DSCP bits in the IPv4 flow key in preparation for allowing IPv4 FIB rules to match on DSCP. No functional changes are expected.

The TOS field in the IPv4 flow key ('flowi4_tos') is used during FIB lookup to match against the TOS selector in FIB rules and routes.

It is currently impossible for user space to configure FIB rules that match on the DSCP value as the upper DSCP bits are either masked in the various call sites that initialize the IPv4 flow key or along the path to the FIB core.

In preparation for adding a DSCP selector to IPv4 and IPv6 FIB rules, we need to make sure the entire DSCP value is present in the IPv4 flow key. This patchset starts to unmask the upper DSCP bits in the various places that invoke the core FIB lookup functions directly (patches #1-#7) and in the input route path (patches #8-#12). Future patchsets will do the same in the output route path.

Quoted 4 lines

No functional changes are expected as commit 1fa3314c14c6 ("ipv4:
Centralize TOS matching") moved the masking of the upper DSCP bits to the core where 'flowi4_tos' is matched against the TOS selector.

for the set:

#27 lore raw
In reply to Ido Schimmel
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 21 Aug 2024 15:52:39 +0300 you wrote:

tl;dr - This patchset starts to unmask the upper DSCP bits in the IPv4 flow key in preparation for allowing IPv4 FIB rules to match on DSCP. No functional changes are expected.

The TOS field in the IPv4 flow key ('flowi4_tos') is used during FIB lookup to match against the TOS selector in FIB rules and routes.

[...]

Here is the summary with links:
- [net-next,01/12] bpf: Unmask upper DSCP bits in bpf_fib_lookup() helper

    https://git.kernel.org/netdev/net-next/c/ef434fae7228
  - [net-next,02/12] ipv4: Unmask upper DSCP bits in NETLINK_FIB_LOOKUP family
    https://git.kernel.org/netdev/net-next/c/bc52a4eecefd
  - [net-next,03/12] ipv4: Unmask upper DSCP bits when constructing the Record Route option
    https://git.kernel.org/netdev/net-next/c/be2e9089cb34
  - [net-next,04/12] netfilter: rpfilter: Unmask upper DSCP bits
    https://git.kernel.org/netdev/net-next/c/c1ae5ca69b69
  - [net-next,05/12] netfilter: nft_fib: Unmask upper DSCP bits
    https://git.kernel.org/netdev/net-next/c/338385e059c5
  - [net-next,06/12] ipv4: ipmr: Unmask upper DSCP bits in ipmr_rt_fib_lookup()
    https://git.kernel.org/netdev/net-next/c/2bc9778b6696
  - [net-next,07/12] ipv4: Unmask upper DSCP bits in fib_compute_spec_dst()
    https://git.kernel.org/netdev/net-next/c/39d3628f7cea
  - [net-next,08/12] ipv4: Unmask upper DSCP bits in input route lookup
    https://git.kernel.org/netdev/net-next/c/df9131c7fafd
  - [net-next,09/12] ipv4: Unmask upper DSCP bits in RTM_GETROUTE input route lookup
    https://git.kernel.org/netdev/net-next/c/b1251a6f1a9b
  - [net-next,10/12] ipv4: icmp: Pass full DS field to ip_route_input()
    https://git.kernel.org/netdev/net-next/c/1c6f50b37f71
  - [net-next,11/12] ipv4: udp: Unmask upper DSCP bits during early demux
    https://git.kernel.org/netdev/net-next/c/b6791ac5ea49
  - [net-next,12/12] ipv4: Unmask upper DSCP bits when using hints
    https://git.kernel.org/netdev/net-next/c/be8b8ded7799

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html