]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/ipv6/xfrm6_policy.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[karo-tx-linux.git] / net / ipv6 / xfrm6_policy.c
index ed0583c1b9fc2e0033912e2d4c7177a12f17e8b7..30caa289c5dbf589270768ce90d15f2990341231 100644 (file)
 #include <net/ip.h>
 #include <net/ipv6.h>
 #include <net/ip6_route.h>
+#include <net/vrf.h>
 #if IS_ENABLED(CONFIG_IPV6_MIP6)
 #include <net/mip6.h>
 #endif
 
 static struct xfrm_policy_afinfo xfrm6_policy_afinfo;
 
-static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos,
+static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, int oif,
                                          const xfrm_address_t *saddr,
                                          const xfrm_address_t *daddr)
 {
@@ -35,6 +36,7 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos,
        int err;
 
        memset(&fl6, 0, sizeof(fl6));
+       fl6.flowi6_oif = oif;
        memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr));
        if (saddr)
                memcpy(&fl6.saddr, saddr, sizeof(fl6.saddr));
@@ -50,13 +52,13 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos,
        return dst;
 }
 
-static int xfrm6_get_saddr(struct net *net,
+static int xfrm6_get_saddr(struct net *net, int oif,
                           xfrm_address_t *saddr, xfrm_address_t *daddr)
 {
        struct dst_entry *dst;
        struct net_device *dev;
 
-       dst = xfrm6_dst_lookup(net, 0, NULL, daddr);
+       dst = xfrm6_dst_lookup(net, 0, oif, NULL, daddr);
        if (IS_ERR(dst))
                return -EHOSTUNREACH;
 
@@ -130,8 +132,10 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
 
        nexthdr = nh[nhoff];
 
-       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(fl6, 0, sizeof(struct flowi6));
        fl6->flowi6_mark = skb->mark;