Skip to content

Commit e57dfaa

Browse files
Guillaume Naultklassert
authored andcommitted
xfrm: Convert struct xfrm_dst_lookup_params -> tos to dscp_t.
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>
1 parent 3021a2a commit e57dfaa

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

include/net/xfrm.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <net/sock.h>
2121
#include <net/dst.h>
22+
#include <net/inet_dscp.h>
2223
#include <net/ip.h>
2324
#include <net/route.h>
2425
#include <net/ipv6.h>
@@ -354,7 +355,7 @@ void xfrm_if_unregister_cb(void);
354355

355356
struct xfrm_dst_lookup_params {
356357
struct net *net;
357-
int tos;
358+
dscp_t dscp;
358359
int oif;
359360
xfrm_address_t *saddr;
360361
xfrm_address_t *daddr;

net/ipv4/xfrm4_policy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/inetdevice.h>
1515
#include <net/dst.h>
1616
#include <net/xfrm.h>
17+
#include <net/inet_dscp.h>
1718
#include <net/ip.h>
1819
#include <net/l3mdev.h>
1920

@@ -24,7 +25,7 @@ static struct dst_entry *__xfrm4_dst_lookup(struct flowi4 *fl4,
2425

2526
memset(fl4, 0, sizeof(*fl4));
2627
fl4->daddr = params->daddr->a4;
27-
fl4->flowi4_tos = params->tos;
28+
fl4->flowi4_tos = inet_dscp_to_dsfield(params->dscp);
2829
fl4->flowi4_l3mdev = l3mdev_master_ifindex_by_index(params->net,
2930
params->oif);
3031
fl4->flowi4_mark = params->mark;

net/xfrm/xfrm_policy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x,
312312
params.net = net;
313313
params.saddr = saddr;
314314
params.daddr = daddr;
315-
params.tos = inet_dscp_to_dsfield(dscp);
315+
params.dscp = dscp;
316316
params.oif = oif;
317317
params.mark = mark;
318318
params.ipproto = x->id.proto;

0 commit comments

Comments
 (0)