Skip to content

Commit

Permalink
net: mangle zero checksum in skb_checksum_help()
Browse files Browse the repository at this point in the history
[ Upstream commit 4f2e4ad ]

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: Eric Dumazet <edumazet@google.com>
Cc: Maciej Żenczykowski <maze@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Acked-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Eric Dumazet authored and bwhacks committed Mar 16, 2017
1 parent 5a47926 commit f8c5af0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@ int skb_checksum_help(struct sk_buff *skb)
goto out;
}

*(__sum16 *)(skb->data + offset) = csum_fold(csum);
*(__sum16 *)(skb->data + offset) = csum_fold(csum) ?: CSUM_MANGLED_0;
out_set_summed:
skb->ip_summed = CHECKSUM_NONE;
out:
Expand Down

0 comments on commit f8c5af0

Please sign in to comment.