Merge branch 'xfrm: Convert __xfrm4_dst_lookup() and its callers to dscp_t.'
Guillaume Nault says: ==================== This patch series continues to prepare users of ->flowi4_tos to a future conversion of this field (__u8 to dscp_t). This time, we convert __xfrm4_dst_lookup() and its call chain. The objective is to eventually make all users of ->flowi4_tos use a dscp_t value. Making ->flowi4_tos a dscp_t field will help avoiding regressions where ECN bits are erroneously interpreted as DSCP bits. ==================== Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
+2
-1
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -289,7 +289,7 @@ struct dst_entry *__xfrm_dst_lookup(int family,
|
||||
EXPORT_SYMBOL(__xfrm_dst_lookup);
|
||||
|
||||
static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x,
|
||||
int tos, int oif,
|
||||
dscp_t dscp, int oif,
|
||||
xfrm_address_t *prev_saddr,
|
||||
xfrm_address_t *prev_daddr,
|
||||
int family, u32 mark)
|
||||
@@ -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 = tos;
|
||||
params.dscp = dscp;
|
||||
params.oif = oif;
|
||||
params.mark = mark;
|
||||
params.ipproto = x->id.proto;
|
||||
@@ -2587,10 +2587,10 @@ xfrm_tmpl_resolve(struct xfrm_policy **pols, int npols, const struct flowi *fl,
|
||||
|
||||
}
|
||||
|
||||
static int xfrm_get_tos(const struct flowi *fl, int family)
|
||||
static dscp_t xfrm_get_dscp(const struct flowi *fl, int family)
|
||||
{
|
||||
if (family == AF_INET)
|
||||
return fl->u.ip4.flowi4_tos & INET_DSCP_MASK;
|
||||
return inet_dsfield_to_dscp(fl->u.ip4.flowi4_tos);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2678,13 +2678,13 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
|
||||
int header_len = 0;
|
||||
int nfheader_len = 0;
|
||||
int trailer_len = 0;
|
||||
int tos;
|
||||
int family = policy->selector.family;
|
||||
xfrm_address_t saddr, daddr;
|
||||
dscp_t dscp;
|
||||
|
||||
xfrm_flowi_addr_get(fl, &saddr, &daddr, family);
|
||||
|
||||
tos = xfrm_get_tos(fl, family);
|
||||
dscp = xfrm_get_dscp(fl, family);
|
||||
|
||||
dst_hold(dst);
|
||||
|
||||
@@ -2732,8 +2732,8 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy,
|
||||
family = xfrm[i]->props.family;
|
||||
|
||||
oif = fl->flowi_oif ? : fl->flowi_l3mdev;
|
||||
dst = xfrm_dst_lookup(xfrm[i], tos, oif,
|
||||
&saddr, &daddr, family, mark);
|
||||
dst = xfrm_dst_lookup(xfrm[i], dscp, oif, &saddr,
|
||||
&daddr, family, mark);
|
||||
err = PTR_ERR(dst);
|
||||
if (IS_ERR(dst))
|
||||
goto put_states;
|
||||
|
||||
Reference in New Issue
Block a user