Skip to contentSkip to conversation

ipv6: fix raw socket checksum for udplite

PATCH In review Maciej Żenczykowski 3 participants 3 messages Mar 26, 2013 – Mar 27, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: fix raw socket checksum for udplite

From: Maciej Żenczykowski <[email protected]>

Commit d3a1be9cba86 from Brian Haley in Nov 2006 "[IPv6]: Only modify checksum for UDP" forgot about UDPLITE.

(Not clear if this fix is sufficient for udp over raw6 socket checksumming in kernel to be useful, but it's obviously wrong as is.)

RFC 3828 section 3.1, 3rd paragraph:

If the computed checksum is 0, it is transmitted as all ones (the equivalent in one's complement arithmetic).

Cc Eric Dumazet <[email protected]>
Cc Mike Dalton <[email protected]>
Cc Brian Haley <[email protected]>
---
 net/ipv6/raw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/raw.c +2 -1
index eedff8ccded5..745e925eff17 100644
@@ -590,7 +590,8 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
 	csum = csum_ipv6_magic(&fl6->saddr, &fl6->daddr,
 			       total_len, fl6->flowi6_proto, tmp_csum);
 
-	if (csum == 0 && fl6->flowi6_proto == IPPROTO_UDP)
+	if (csum == 0 && (fl6->flowi6_proto == IPPROTO_UDP
+	    || fl6->flowi6_proto == IPPROTO_UDPLITE))
 		csum = CSUM_MANGLED_0;
 
 	if (skb_store_bits(skb, offset, &csum, 2))
Signature · 1 line
1.8.1.3
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Maciej Żenczykowski

From: Maciej Żenczykowski <[email protected]>

Commit d3a1be9cba86 from Brian Haley in Nov 2006 "[IPv6]: Only modify checksum for UDP" forgot about UDPLITE.

I'm not sure I'd say I "forgot about" it, UDPLITE support didn't exist in Linux until three+ weeks after that commit.

commit d3a1be9cba86c4385a5fe46673bbb4730551f454

Author: Brian Haley <[email protected]>
Date:   Fri Nov 10 14:54:51 2006 -0800

[IPv6]: Only modify checksum for UDP

commit ba4e58eca8aa9473b44fdfd312f26c4a2e7798b3

Author: Gerrit Renker <[email protected]>
Date:   Mon Nov 27 11:10:57 2006 -0800

[NET]: Supporting UDP-Lite (RFC 3828) in Linux

I see no reason your patch isn't correct though.

-Brian

maintainer
#2 lore raw

From: Brian Haley <[email protected]>
Date: Tue, 26 Mar 2013 22:30:25 -0400

Quoted 9 lines · Maciej Żenczykowski
Quoted 5 lines

From: Maciej Żenczykowski <[email protected]>

Commit d3a1be9cba86 from Brian Haley in Nov 2006 "[IPv6]: Only modify checksum for UDP" forgot about UDPLITE.

I'm not sure I'd say I "forgot about" it, UDPLITE support didn't exist in Linux until three+ weeks after that commit.

Maciej, please fix the commit message to not blame that commit, and resubmit, thanks.