Hi,
I've built v0.9.7 on Compaq/HP Tru64 UNIX v5.1A, and I found a problem with the computation of the CRC32c checksum for the SCTP protocol. On Tru64 UNIX, ethereal shows incorrect CRC32c checksums, while the Win32 build does not exhibit this behavior. So I suspected a glitch with 64-bit integers, and I was right :-)
Below is a quick patch to make the CRC32c code work on all platforms (well, hopefully ;-)).
I'm not subscribed to the list so please CC: me for more info. Thanks.
Regards,
--
Jerome
$ diff -Bbu packet-sctp.c.old packet-sctp.c
--- packet-sctp.c.old Thu Oct 17 16:40:10 2002
+++ packet-sctp.c Thu Oct 17 17:18:05 2002
@@ -512,7 +512,7 @@
*/
#define CRC32C(c,d) (c=(c>>8)^crc_c[(c^(d))&0xFF])
-static unsigned long crc_c[256] =
+static guint32 crc_c[256] =
{
0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L,
0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL,
@@ -580,12 +580,12 @@
0xBE2DA0A5L, 0x4C4623A6L, 0x5F16D052L, 0xAD7D5351L,
};
-static unsigned int
+static guint32
sctp_crc32c(const unsigned char* buf, unsigned int len)
{
unsigned int i;
- unsigned long crc32 = ~0L;
- unsigned long result;
+ guint32 crc32 = ~0L;
+ guint32 result;
unsigned char byte0,byte1,byte2,byte3;
for (i = 0; i < SOURCE_PORT_LENGTH + DESTINATION_PORT_LENGTH + VERIFICATION_TAG_LENGTH; i++)