netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ipsec-next v2] xfrm: Use VRF master index if output device is enslaved
@ 2015-08-20 22:06 David Ahern
  2015-08-20 23:11 ` Nikolay Aleksandrov
  0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2015-08-20 22:06 UTC (permalink / raw)
  To: steffen.klassert, netdev; +Cc: David Ahern

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>
---
v2
- use vrf_master_ifindex rather than vrf_master_ifindex_rcu

 net/ipv4/xfrm4_policy.c | 7 +++++--
 net/ipv6/xfrm6_policy.c | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 55b3c0f4dde5..35757f6af2d5 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;
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index a74013d3eceb..4a88b89becf5 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -20,6 +20,7 @@
 #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
@@ -131,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;
-- 
2.3.2 (Apple Git-55)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH ipsec-next v2] xfrm: Use VRF master index if output device is enslaved
  2015-08-20 22:06 [PATCH ipsec-next v2] xfrm: Use VRF master index if output device is enslaved David Ahern
@ 2015-08-20 23:11 ` Nikolay Aleksandrov
  2015-08-21 20:31   ` Steffen Klassert
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolay Aleksandrov @ 2015-08-20 23:11 UTC (permalink / raw)
  To: David Ahern; +Cc: steffen.klassert, netdev


> On Aug 21, 2015, at 1:06 AM, David Ahern <dsa@cumulusnetworks.com> wrote:
> 
> 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>
> ---
> v2
> - use vrf_master_ifindex rather than vrf_master_ifindex_rcu
> 
> net/ipv4/xfrm4_policy.c | 7 +++++--
> net/ipv6/xfrm6_policy.c | 7 +++++--
> 2 files changed, 10 insertions(+), 4 deletions(-)
> 

Looks good to me,

Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH ipsec-next v2] xfrm: Use VRF master index if output device is enslaved
  2015-08-20 23:11 ` Nikolay Aleksandrov
@ 2015-08-21 20:31   ` Steffen Klassert
  2015-08-25 18:25     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Steffen Klassert @ 2015-08-21 20:31 UTC (permalink / raw)
  To: Nikolay Aleksandrov, David Miller; +Cc: David Ahern, netdev

On Fri, Aug 21, 2015 at 02:11:21AM +0300, Nikolay Aleksandrov wrote:
> 
> > On Aug 21, 2015, at 1:06 AM, David Ahern <dsa@cumulusnetworks.com> wrote:
> > 
> > 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>
> > ---
> > v2
> > - use vrf_master_ifindex rather than vrf_master_ifindex_rcu
> > 
> > net/ipv4/xfrm4_policy.c | 7 +++++--
> > net/ipv6/xfrm6_policy.c | 7 +++++--
> > 2 files changed, 10 insertions(+), 4 deletions(-)
> > 
> 
> Looks good to me,
> 
> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

David, can you please take this directly into net-next?

Acked-by: Steffen Klassert <steffen.klassert@secunet.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH ipsec-next v2] xfrm: Use VRF master index if output device is enslaved
  2015-08-21 20:31   ` Steffen Klassert
@ 2015-08-25 18:25     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-08-25 18:25 UTC (permalink / raw)
  To: steffen.klassert; +Cc: nikolay, dsa, netdev

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Fri, 21 Aug 2015 22:31:32 +0200

> On Fri, Aug 21, 2015 at 02:11:21AM +0300, Nikolay Aleksandrov wrote:
>> 
>> > On Aug 21, 2015, at 1:06 AM, David Ahern <dsa@cumulusnetworks.com> wrote:
>> > 
>> > 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>
>> > ---
>> > v2
>> > - use vrf_master_ifindex rather than vrf_master_ifindex_rcu
>> > 
>> > net/ipv4/xfrm4_policy.c | 7 +++++--
>> > net/ipv6/xfrm6_policy.c | 7 +++++--
>> > 2 files changed, 10 insertions(+), 4 deletions(-)
>> > 
>> 
>> Looks good to me,
>> 
>> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> 
> David, can you please take this directly into net-next?
> 
> Acked-by: Steffen Klassert <steffen.klassert@secunet.com>

Ok, done, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-25 18:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-20 22:06 [PATCH ipsec-next v2] xfrm: Use VRF master index if output device is enslaved David Ahern
2015-08-20 23:11 ` Nikolay Aleksandrov
2015-08-21 20:31   ` Steffen Klassert
2015-08-25 18:25     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).