diff options
author | iap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk> | 2003-09-16 20:32:26 +0000 |
---|---|---|
committer | iap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk> | 2003-09-16 20:32:26 +0000 |
commit | 4a2dee7ecb434d9e7588860c5440b7802f9bb56e (patch) | |
tree | 5266dc0602c91e423daf7c0378e5dacff34c4071 /xen | |
parent | fda3c2fba82e72095c9e2efb75386a03e82b3333 (diff) | |
download | xen-4a2dee7ecb434d9e7588860c5440b7802f9bb56e.tar.gz xen-4a2dee7ecb434d9e7588860c5440b7802f9bb56e.tar.bz2 xen-4a2dee7ecb434d9e7588860c5440b7802f9bb56e.zip |
bitkeeper revision 1.426 (3f67735ai0MOd0z8ockI7RQVT4dA_Q)
fix broken checksum calculation code for UDP console.
Diffstat (limited to 'xen')
-rw-r--r-- | xen/common/kernel.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/xen/common/kernel.c b/xen/common/kernel.c index cc70814718..9c0bb47dbd 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -461,9 +461,9 @@ unsigned short compute_cksum(unsigned short *buf, int count) unsigned long sum = 0; while ( count-- ) sum += *buf++; - sum += sum >> 16; - sum += sum >> 16; - return (unsigned short)~sum; + while ( sum >> 16 ) + sum = (sum & 0xffff) + (sum >> 16); + return (unsigned short) ~sum; } @@ -495,18 +495,19 @@ int console_export(char *str, int len) udph = (struct udphdr *)(iph + 1); skb_reserve(skb, sizeof(struct ethhdr)); - skb_put(skb, hdr_size + len); + skb_put(skb, hdr_size + len); /* Build IP header. */ iph->version = 4; iph->ihl = 5; - iph->frag_off= 0; + iph->tos = 0; + iph->tot_len = htons(hdr_size + len); iph->id = 0xdead; + iph->frag_off= 0; iph->ttl = 255; iph->protocol= 17; iph->daddr = htonl(0xa9fe0100); /* 169.254.1.0 */ iph->saddr = htonl(0xa9fefeff); /* 169.254.254.255 */ - iph->tot_len = htons(hdr_size + len); iph->check = 0; iph->check = compute_cksum((__u16 *)iph, sizeof(struct iphdr)/2); |