bitkeeper revision 1.426 (3f67735ai0MOd0z8ockI7RQVT4dA_Q)
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>
Tue, 16 Sep 2003 20:32:26 +0000 (20:32 +0000)
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>
Tue, 16 Sep 2003 20:32:26 +0000 (20:32 +0000)
fix broken checksum calculation code for UDP console.

tools/misc/xen-clone
xen/common/kernel.c

index 6cffbb8cedacfad64eb4dceb1951b1ffcf172132..8e54ca64b294687ca52852255ba6d69d32f7b91b 100755 (executable)
@@ -39,8 +39,8 @@ UCCL)
        PATH=$PATH:/usr/groups/xeno/build_tools/bin
        mkdir -p install/boot
        cd install/boot
-       ln -sf ../../xeno-roots/roots .
-       ln -sf ../../xeno-roots/usr .
+       ln -sf ../../../xeno-roots/roots .
+       ln -sf ../../../xeno-roots/usr .
        ln -sf ../lib .
        ln -sf ../bin .
        ln -sf /usr/groups/srgboot/${USER}/xenoboot.sh .
index cc7081471827f388af5dd14be0d049a2b18bb613..9c0bb47dbdcde43e344042ec4ddd4d0fba400350 100644 (file)
@@ -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);