* [PATCH net] tunnels: Allow IPv6 UDP checksums to be correctly controlled.
@ 2016-01-21 0:22 Jesse Gross
2016-01-21 14:57 ` Jiri Benc
0 siblings, 1 reply; 3+ messages in thread
From: Jesse Gross @ 2016-01-21 0:22 UTC (permalink / raw)
To: David Miller; +Cc: netdev
When configuring checksums on UDP tunnels, the flags are different
for IPv4 vs. IPv6 (and reversed). However, when lightweight tunnels
are enabled the flags used are always the IPv4 versions, which are
ignored in the IPv6 code paths. This uses the correct IPv6 flags, so
checksums can be controlled appropriately.
Fixes: a725e514 ("vxlan: metadata based tunneling for IPv6")
Fixes: abe492b4 ("geneve: UDP checksum configuration via netlink")
Signed-off-by: Jesse Gross <jesse@kernel.org>
---
drivers/net/geneve.c | 4 ++--
drivers/net/vxlan.c | 23 ++++++++++++++++-------
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 7456569..0b14ac3 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -980,9 +980,9 @@ static netdev_tx_t geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
opts = ip_tunnel_info_opts(info);
if (key->tun_flags & TUNNEL_CSUM)
- flags |= GENEVE_F_UDP_CSUM;
+ flags &= ~GENEVE_F_UDP_ZERO_CSUM6_TX;
else
- flags &= ~GENEVE_F_UDP_CSUM;
+ flags |= GENEVE_F_UDP_ZERO_CSUM6_TX;
err = geneve6_build_skb(dst, skb, key->tun_flags, vni,
info->options_len, opts,
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 2d88c79..a85b1fc 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1985,11 +1985,6 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
vxlan->cfg.port_max, true);
if (info) {
- if (info->key.tun_flags & TUNNEL_CSUM)
- flags |= VXLAN_F_UDP_CSUM;
- else
- flags &= ~VXLAN_F_UDP_CSUM;
-
ttl = info->key.ttl;
tos = info->key.tos;
@@ -2004,8 +1999,15 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
goto drop;
sk = vxlan->vn4_sock->sock->sk;
- if (info && (info->key.tun_flags & TUNNEL_DONT_FRAGMENT))
- df = htons(IP_DF);
+ if (info) {
+ if (info->key.tun_flags & TUNNEL_DONT_FRAGMENT)
+ df = htons(IP_DF);
+
+ if (info->key.tun_flags & TUNNEL_CSUM)
+ flags |= VXLAN_F_UDP_CSUM;
+ else
+ flags &= ~VXLAN_F_UDP_CSUM;
+ }
memset(&fl4, 0, sizeof(fl4));
fl4.flowi4_oif = rdst ? rdst->remote_ifindex : 0;
@@ -2101,6 +2103,13 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
return;
}
+ if (info) {
+ if (info->key.tun_flags & TUNNEL_CSUM)
+ flags &= ~VXLAN_F_UDP_ZERO_CSUM6_TX;
+ else
+ flags |= VXLAN_F_UDP_ZERO_CSUM6_TX;
+ }
+
ttl = ttl ? : ip6_dst_hoplimit(ndst);
err = vxlan6_xmit_skb(ndst, sk, skb, dev, &saddr, &dst->sin6.sin6_addr,
0, ttl, src_port, dst_port, htonl(vni << 8), md,
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] tunnels: Allow IPv6 UDP checksums to be correctly controlled.
2016-01-21 0:22 [PATCH net] tunnels: Allow IPv6 UDP checksums to be correctly controlled Jesse Gross
@ 2016-01-21 14:57 ` Jiri Benc
2016-01-21 19:13 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Benc @ 2016-01-21 14:57 UTC (permalink / raw)
To: Jesse Gross; +Cc: David Miller, netdev
On Wed, 20 Jan 2016 16:22:47 -0800, Jesse Gross wrote:
> When configuring checksums on UDP tunnels, the flags are different
> for IPv4 vs. IPv6 (and reversed). However, when lightweight tunnels
> are enabled the flags used are always the IPv4 versions, which are
> ignored in the IPv6 code paths. This uses the correct IPv6 flags, so
> checksums can be controlled appropriately.
>
> Fixes: a725e514 ("vxlan: metadata based tunneling for IPv6")
> Fixes: abe492b4 ("geneve: UDP checksum configuration via netlink")
> Signed-off-by: Jesse Gross <jesse@kernel.org>
Indeed. Thanks for spotting this.
Acked-by: Jiri Benc <jbenc@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] tunnels: Allow IPv6 UDP checksums to be correctly controlled.
2016-01-21 14:57 ` Jiri Benc
@ 2016-01-21 19:13 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2016-01-21 19:13 UTC (permalink / raw)
To: jbenc; +Cc: jesse, netdev
From: Jiri Benc <jbenc@redhat.com>
Date: Thu, 21 Jan 2016 15:57:15 +0100
> On Wed, 20 Jan 2016 16:22:47 -0800, Jesse Gross wrote:
>> When configuring checksums on UDP tunnels, the flags are different
>> for IPv4 vs. IPv6 (and reversed). However, when lightweight tunnels
>> are enabled the flags used are always the IPv4 versions, which are
>> ignored in the IPv6 code paths. This uses the correct IPv6 flags, so
>> checksums can be controlled appropriately.
>>
>> Fixes: a725e514 ("vxlan: metadata based tunneling for IPv6")
>> Fixes: abe492b4 ("geneve: UDP checksum configuration via netlink")
>> Signed-off-by: Jesse Gross <jesse@kernel.org>
>
> Indeed. Thanks for spotting this.
>
> Acked-by: Jiri Benc <jbenc@redhat.com>
Applied, and queued up for -stable.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-21 19:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-21 0:22 [PATCH net] tunnels: Allow IPv6 UDP checksums to be correctly controlled Jesse Gross
2016-01-21 14:57 ` Jiri Benc
2016-01-21 19:13 ` 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).