ia64/xen-unstable

diff xen/common/kernel.c @ 720:017595b44310

bitkeeper revision 1.426 (3f67735ai0MOd0z8ockI7RQVT4dA_Q)

fix broken checksum calculation code for UDP console.
author iap10@labyrinth.cl.cam.ac.uk
date Tue Sep 16 20:32:26 2003 +0000 (2003-09-16)
parents 4862078df9ac
children e2fd844b9778 a3017cd62e5d
line diff
     1.1 --- a/xen/common/kernel.c	Thu Sep 11 12:38:25 2003 +0000
     1.2 +++ b/xen/common/kernel.c	Tue Sep 16 20:32:26 2003 +0000
     1.3 @@ -461,9 +461,9 @@ unsigned short compute_cksum(unsigned sh
     1.4      unsigned long sum = 0;
     1.5      while ( count-- )
     1.6          sum += *buf++;
     1.7 -    sum += sum >> 16;
     1.8 -    sum += sum >> 16;
     1.9 -    return (unsigned short)~sum;
    1.10 +    while ( sum >> 16 )
    1.11 +	sum = (sum & 0xffff) + (sum >> 16);
    1.12 +    return (unsigned short) ~sum;
    1.13  }
    1.14  
    1.15  
    1.16 @@ -495,18 +495,19 @@ int console_export(char *str, int len)
    1.17      udph = (struct udphdr *)(iph + 1); 
    1.18  
    1.19      skb_reserve(skb, sizeof(struct ethhdr)); 
    1.20 -    skb_put(skb, hdr_size + len); 
    1.21 +    skb_put(skb, hdr_size +  len); 
    1.22  
    1.23      /* Build IP header. */
    1.24      iph->version = 4;
    1.25      iph->ihl     = 5;
    1.26 +    iph->tos	 = 0;
    1.27 +    iph->tot_len = htons(hdr_size + len);
    1.28 +    iph->id      = 0xdead;
    1.29      iph->frag_off= 0;
    1.30 -    iph->id      = 0xdead;
    1.31      iph->ttl     = 255;
    1.32      iph->protocol= 17;
    1.33      iph->daddr   = htonl(0xa9fe0100);  /* 169.254.1.0 */
    1.34      iph->saddr   = htonl(0xa9fefeff);  /* 169.254.254.255 */
    1.35 -    iph->tot_len = htons(hdr_size + len); 
    1.36      iph->check	 = 0;
    1.37      iph->check   = compute_cksum((__u16 *)iph, sizeof(struct iphdr)/2); 
    1.38