diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-08-26 05:09:56 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-08-26 05:09:56 +0000 |
commit | 2bdd160d0e5b40c5651a8f047e6b93ed369d6d5f (patch) | |
tree | 7f78a504b7f603c7743906a8f72d7dfba29e2392 /packet-eth.c | |
parent | 31abca27fce3927a8c2272e56d5e829214bee30c (diff) |
Extract the CRC-32 code from the 802.11 dissector into a separate file,
and use it in the Ethernet dissector as well, to check the FCS in
Ethernet frames, if present.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8265 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-eth.c')
-rw-r--r-- | packet-eth.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/packet-eth.c b/packet-eth.c index 47aa625407..9bd39edb14 100644 --- a/packet-eth.c +++ b/packet-eth.c @@ -1,7 +1,7 @@ /* packet-eth.c * Routines for ethernet packet disassembly * - * $Id: packet-eth.c,v 1.83 2003/08/26 04:34:26 guy Exp $ + * $Id: packet-eth.c,v 1.84 2003/08/26 05:09:55 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -36,6 +36,7 @@ #include "packet-ipx.h" #include "packet-isl.h" #include "packet-llc.h" +#include "crc32.h" #include "tap.h" /* Interpret capture file as FW1 monitor file */ @@ -340,9 +341,18 @@ add_ethernet_trailer(proto_tree *fh_tree, int trailer_id, tvbuff_t *tvb, trailer_length, FALSE); } if (has_fcs) { - proto_tree_add_text(fh_tree, trailer_tvb, trailer_length, 4, - "FCS: 0x%08x", - tvb_get_ntohl(trailer_tvb, trailer_length)); + guint32 sent_fcs = tvb_get_ntohl(trailer_tvb, trailer_length); + guint32 fcs = crc32(tvb_get_ptr(tvb, 0, tvb_length(tvb) - 4), + tvb_length(tvb) - 4); + if (fcs == sent_fcs) { + proto_tree_add_text(fh_tree, trailer_tvb, trailer_length, 4, + "Frane check sequence: 0x%08x (correct)", + sent_fcs); + } else { + proto_tree_add_text(fh_tree, trailer_tvb, trailer_length, 4, + "Frane check sequence: 0x%08x (incorrect, should be 0x%08x)", + sent_fcs, fcs); + } } } } |