Thread (5 messages) flat view 5 messages, 2 authors, 2014-12-05

Re: [PATCH net-next 3/3] ip: Add support for IP_CHECKSUM cmsg

From: Eric Dumazet <hidden>
Date: 2014-12-05 01:17:51

On Wed, 2014-12-03 at 16:44 -0800, Tom Herbert wrote:
quoted hunk ↗ jump to hunk
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 221b53f..bba2e06 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1315,8 +1315,16 @@ try_again:
 		memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
 		*addr_len = sizeof(*sin);
 	}
-	if (inet->cmsg_flags)
+	if (inet->cmsg_flags) {
+		/* Pull checksum past UDP header in case we are providing
+		 * checksum in cmsg.
+		 */
+		if (inet->cmsg_flags & IP_CMSG_CHECKSUM)
+			skb_postpull_rcsum(skb, skb->data,
+					   sizeof(struct udphdr));
+
 		ip_cmsg_recv(msg, skb);
+	}

Have you tried MSG_PEEK ?

You can not modify the skb, you need to do something else.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help