Skip to content

Commit

Permalink
tunnels: Allow IPv6 UDP checksums to be correctly controlled.
Browse files Browse the repository at this point in the history
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: a725e51 ("vxlan: metadata based tunneling for IPv6")
Fixes: abe492b ("geneve: UDP checksum configuration via netlink")
Signed-off-by: Jesse Gross <jesse@kernel.org>
Acked-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jesse Gross authored and David S. Miller committed Jan 21, 2016
1 parent 4f2aaf7 commit 35e2d11
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions drivers/net/geneve.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
23 changes: 16 additions & 7 deletions drivers/net/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 35e2d11

Please sign in to comment.