Skip to content

Commit 3021a2a

Browse files
Guillaume Naultklassert
authored andcommitted
xfrm: Convert xfrm_dst_lookup() to dscp_t.
Pass a dscp_t variable to xfrm_dst_lookup(), instead of an int, to prevent accidental setting of ECN bits in ->flowi4_tos. Only xfrm_bundle_create() actually calls xfrm_dst_lookup(). Since it already has a dscp_t variable to pass as parameter, we only need to remove the inet_dscp_to_dsfield() conversion. 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 01f61cb commit 3021a2a

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

net/xfrm/xfrm_policy.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ struct dst_entry *__xfrm_dst_lookup(int family,
289289
EXPORT_SYMBOL(__xfrm_dst_lookup);
290290

291291
static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x,
292-
int tos, int oif,
292+
dscp_t dscp, int oif,
293293
xfrm_address_t *prev_saddr,
294294
xfrm_address_t *prev_daddr,
295295
int family, u32 mark)
@@ -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 = tos;
315+
params.tos = inet_dscp_to_dsfield(dscp);
316316
params.oif = oif;
317317
params.mark = mark;
318318
params.ipproto = x->id.proto;
@@ -2732,9 +2732,8 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
27322732
family = xfrm[i]->props.family;
27332733

27342734
oif = fl->flowi_oif ? : fl->flowi_l3mdev;
2735-
dst = xfrm_dst_lookup(xfrm[i],
2736-
inet_dscp_to_dsfield(dscp), oif,
2737-
&saddr, &daddr, family, mark);
2735+
dst = xfrm_dst_lookup(xfrm[i], dscp, oif, &saddr,
2736+
&daddr, family, mark);
27382737
err = PTR_ERR(dst);
27392738
if (IS_ERR(dst))
27402739
goto put_states;

0 commit comments

Comments
 (0)