Fix ptclbsum to handle odd offsets
authorXiao Jia <stfairy@gmail.com>
Wed, 28 Oct 2015 00:36:38 +0000 (17:36 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 3 Nov 2015 17:00:38 +0000 (12:00 -0500)
Signed-off-by: Xiao Jia <stfairy@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/net/ptclbsum.c

index 260aa82..b335a30 100644 (file)
@@ -212,6 +212,8 @@ uint16_t ptclbsum(uint8_t * addr, int len)
        uint64_t sum = in_cksumdata(addr, len);
        union q_util q_util;
        union l_util l_util;
+       if ((uintptr_t)addr & 1)
+               sum <<= 8;
        REDUCE16;
        return cpu_to_be16(sum);
 }