Commit b261b2c6 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

xfrm: Unmask upper DSCP bits in xfrm_get_tos()

The function returns a value that is used to initialize 'flowi4_tos'
before being passed to the FIB lookup API in the following call chain:

xfrm_bundle_create()
	tos = xfrm_get_tos(fl, family)
	xfrm_dst_lookup(..., tos, ...)
		__xfrm_dst_lookup(..., tos, ...)
			xfrm4_dst_lookup(..., tos, ...)
				__xfrm4_dst_lookup(..., tos, ...)
					fl4->flowi4_tos = tos
					__ip_route_output_key(net, fl4)

Unmask the upper DSCP bits so that in the future the output route lookup
could be performed according to the full DSCP value.

Remove IPTOS_RT_MASK since it is no longer used.
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Reviewed-by: default avatarGuillaume Nault <gnault@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f6c89e95
...@@ -266,8 +266,6 @@ static inline void ip_rt_put(struct rtable *rt) ...@@ -266,8 +266,6 @@ static inline void ip_rt_put(struct rtable *rt)
dst_release(&rt->dst); dst_release(&rt->dst);
} }
#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
extern const __u8 ip_tos2prio[16]; extern const __u8 ip_tos2prio[16];
static inline char rt_tos2priority(u8 tos) static inline char rt_tos2priority(u8 tos)
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#ifdef CONFIG_XFRM_ESPINTCP #ifdef CONFIG_XFRM_ESPINTCP
#include <net/espintcp.h> #include <net/espintcp.h>
#endif #endif
#include <net/inet_dscp.h>
#include "xfrm_hash.h" #include "xfrm_hash.h"
...@@ -2561,7 +2562,7 @@ xfrm_tmpl_resolve(struct xfrm_policy **pols, int npols, const struct flowi *fl, ...@@ -2561,7 +2562,7 @@ 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 int xfrm_get_tos(const struct flowi *fl, int family)
{ {
if (family == AF_INET) if (family == AF_INET)
return IPTOS_RT_MASK & fl->u.ip4.flowi4_tos; return fl->u.ip4.flowi4_tos & INET_DSCP_MASK;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment