@@ -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,
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@redhat.com> --- net/ipv4/xfrm4_policy.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)