netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfrm: Only add l3mdev oif to dst lookups
@ 2016-08-15  2:52 David Ahern
  2016-08-17 23:31 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2016-08-15  2:52 UTC (permalink / raw)
  To: netdev, steffen.klassert; +Cc: David Ahern

Subash reported that commit 42a7b32b73d6 ("xfrm: Add oif to dst lookups")
broke a wifi use case that uses fib rules and xfrms. The intent of
42a7b32b73d6 was driven by VRFs with IPsec. As a compromise relax the
use of oif in xfrm lookups to L3 master devices only (ie., oif is either
an L3 master device or is enslaved to a master device).

Fixes: 42a7b32b73d6 ("xfrm: Add oif to dst lookups")
Reported-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
 net/ipv4/xfrm4_policy.c | 2 +-
 net/ipv6/xfrm6_policy.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index b644a23c3db0..41f5b504a782 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -29,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_oif = oif;
+	fl4->flowi4_oif = l3mdev_master_ifindex_by_index(net, oif);
 	if (saddr)
 		fl4->saddr = saddr->a4;
 
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 6cc97003e4a9..70a86adad875 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -36,7 +36,7 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, int oif,
 	int err;
 
 	memset(&fl6, 0, sizeof(fl6));
-	fl6.flowi6_oif = oif;
+	fl6.flowi6_oif = l3mdev_master_ifindex_by_index(net, oif);
 	fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF;
 	memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr));
 	if (saddr)
-- 
2.1.4

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

* Re: [PATCH] xfrm: Only add l3mdev oif to dst lookups
  2016-08-15  2:52 [PATCH] xfrm: Only add l3mdev oif to dst lookups David Ahern
@ 2016-08-17 23:31 ` David Miller
  2016-08-22  7:16   ` Steffen Klassert
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2016-08-17 23:31 UTC (permalink / raw)
  To: dsa; +Cc: netdev, steffen.klassert

From: David Ahern <dsa@cumulusnetworks.com>
Date: Sun, 14 Aug 2016 19:52:56 -0700

> Subash reported that commit 42a7b32b73d6 ("xfrm: Add oif to dst lookups")
> broke a wifi use case that uses fib rules and xfrms. The intent of
> 42a7b32b73d6 was driven by VRFs with IPsec. As a compromise relax the
> use of oif in xfrm lookups to L3 master devices only (ie., oif is either
> an L3 master device or is enslaved to a master device).
> 
> Fixes: 42a7b32b73d6 ("xfrm: Add oif to dst lookups")
> Reported-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>

Steffen, please pick this up.

Thank you.

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

* Re: [PATCH] xfrm: Only add l3mdev oif to dst lookups
  2016-08-17 23:31 ` David Miller
@ 2016-08-22  7:16   ` Steffen Klassert
  0 siblings, 0 replies; 3+ messages in thread
From: Steffen Klassert @ 2016-08-22  7:16 UTC (permalink / raw)
  To: David Miller; +Cc: dsa, netdev

On Wed, Aug 17, 2016 at 07:31:14PM -0400, David Miller wrote:
> From: David Ahern <dsa@cumulusnetworks.com>
> Date: Sun, 14 Aug 2016 19:52:56 -0700
> 
> > Subash reported that commit 42a7b32b73d6 ("xfrm: Add oif to dst lookups")
> > broke a wifi use case that uses fib rules and xfrms. The intent of
> > 42a7b32b73d6 was driven by VRFs with IPsec. As a compromise relax the
> > use of oif in xfrm lookups to L3 master devices only (ie., oif is either
> > an L3 master device or is enslaved to a master device).
> > 
> > Fixes: 42a7b32b73d6 ("xfrm: Add oif to dst lookups")
> > Reported-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
> > Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
> 
> Steffen, please pick this up.

Now applied to the ipsec tree, thanks a lot!

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

end of thread, other threads:[~2016-08-22  7:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-15  2:52 [PATCH] xfrm: Only add l3mdev oif to dst lookups David Ahern
2016-08-17 23:31 ` David Miller
2016-08-22  7:16   ` Steffen Klassert

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).