Skip to content

Commit

Permalink
[NETPOLL]: Compute checksum properly in netpoll_send_udp().
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lalancette <clalance@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Chris Lalancette authored and David S. Miller committed Nov 7, 2006
1 parent da33e3e commit 8e365ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit 8e365ee

Please sign in to comment.