Wireshark

  • Riverbed Technology
  • WinPcap
the world's foremost network protocol analyzer
  • Wireshark
    • About
    • Download
    • Blog
  • Get Help
    • Ask a Question
    • FAQs
    • Documentation
    • Mailing Lists
    • Online Tools
    • Wiki
    • Bug Tracker
  • Develop
    • Get Involved
    • Developer's Guide
    • Browse the Code
    • Latest Builds

Wireshark-dev: Re: [Wireshark-dev] Share CRC32C code between MPA and iSCSI

Date Index Thread Index Other Months All Mailing Lists
Date Prev Date Next Thread Prev Thread Next


From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Fri, 04 Apr 2008 02:17:34 -0700

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.

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.

  • References:
    • [Wireshark-dev] Share CRC32C code between MPA and iSCSI
      • From: Philip Frey1
  • Prev by Date: Re: [Wireshark-dev] VoIP call -- RTP trace --
  • Next by Date: Re: [Wireshark-dev] source code
  • Previous by thread: [Wireshark-dev] Share CRC32C code between MPA and iSCSI
  • Next by thread: Re: [Wireshark-dev] [Wireshark-commits] rev 24766: /trunk/epan/ /trunk/epan/: libwireshark.def
  • Index(es):
    • Date
    • Thread

Wireshark and the "fin" logo are registered trademarks of the Wireshark Foundation