]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfrm: Convert struct xfrm_dst_lookup_params -> tos to dscp_t.
authorGuillaume Nault <gnault@redhat.com>
Thu, 31 Oct 2024 15:52:57 +0000 (16:52 +0100)
committerSteffen Klassert <steffen.klassert@secunet.com>
Wed, 6 Nov 2024 11:42:51 +0000 (12:42 +0100)
Add type annotation to the "tos" field of struct xfrm_dst_lookup_params,
to ensure that the ECN bits aren't mistakenly taken into account when
doing route lookups. Rename that field (tos -> dscp) to make that
change explicit.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
include/net/xfrm.h
net/ipv4/xfrm4_policy.c
net/xfrm/xfrm_policy.c

index 2b87999bd5aae37c4f2d5be69794b316d45b2173..32c09e85a64ce229c1cf1bda88d49f04e0813df5 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <net/sock.h>
 #include <net/dst.h>
+#include <net/inet_dscp.h>
 #include <net/ip.h>
 #include <net/route.h>
 #include <net/ipv6.h>
@@ -354,7 +355,7 @@ void xfrm_if_unregister_cb(void);
 
 struct xfrm_dst_lookup_params {
        struct net *net;
-       int tos;
+       dscp_t dscp;
        int oif;
        xfrm_address_t *saddr;
        xfrm_address_t *daddr;
index 7e1c2faed1ff9931b599107955fa24a7d284d734..7fb6205619e740bc793440ac34b34f74a9e0bb01 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/inetdevice.h>
 #include <net/dst.h>
 #include <net/xfrm.h>
+#include <net/inet_dscp.h>
 #include <net/ip.h>
 #include <net/l3mdev.h>
 
@@ -24,7 +25,7 @@ static struct dst_entry *__xfrm4_dst_lookup(struct flowi4 *fl4,
 
        memset(fl4, 0, sizeof(*fl4));
        fl4->daddr = params->daddr->a4;
-       fl4->flowi4_tos = params->tos;
+       fl4->flowi4_tos = inet_dscp_to_dsfield(params->dscp);
        fl4->flowi4_l3mdev = l3mdev_master_ifindex_by_index(params->net,
                                                            params->oif);
        fl4->flowi4_mark = params->mark;
index 7e3e10fb9ca0186b9f4a5c0ffed787ddfbb03e69..4408c11c0835f96aa7f1749797e4b725dd7c147b 100644 (file)
@@ -312,7 +312,7 @@ static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x,
        params.net = net;
        params.saddr = saddr;
        params.daddr = daddr;
-       params.tos = inet_dscp_to_dsfield(dscp);
+       params.dscp = dscp;
        params.oif = oif;
        params.mark = mark;
        params.ipproto = x->id.proto;