diff mbox

ipv6: udp: check sk->sk_no_check when sending udpv6 packet

Message ID 52DC9D25.9070809@cn.fujitsu.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Duan Jiong Jan. 20, 2014, 3:51 a.m. UTC
According to the user's intention, if SO_NO_CHECK option is
set to true, the udpv6 packet should be out with no checksum.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/udp.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

David Miller Jan. 20, 2014, 3:54 a.m. UTC | #1
From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Date: Mon, 20 Jan 2014 11:51:01 +0800

> According to the user's intention, if SO_NO_CHECK option is
> set to true, the udpv6 packet should be out with no checksum.
> 
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>

This is intentionally not supported in ipv6.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hannes Frederic Sowa Jan. 20, 2014, 3:54 a.m. UTC | #2
On Mon, Jan 20, 2014 at 11:51:01AM +0800, Duan Jiong wrote:
> 
> According to the user's intention, if SO_NO_CHECK option is
> set to true, the udpv6 packet should be out with no checksum.

Nak, UDP checksumming is mandatory when used with IPv6.

Greetings,

  Hannes

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 089c741..8808c69 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1001,6 +1001,10 @@  static int udp_v6_push_pending_frames(struct sock *sk)
 
 	if (is_udplite)
 		csum = udplite_csum_outgoing(sk, skb);
+	else if (sk->sk_no_check == UDP_CSUM_NOXMIT) {
+		skb->ip_summed = CHECKSUM_NONE;
+		goto send;
+	}
 	else if (skb->ip_summed == CHECKSUM_PARTIAL) { /* UDP hardware csum */
 		udp6_hwcsum_outgoing(sk, skb, &fl6->saddr, &fl6->daddr,
 				     up->len);