David Miller wrote:
From: Chris Lalancette <[EMAIL PROTECTED]>
Date: Mon, 06 Nov 2006 18:40:59 -0500
Assuming that this is just an oversight, attached is a simple
patch to compute the UDP checksum in netpoll_send_udp.
If the resulting checksum is zero, you should set it to
all 1's, like the real UDP code does.
David,
Ah, thanks. Forgot about that. I re-spun the patch with the change
(attached). I also moved the UDP checksum calculation up to where the rest of
the UDP header setup is, to make it more consistent.
Thanks again for the comments!
Signed-off-by: Chris Lalancette <[EMAIL PROTECTED]>
--- linux-2.6/net/core/netpoll.c.orig 2006-11-06 18:16:58.000000000 -0500
+++ linux-2.6/net/core/netpoll.c 2006-11-07 08:16:29.000000000 -0500
@@ -340,6 +340,12 @@ void netpoll_send_udp(struct netpoll *np
udph->dest = htons(np->remote_port);
udph->len = htons(udp_len);
udph->check = 0;
+ udph->check = csum_tcpudp_magic(htonl(np->local_ip),
+ htonl(np->remote_ip),
+ udp_len, IPPROTO_UDP,
+ csum_partial((unsigned char *)udph, udp_len, 0));
+ if (udph->check == 0)
+ udph->check = -1;
skb->nh.iph = iph = (struct iphdr *)skb_push(skb, sizeof(*iph));