diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2015-08-20 15:06:30 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-08-25 11:25:09 -0700 |
commit | 4ec3b28c2763e11a423d03810ff0be65f02e635e (patch) | |
tree | 125ee8d822d2ad0b32f371228cceeedcf281e53b /net/ipv4/xfrm4_policy.c | |
parent | 6f021c62d64f38092bc2a0c5fe7b81d5e5b21a00 (diff) | |
download | op-kernel-dev-4ec3b28c2763e11a423d03810ff0be65f02e635e.zip op-kernel-dev-4ec3b28c2763e11a423d03810ff0be65f02e635e.tar.gz |
xfrm: Use VRF master index if output device is enslaved
Directs route lookups to VRF table. Compiles out if NET_VRF is not
enabled. With this patch able to successfully bring up ipsec tunnels
in VRFs, even with duplicate network configuration.
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/xfrm4_policy.c')
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 55b3c0f..bb919b2 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c @@ -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; @@ -107,8 +108,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; |