Skip to content

Commit

Permalink
sctp: Fix crc32c calculations on big-endian arhes.
Browse files Browse the repository at this point in the history
crc32c algorithm provides a byteswaped result.  On little-endian
arches, the result ends up in big-endian/network byte order.
On big-endinan arches, the result ends up in little-endian
order and needs to be byte swapped again.  Thus calling cpu_to_le32
gives the right output.

Tested-by: Jukka Taimisto <jukka.taimisto@mail.suomi.net>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vlad Yasevich authored and David S. Miller committed Jan 22, 2009
1 parent c64d2a9 commit 9c5ff5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/net/sctp/checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ static inline __be32 sctp_update_cksum(__u8 *buffer, __u16 length, __be32 crc32)

static inline __be32 sctp_end_cksum(__be32 crc32)
{
return ~crc32;
return (__force __be32)~cpu_to_le32((__force u32)crc32);
}

0 comments on commit 9c5ff5f

Please sign in to comment.