Commit 88c09362 authored by Eric Dumazet's avatar Eric Dumazet Committed by Luis Henriques

net: mangle zero checksum in skb_checksum_help()

BugLink: http://bugs.launchpad.net/bugs/1643637

[ Upstream commit 4f2e4ad5 ]

Sending zero checksum is ok for TCP, but not for UDP.

UDPv6 receiver should by default drop a frame with a 0 checksum,
and UDPv4 would not verify the checksum and might accept a corrupted
packet.

Simply replace such checksum by 0xffff, regardless of transport.

This error was caught on SIT tunnels, but seems generic.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Maciej Żenczykowski <maze@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Acked-by: default avatarMaciej Żenczykowski <maze@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 40196672
...@@ -2462,7 +2462,7 @@ int skb_checksum_help(struct sk_buff *skb) ...@@ -2462,7 +2462,7 @@ int skb_checksum_help(struct sk_buff *skb)
goto out; goto out;
} }
*(__sum16 *)(skb->data + offset) = csum_fold(csum); *(__sum16 *)(skb->data + offset) = csum_fold(csum) ?: CSUM_MANGLED_0;
out_set_summed: out_set_summed:
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment