diff --git a/CHANGES b/CHANGES index 54bd082464..3ce0107e15 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,10 @@ +2.5-beta-93 | 2016-10-24 11:11:07 -0700 + + * Fix alignment issue of ones_complement_checksum. This error + occured reproducibly newer compilers when called from + icmp6_checksum. (Johanna Amann) + 2.5-beta-91 | 2016-10-20 11:40:37 -0400 * Fix istate.pybroccoli test on systems using Python 3. (Daniel Thayer) diff --git a/VERSION b/VERSION index 3ab12c57fb..a221981979 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.5-beta-91 +2.5-beta-93 diff --git a/src/net_util.cc b/src/net_util.cc index 677a869cc5..9f93296d39 100644 --- a/src/net_util.cc +++ b/src/net_util.cc @@ -18,13 +18,16 @@ // Returns the ones-complement checksum of a chunk of b short-aligned bytes. int ones_complement_checksum(const void* p, int b, uint32 sum) { - const u_short* sp = (u_short*) p; // better be aligned! + const unsigned char* sp = (unsigned char*) p; b /= 2; // convert to count of short's /* No need for endian conversions. */ while ( --b >= 0 ) - sum += *sp++; + { + sum += *sp + (*(sp+1) << 8); + sp += 2; + } while ( sum > 0xffff ) sum = (sum & 0xffff) + (sum >> 16);