netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: mangle zero checksum in skb_checksum_help()
@ 2016-10-29 18:02 Eric Dumazet
  2016-10-29 18:30 ` Maciej Żenczykowski
  2016-10-31 19:29 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2016-10-29 18:02 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Maciej Żenczykowski, Willem de Bruijn

From: Eric Dumazet <edumazet@google.com>

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>
---
 net/core/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index dbc871306910..899a0f00e721 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2484,7 +2484,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:

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

* Re: [PATCH net] net: mangle zero checksum in skb_checksum_help()
  2016-10-29 18:02 [PATCH net] net: mangle zero checksum in skb_checksum_help() Eric Dumazet
@ 2016-10-29 18:30 ` Maciej Żenczykowski
  2016-10-31 19:29 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Maciej Żenczykowski @ 2016-10-29 18:30 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Willem de Bruijn

Acked-by: Maciej Żenczykowski <maze@google.com>

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

* Re: [PATCH net] net: mangle zero checksum in skb_checksum_help()
  2016-10-29 18:02 [PATCH net] net: mangle zero checksum in skb_checksum_help() Eric Dumazet
  2016-10-29 18:30 ` Maciej Żenczykowski
@ 2016-10-31 19:29 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-10-31 19:29 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, maze, willemb

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 29 Oct 2016 11:02:36 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> 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>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2016-10-31 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-29 18:02 [PATCH net] net: mangle zero checksum in skb_checksum_help() Eric Dumazet
2016-10-29 18:30 ` Maciej Żenczykowski
2016-10-31 19:29 ` 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).