Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
csum: Fix csum_continue() on big endian with an odd number of bytes.
Even though it reads 16 bits at a time, csum_continue() is almost neutral to endianness (see RFC 1071 1.2 (B), "Byte Order Independence"). Consider a buffer like the following: 00000000: XX YY XX YY XX YY XX YY ZZ Each couple of bytes is interpreted on little endian as: *data = 0xYYXX while on big endian *data = 0xXXYY The last byte "ZZ" should be treated as the two bytes "ZZ 00" little endian: *data = 0x00ZZ big endian: *data = 0xZZ00 which means that the last byte (for odd buffers) should be left shifted by 8 bits on big endian platforms. This fixes a couple of connection tracking tests in userspace for big endian platforms. I guess RFC1071 4.1 (implementation example of the checksum in C), would manifest the same problem on big endian. Reported-at: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=840770 Signed-off-by: Daniele Di Proietto <[email protected]> Acked-by: Jarno Rajahalme <[email protected]>
- Loading branch information