#107 New CRC32 for Ethernet emulation drivers

closed-fixed
nobody
None
5
2015-02-19
2005-07-30
Gilles Reeves
No

The current tools/crc32.cc file (used by the two io
drivers io/sc90x/3c90x.cc and io/rtl8139/rtl8139.cc)
contains a lot of unused code and conditional
statements, and, worst of all, it returns an incorrect
CRC when called (you can check this by monitoring the
network with Ethereal).

I submit here two files (crc32.h and crc32.cc) that I
wrote for replacing the existing tools/crc32.h and
tools/crc32.cc.

This is not a patch : these two files are completely
new. I rewrote them to be as much simple and efficient
as possible, using information found on Internet about
Ethernet CRC32.

If used, two others existing files (tools/crc32defs.h
and tools/crc32table.h) that are only #include'd in the
previous version of crc32.cc, can be completely discarded.

I discarded also the "copyright" comments at the
beginning, as I think that they no longer apply, and I
don't know the PearPc's rules for making new ones from
scratch. I hope that the PearPc team will add the
proper ones if they accept the change. :-)

I kept the "brief CRC tutorial" found at the end of the
old tools/crc32.cc file.

These new files have been compiled and tested by myself
with PearPc. Using them, Ethereal reports the CRC as
correct.

Gingko

Discussion

  • Gilles Reeves
    Gilles Reeves
    2005-07-30

    Replacement files for tools/crc32.h & .cc

     
    Attachments
  • Gilles Reeves
    Gilles Reeves
    2005-07-31

    Logged In: YES
    user_id=512471

    Note :
    I must add that this will very probably not work with big
    endian host machines, but it looks like that the previous
    code didn't do it either : the __LITTLE_ENDIAN option was
    hard #define'd, and was commented : "FIXME: HACKED / host
    endianess".

    I could easily add big endian support to this if required
    ... but I would be hardly able to test it, as I don't have
    any big endian machine.

    ... unless testing it inside PearPc itself ? :-)

    Gingko

     
  • Logged In: YES
    user_id=3437

    in cvs

     
    • status: open --> closed-fixed