aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ieee8023.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-08-21 21:05:30 +0000
committerGuy Harris <guy@alum.mit.edu>2003-08-21 21:05:30 +0000
commit8b22117e4c08e7a77e2bae5216619a3755f0ac33 (patch)
tree03b7a126984ab3bcf7d7f3ff6189176d3aefe560 /packet-ieee8023.c
parentf695468fa2ca54a888d11bf61865f74d9c444cc8 (diff)
Sometimes Ethernet captures include an FCS at the end of the packet.
An Ethernet trailer is only needed to pad the packet to 60 bytes of Ethernet header plus payload; if the packet has what appears to be a trailer, and it's 4 or more bytes (i.e., long enough to include an FCS), and the Ethernet frame was claimed to have 64 or more bytes (i.e., it has at least an FCS worth of data more than the minimum 60 bytes), assume that the last 4 bytes of the frame were an FCS. svn path=/trunk/; revision=8207
Diffstat (limited to 'packet-ieee8023.c')
-rw-r--r--packet-ieee8023.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/packet-ieee8023.c b/packet-ieee8023.c
index 02b71c9364..3822bcf8bf 100644
--- a/packet-ieee8023.c
+++ b/packet-ieee8023.c
@@ -1,7 +1,7 @@
/* packet-ieee8023.c
* Routine for dissecting 802.3 (as opposed to D/I/X Ethernet) packets.
*
- * $Id: packet-ieee8023.c,v 1.4 2002/08/28 21:00:17 jmayer Exp $
+ * $Id: packet-ieee8023.c,v 1.5 2003/08/21 21:05:30 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -29,13 +29,11 @@
#include <glib.h>
#include <epan/packet.h>
#include "packet-ieee8023.h"
+#include "packet-eth.h"
static dissector_handle_t ipx_handle;
static dissector_handle_t llc_handle;
-static void add_trailer(proto_tree *fh_tree, int trailer_id,
- tvbuff_t *trailer_tvb);
-
void
dissect_802_3(int length, gboolean is_802_2, tvbuff_t *tvb,
int offset_after_length, packet_info *pinfo, proto_tree *tree,
@@ -89,7 +87,7 @@ dissect_802_3(int length, gboolean is_802_2, tvbuff_t *tvb,
}
CATCH2(BoundsError, ReportedBoundsError) {
/* Well, somebody threw an exception. Add the trailer, if appropriate. */
- add_trailer(fh_tree, trailer_id, trailer_tvb);
+ add_ethernet_trailer(fh_tree, trailer_id, tvb, trailer_tvb);
/* Rethrow the exception, so the "Short Frame" or "Mangled Frame"
indication can be put into the tree. */
@@ -100,30 +98,15 @@ dissect_802_3(int length, gboolean is_802_2, tvbuff_t *tvb,
}
ENDTRY;
- add_trailer(fh_tree, trailer_id, trailer_tvb);
-}
-
-static void
-add_trailer(proto_tree *fh_tree, int trailer_id, tvbuff_t *trailer_tvb)
-{
- /* If there's some bytes left over, mark them. */
- if (trailer_tvb && fh_tree) {
- guint trailer_length;
-
- trailer_length = tvb_length(trailer_tvb);
- if (trailer_length != 0) {
- proto_tree_add_item(fh_tree, trailer_id, trailer_tvb, 0,
- trailer_length, FALSE);
- }
- }
+ add_ethernet_trailer(fh_tree, trailer_id, tvb, trailer_tvb);
}
void
proto_reg_handoff_ieee802_3(void)
{
- /*
- * Get handles for the IPX and LLC dissectors.
- */
- ipx_handle = find_dissector("ipx");
- llc_handle = find_dissector("llc");
+ /*
+ * Get handles for the IPX and LLC dissectors.
+ */
+ ipx_handle = find_dissector("ipx");
+ llc_handle = find_dissector("llc");
}