netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net] vxlan: fix vxlan6_get_route() adding a call to xfrm_lookup_route()
@ 2020-01-15 19:22 Andrea Mayer
  2020-01-15 21:16 ` Sabrina Dubroca
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Mayer @ 2020-01-15 19:22 UTC (permalink / raw)
  To: David S. Miller, Petr Machata, Stefano Brivio, Eric Dumazet,
	Taehee Yoo, Litao jiao, Roopa Prabhu, netdev, linux-kernel
  Cc: Andrea Mayer, Paolo Lungaroni

currently IPSEC cannot be used to encrypt/decrypt IPv6 vxlan traffic.
The problem is that the vxlan module uses the vxlan6_get_route()
function to find out the route for transmitting an IPv6 packet, which in
turn uses ip6_dst_lookup() available in ip6_output.c.
Unfortunately ip6_dst_lookup() does not perform any xfrm route lookup,
so the xfrm framework cannot be used with vxlan6.

To fix the issue above, the vxlan6_get_route() function has been patched
by adding a missing call to xfrm_lookup_route(). Doing that, the
vxlan6_get_route() is now capable to lookup a route taking into account
also xfrm policies, if any.

Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Signed-off-by: Paolo Lungaroni <paolo.lungaroni@cnit.it>
---
 drivers/net/vxlan.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index bf04bc2e68c2..bec55a911c4f 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2306,6 +2306,11 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,
 		return ERR_PTR(-ENETUNREACH);
 	}
 
+	ndst = xfrm_lookup_route(vxlan->net, ndst, flowi6_to_flowi(&fl6),
+				 sock6->sock->sk, 0);
+	if (IS_ERR_OR_NULL(ndst))
+		return ERR_PTR(-ENETUNREACH);
+
 	if (unlikely(ndst->dev == dev)) {
 		netdev_dbg(dev, "circular route to %pI6\n", daddr);
 		dst_release(ndst);
-- 
2.20.1


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

* Re: [net] vxlan: fix vxlan6_get_route() adding a call to xfrm_lookup_route()
  2020-01-15 19:22 [net] vxlan: fix vxlan6_get_route() adding a call to xfrm_lookup_route() Andrea Mayer
@ 2020-01-15 21:16 ` Sabrina Dubroca
  2020-01-16 13:28   ` Andrea Mayer
  0 siblings, 1 reply; 4+ messages in thread
From: Sabrina Dubroca @ 2020-01-15 21:16 UTC (permalink / raw)
  To: Andrea Mayer
  Cc: David S. Miller, Petr Machata, Stefano Brivio, Eric Dumazet,
	Taehee Yoo, Litao jiao, Roopa Prabhu, netdev, linux-kernel,
	Paolo Lungaroni

2020-01-15, 20:22:31 +0100, Andrea Mayer wrote:
> currently IPSEC cannot be used to encrypt/decrypt IPv6 vxlan traffic.
> The problem is that the vxlan module uses the vxlan6_get_route()
> function to find out the route for transmitting an IPv6 packet, which in
> turn uses ip6_dst_lookup() available in ip6_output.c.
> Unfortunately ip6_dst_lookup() does not perform any xfrm route lookup,
> so the xfrm framework cannot be used with vxlan6.

That's not the case anymore, since commit 6c8991f41546 ("net:
ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup").

Can you retest on the latest net tree?

Thanks.

-- 
Sabrina


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

* Re: [net] vxlan: fix vxlan6_get_route() adding a call to xfrm_lookup_route()
  2020-01-15 21:16 ` Sabrina Dubroca
@ 2020-01-16 13:28   ` Andrea Mayer
  2020-01-20 16:02     ` Andrea Mayer
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Mayer @ 2020-01-16 13:28 UTC (permalink / raw)
  To: Sabrina Dubroca
  Cc: David S. Miller, Petr Machata, Stefano Brivio, Eric Dumazet,
	Taehee Yoo, Litao jiao, Roopa Prabhu, netdev, linux-kernel,
	Paolo Lungaroni

On Wed, 15 Jan 2020 22:16:21 +0100
Sabrina Dubroca <sd@queasysnail.net> wrote:

> 2020-01-15, 20:22:31 +0100, Andrea Mayer wrote:
> > currently IPSEC cannot be used to encrypt/decrypt IPv6 vxlan traffic.
> > The problem is that the vxlan module uses the vxlan6_get_route()
> > function to find out the route for transmitting an IPv6 packet, which in
> > turn uses ip6_dst_lookup() available in ip6_output.c.
> > Unfortunately ip6_dst_lookup() does not perform any xfrm route lookup,
> > so the xfrm framework cannot be used with vxlan6.
> 
> That's not the case anymore, since commit 6c8991f41546 ("net:
> ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup").
> 
> Can you retest on the latest net tree?
> 
> Thanks.
> 
> -- 
> Sabrina
> 

Hi Sabrina,
thanks for sharing the fix.
Sorry, my net tree was a bit outdated. I will retest with the fix and let you know.

-- 
Andrea Mayer <andrea.mayer@uniroma2.it>

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

* Re: [net] vxlan: fix vxlan6_get_route() adding a call to xfrm_lookup_route()
  2020-01-16 13:28   ` Andrea Mayer
@ 2020-01-20 16:02     ` Andrea Mayer
  0 siblings, 0 replies; 4+ messages in thread
From: Andrea Mayer @ 2020-01-20 16:02 UTC (permalink / raw)
  To: Sabrina Dubroca
  Cc: David S. Miller, Petr Machata, Stefano Brivio, Eric Dumazet,
	Taehee Yoo, Litao jiao, Roopa Prabhu, netdev, linux-kernel,
	Paolo Lungaroni, Andrea Mayer

On Thu, 16 Jan 2020 14:28:39 +0100
Andrea Mayer <andrea.mayer@uniroma2.it> wrote:

> On Wed, 15 Jan 2020 22:16:21 +0100
> Sabrina Dubroca <sd@queasysnail.net> wrote:
> 
> > 2020-01-15, 20:22:31 +0100, Andrea Mayer wrote:
> > > currently IPSEC cannot be used to encrypt/decrypt IPv6 vxlan traffic.
> > > The problem is that the vxlan module uses the vxlan6_get_route()
> > > function to find out the route for transmitting an IPv6 packet, which in
> > > turn uses ip6_dst_lookup() available in ip6_output.c.
> > > Unfortunately ip6_dst_lookup() does not perform any xfrm route lookup,
> > > so the xfrm framework cannot be used with vxlan6.
> > 
> > That's not the case anymore, since commit 6c8991f41546 ("net:
> > ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup").
> > 
> > Can you retest on the latest net tree?
> > 
> > Thanks.
> > 
> > -- 
> > Sabrina
> > 
> 
> Hi Sabrina,
> thanks for sharing the fix.
> Sorry, my net tree was a bit outdated. I will retest with the fix and let you know.
> 
> -- 
> Andrea Mayer <andrea.mayer@uniroma2.it>

Hi,
I've tested the new net tree in my setup and now vxlan6 and IPSec seems to work good.

Thanks.

-- 
Andrea Mayer <andrea.mayer@uniroma2.it>

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

end of thread, other threads:[~2020-01-20 16:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 19:22 [net] vxlan: fix vxlan6_get_route() adding a call to xfrm_lookup_route() Andrea Mayer
2020-01-15 21:16 ` Sabrina Dubroca
2020-01-16 13:28   ` Andrea Mayer
2020-01-20 16:02     ` Andrea Mayer

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