[NETPOLL]: Compute checksum properly in netpoll_send_udp().
authorChris Lalancette <clalance@redhat.com>
Tue, 7 Nov 2006 22:56:19 +0000 (14:56 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 7 Nov 2006 23:10:13 +0000 (15:10 -0800)
Signed-off-by: Chris Lalancette <clalance@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/netpoll.c

index 9308af060b44d61284d6ce654b82029dbc0d6738..6589adb14cbfe5d80401b5384671a599bb05e1f4 100644 (file)
@@ -340,6 +340,12 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
        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));