[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6069820d4452ed34b153c03da3a6ea52c279bda7.1728982714.git.gnault@redhat.com>
Date: Tue, 15 Oct 2024 11:11:46 +0200
From: Guillaume Nault <gnault@...hat.com>
To: David Miller <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>
Cc: netdev@...r.kernel.org, Steffen Klassert <steffen.klassert@...unet.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
David Ahern <dsahern@...nel.org>, Ido Schimmel <idosch@...dia.com>
Subject: [PATCH net-next 6/6] xfrm: Convert __xfrm4_dst_lookup() to dscp_t.
Pass a dscp_t variable to __xfrm4_dst_lookup(), instead of an int, to
prevent accidental setting of ECN bits in ->flowi4_tos.
Callers of __xfrm4_dst_lookup() to consider are:
* xfrm4_dst_lookup(), which already has a dscp_t variable to pass as
parameter. We just need to remove the inet_dscp_to_dsfield()
conversion.
* xfrm4_get_saddr(). This function sets the tos parameter to 0, which
is already a valid dscp_t value, so it doesn't need to be adjusted
for the new prototype.
Signed-off-by: Guillaume Nault <gnault@...hat.com>
---
net/ipv4/xfrm4_policy.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 342a0158da91..b1968ae756c9 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -18,8 +18,9 @@
#include <net/ip.h>
#include <net/l3mdev.h>
-static struct dst_entry *__xfrm4_dst_lookup(struct net *net, struct flowi4 *fl4,
- int tos, int oif,
+static struct dst_entry *__xfrm4_dst_lookup(struct net *net,
+ struct flowi4 *fl4, dscp_t dscp,
+ int oif,
const xfrm_address_t *saddr,
const xfrm_address_t *daddr,
u32 mark)
@@ -28,7 +29,7 @@ static struct dst_entry *__xfrm4_dst_lookup(struct net *net, struct flowi4 *fl4,
memset(fl4, 0, sizeof(*fl4));
fl4->daddr = daddr->a4;
- fl4->flowi4_tos = tos;
+ fl4->flowi4_tos = inet_dscp_to_dsfield(dscp);
fl4->flowi4_l3mdev = l3mdev_master_ifindex_by_index(net, oif);
fl4->flowi4_mark = mark;
if (saddr)
@@ -48,8 +49,7 @@ static struct dst_entry *xfrm4_dst_lookup(struct net *net, dscp_t dscp,
{
struct flowi4 fl4;
- return __xfrm4_dst_lookup(net, &fl4, inet_dscp_to_dsfield(dscp), oif,
- saddr, daddr, mark);
+ return __xfrm4_dst_lookup(net, &fl4, dscp, oif, saddr, daddr, mark);
}
static int xfrm4_get_saddr(struct net *net, int oif,
--
2.39.2
Powered by blists - more mailing lists