net: Fix vti use case with oif in dst lookups
[deliverable/linux.git] / net / ipv4 / xfrm4_policy.c
index 55b3c0f4dde5ba45c0840542f1308613b6f06b8f..c10a9ee684337782fa96b71302c0f05695711f36 100644 (file)
@@ -15,6 +15,7 @@
 #include <net/dst.h>
 #include <net/xfrm.h>
 #include <net/ip.h>
+#include <net/vrf.h>
 
 static struct xfrm_policy_afinfo xfrm4_policy_afinfo;
 
@@ -32,6 +33,8 @@ static struct dst_entry *__xfrm4_dst_lookup(struct net *net, struct flowi4 *fl4,
        if (saddr)
                fl4->saddr = saddr->a4;
 
+       fl4->flowi4_flags = FLOWI_FLAG_SKIP_NH_OIF;
+
        rt = __ip_route_output_key(net, fl4);
        if (!IS_ERR(rt))
                return &rt->dst;
@@ -107,8 +110,10 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
        struct flowi4 *fl4 = &fl->u.ip4;
        int oif = 0;
 
-       if (skb_dst(skb))
-               oif = skb_dst(skb)->dev->ifindex;
+       if (skb_dst(skb)) {
+               oif = vrf_master_ifindex(skb_dst(skb)->dev) ?
+                       : skb_dst(skb)->dev->ifindex;
+       }
 
        memset(fl4, 0, sizeof(struct flowi4));
        fl4->flowi4_mark = skb->mark;
This page took 0.028665 seconds and 5 git commands to generate.