Wireshark-dev: Re: [Wireshark-dev] Wireshark-dev Digest, Vol 23, Issue 11
From: Philip Frey1 <[email protected]>
Date: Tue, 8 Apr 2008 09:10:43 +0200

Hi Jaap,

thanks for the pointer. I have created a new bug report and added the diff there.
I hope it worked. Can you see my request?

Many thanks,
 Philip



"Jaap Keuter" <[email protected]>
Sent by: [email protected]

04.04.2008 20:28

Please respond to
Developer support list for Wireshark <[email protected]>

To
"'Developer support list for Wireshark'" <[email protected]>
cc
Subject
Re: [Wireshark-dev] Wireshark-dev Digest, Vol 23, Issue 11





Hi,
 
Please adhere to the patch submission policy: http://wiki.wireshark.org/SendingFilesToWireshark
That ensures things are picked up and tracked.
 
Thanx,
Jaap


From: wires[email protected] [mailto:[email protected]] On Behalf Of Philip Frey1
Sent:
2008-Apr-04 18:23
To:
[email protected]
Cc:
[email protected]
Subject:
Re: [Wireshark-dev] Wireshark-dev Digest, Vol 23, Issue 11



Hi Guy,


> Message: 2
> Date: Fri, 04 Apr 2008 02:17:34 -0700
> From: Guy Harris <[email protected]>
> Subject: Re: [Wireshark-dev] Share CRC32C code between MPA and iSCSI
> To: Developer support list for Wireshark <[email protected]>
> Cc: [email protected], [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Philip Frey1 wrote:
>
> > we have developed a dissector for the MPA (Marker PDU Aligned Framing)
> > protocol which is part of the iWARP stack.
> > Since we also need to do some CRC32C calculations (same as iSCSI),
>
> ...and, it appears, SCTP.


Good catch.


> The SCTP dissector has the same CRC table; its CRC routine starts with
> 0xFFFFFFFF - which, when byte-swapped, is unchanged - and then adds in
> to the CRC a bunch of bytes and 0's, flips the bits in the result, and
> then swaps the bytes.  Your CRC32 routine doesn't flip the bits, so the
> right way to combine them might be to:
>
>    export the CRC32 table from crc32c.c, declaring it in crc32.h;
>
>    moving the CRC32C macro from packet-sctp.c to crc32.h;
>
>    moving the CRC32C_SWAP macro from crc32c.c to crc32.h (or see whether
> GLib 1.2.x and 2.x define something equivalent, and use that);
>
>    have calculate_crc32() use the CRC32C macro:
>
> guint32 calculate_crc32(const void *buf, int len, guint32 crc)
> {
>    const guint8 *p = (const guint8 *)buf;
>    crc = CRC32C_SWAP(crc);
>    while (len-- > 0) {
>       CRC32C(crc, *p++);
>    }
>    return CRC32C_SWAP(crc);
> }
>
>    have sctp_crc32c() use CRC32C_PRELOAD instead of ~0L.
>
> There might be some other merging that could be done.


I have implemented exactly as you suggested (assuming I understood your suggestion

correctly). :-D


Please find attached the modified files:

(I merged everything into the crc32-files and got rid of the crc32c files)




If that is what you had in mind, then I will contribute it by sending my diff

to the bug-list of wireshark (as suggested in the README.developer).


Cheers,

Phil_______________________________________________
Wireshark-dev mailing list
[email protected]
http://www.wireshark.org/mailman/listinfo/wireshark-dev