netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net PATCH 0/2] Fix outer UDP checksums for IPv6 VXLAN tunnels
@ 2014-11-25  4:08 alexander.duyck
  2014-11-25  4:08 ` [net PATCH 1/2] ip6_udp_tunnel: Fix checksum calculation alexander.duyck
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: alexander.duyck @ 2014-11-25  4:08 UTC (permalink / raw)
  To: netdev; +Cc: davem

In testing against an older kernel I found a couple issues in the IPv6
VXLAN tunnel checksum logic for the outer UDP checksum.

First the default transitioned from using an outer checksum to not using
one.  Second, sometime after that the checksum inputs were changed
resulting the checksum not being correct if it were computed.

These two issues prevented a ping from the newer kernel to the older one.
With these two changes applied I verified I was able to send traffic over
the VXLAN tunnel to a link partner on an older kernel.

The boolean flip fix can be submitted for 3.17 stable as well since the
patch that introduced the issue was included in that kernel.

---

Alexander Duyck (2):
      ip6_udp_tunnel: Fix checksum calculation
      vxlan: Fix boolean flip in VXLAN_F_UDP_ZERO_CSUM6_[TX|RX]


 drivers/net/vxlan.c       |    4 ++--
 net/ipv6/ip6_udp_tunnel.c |    4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

-- 

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

* [net PATCH 1/2] ip6_udp_tunnel: Fix checksum calculation
  2014-11-25  4:08 [net PATCH 0/2] Fix outer UDP checksums for IPv6 VXLAN tunnels alexander.duyck
@ 2014-11-25  4:08 ` alexander.duyck
  2014-11-25  4:08 ` [net PATCH 2/2] vxlan: Fix boolean flip in VXLAN_F_UDP_ZERO_CSUM6_[TX|RX] alexander.duyck
  2014-11-25 19:13 ` [net PATCH 0/2] Fix outer UDP checksums for IPv6 VXLAN tunnels David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: alexander.duyck @ 2014-11-25  4:08 UTC (permalink / raw)
  To: netdev; +Cc: Alexander Duyck, Andy Zhou, davem

From: Alexander Duyck <alexander.h.duyck@redhat.com>

The UDP checksum calculation for VXLAN tunnels is currently using the
socket addresses instead of the actual packet source and destination
addresses.  As a result the checksum calculated is incorrect in some
cases.

Also uh->check was being set twice, first it was set to 0, and then it is
set again in udp6_set_csum.  This change removes the redundant assignment
to 0.

Fixes: acbf74a7 ("vxlan: Refactor vxlan driver to make use of the common UDP tunnel functions.")

Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
---
 net/ipv6/ip6_udp_tunnel.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/ipv6/ip6_udp_tunnel.c b/net/ipv6/ip6_udp_tunnel.c
index b04ed72..8db6c98 100644
--- a/net/ipv6/ip6_udp_tunnel.c
+++ b/net/ipv6/ip6_udp_tunnel.c
@@ -79,15 +79,13 @@ int udp_tunnel6_xmit_skb(struct socket *sock, struct dst_entry *dst,
 	uh->source = src_port;
 
 	uh->len = htons(skb->len);
-	uh->check = 0;
 
 	memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
 	IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED
 			    | IPSKB_REROUTED);
 	skb_dst_set(skb, dst);
 
-	udp6_set_csum(udp_get_no_check6_tx(sk), skb, &inet6_sk(sk)->saddr,
-		      &sk->sk_v6_daddr, skb->len);
+	udp6_set_csum(udp_get_no_check6_tx(sk), skb, saddr, daddr, skb->len);
 
 	__skb_push(skb, sizeof(*ip6h));
 	skb_reset_network_header(skb);

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

* [net PATCH 2/2] vxlan: Fix boolean flip in VXLAN_F_UDP_ZERO_CSUM6_[TX|RX]
  2014-11-25  4:08 [net PATCH 0/2] Fix outer UDP checksums for IPv6 VXLAN tunnels alexander.duyck
  2014-11-25  4:08 ` [net PATCH 1/2] ip6_udp_tunnel: Fix checksum calculation alexander.duyck
@ 2014-11-25  4:08 ` alexander.duyck
  2014-11-25  4:20   ` Tom Herbert
  2014-11-25 19:13 ` [net PATCH 0/2] Fix outer UDP checksums for IPv6 VXLAN tunnels David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: alexander.duyck @ 2014-11-25  4:08 UTC (permalink / raw)
  To: netdev; +Cc: Alexander Duyck, davem, Tom Herbert

From: Alexander Duyck <alexander.h.duyck@redhat.com>

In "vxlan: Call udp_sock_create" there was a logic error that resulted in
the default for IPv6 VXLAN tunnels going from using checksums to not using
checksums.  Since there is currently no support in iproute2 for setting
these values it means that a kernel after the change cannot talk over a IPv6
VXLAN tunnel to a kernel prior the change.

Fixes: 3ee64f3 ("vxlan: Call udp_sock_create")

Cc: Tom Herbert <therbert@google.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
---
 drivers/net/vxlan.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index e1e335c..be4649a 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2306,9 +2306,9 @@ static struct socket *vxlan_create_sock(struct net *net, bool ipv6,
 	if (ipv6) {
 		udp_conf.family = AF_INET6;
 		udp_conf.use_udp6_tx_checksums =
-		    !!(flags & VXLAN_F_UDP_ZERO_CSUM6_TX);
+		    !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX);
 		udp_conf.use_udp6_rx_checksums =
-		    !!(flags & VXLAN_F_UDP_ZERO_CSUM6_RX);
+		    !(flags & VXLAN_F_UDP_ZERO_CSUM6_RX);
 	} else {
 		udp_conf.family = AF_INET;
 		udp_conf.local_ip.s_addr = INADDR_ANY;

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

* Re: [net PATCH 2/2] vxlan: Fix boolean flip in VXLAN_F_UDP_ZERO_CSUM6_[TX|RX]
  2014-11-25  4:08 ` [net PATCH 2/2] vxlan: Fix boolean flip in VXLAN_F_UDP_ZERO_CSUM6_[TX|RX] alexander.duyck
@ 2014-11-25  4:20   ` Tom Herbert
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Herbert @ 2014-11-25  4:20 UTC (permalink / raw)
  To: Alexander Duyck; +Cc: Linux Netdev List, Alexander Duyck, David Miller

On Mon, Nov 24, 2014 at 8:08 PM,  <alexander.duyck@gmail.com> wrote:
> From: Alexander Duyck <alexander.h.duyck@redhat.com>
>
> In "vxlan: Call udp_sock_create" there was a logic error that resulted in
> the default for IPv6 VXLAN tunnels going from using checksums to not using
> checksums.  Since there is currently no support in iproute2 for setting
> these values it means that a kernel after the change cannot talk over a IPv6
> VXLAN tunnel to a kernel prior the change.
>
> Fixes: 3ee64f3 ("vxlan: Call udp_sock_create")
>
> Cc: Tom Herbert <therbert@google.com>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
> ---
>  drivers/net/vxlan.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index e1e335c..be4649a 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -2306,9 +2306,9 @@ static struct socket *vxlan_create_sock(struct net *net, bool ipv6,
>         if (ipv6) {
>                 udp_conf.family = AF_INET6;
>                 udp_conf.use_udp6_tx_checksums =
> -                   !!(flags & VXLAN_F_UDP_ZERO_CSUM6_TX);
> +                   !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX);
>                 udp_conf.use_udp6_rx_checksums =
> -                   !!(flags & VXLAN_F_UDP_ZERO_CSUM6_RX);
> +                   !(flags & VXLAN_F_UDP_ZERO_CSUM6_RX);
>         } else {
>                 udp_conf.family = AF_INET;
>                 udp_conf.local_ip.s_addr = INADDR_ANY;
>

Acked-by: Tom Herbert <therbert@google.com>

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

* Re: [net PATCH 0/2] Fix outer UDP checksums for IPv6 VXLAN tunnels
  2014-11-25  4:08 [net PATCH 0/2] Fix outer UDP checksums for IPv6 VXLAN tunnels alexander.duyck
  2014-11-25  4:08 ` [net PATCH 1/2] ip6_udp_tunnel: Fix checksum calculation alexander.duyck
  2014-11-25  4:08 ` [net PATCH 2/2] vxlan: Fix boolean flip in VXLAN_F_UDP_ZERO_CSUM6_[TX|RX] alexander.duyck
@ 2014-11-25 19:13 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-11-25 19:13 UTC (permalink / raw)
  To: alexander.duyck; +Cc: netdev

From: alexander.duyck@gmail.com
Date: Mon, 24 Nov 2014 20:08:25 -0800

> In testing against an older kernel I found a couple issues in the IPv6
> VXLAN tunnel checksum logic for the outer UDP checksum.
> 
> First the default transitioned from using an outer checksum to not using
> one.  Second, sometime after that the checksum inputs were changed
> resulting the checksum not being correct if it were computed.
> 
> These two issues prevented a ping from the newer kernel to the older one.
> With these two changes applied I verified I was able to send traffic over
> the VXLAN tunnel to a link partner on an older kernel.
> 
> The boolean flip fix can be submitted for 3.17 stable as well since the
> patch that introduced the issue was included in that kernel.

Series applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2014-11-25 19:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-25  4:08 [net PATCH 0/2] Fix outer UDP checksums for IPv6 VXLAN tunnels alexander.duyck
2014-11-25  4:08 ` [net PATCH 1/2] ip6_udp_tunnel: Fix checksum calculation alexander.duyck
2014-11-25  4:08 ` [net PATCH 2/2] vxlan: Fix boolean flip in VXLAN_F_UDP_ZERO_CSUM6_[TX|RX] alexander.duyck
2014-11-25  4:20   ` Tom Herbert
2014-11-25 19:13 ` [net PATCH 0/2] Fix outer UDP checksums for IPv6 VXLAN tunnels 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).