aboutsummaryrefslogtreecommitdiffstats
path: root/packet-eth.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-01-24 01:15:37 +0000
committerGuy Harris <guy@alum.mit.edu>2000-01-24 01:15:37 +0000
commit6ba70926afaa2af217519422e1f4ed3a771b9a13 (patch)
tree51264c57291ec1675e14f3bd7025c61bf192ceb1 /packet-eth.c
parent2461d79698e685644e2f07ee46381a092348461c (diff)
When computing the total frame length of an 802.3 frame, add to the
value in the length field not only the Ethernet MAC header size, but also the offset in the frame of the Ethernet MAC header, so that, if the 802.3 frame is encapsulated in some other type of frame, the total frame length includes the header for that frame as well. svn path=/trunk/; revision=1526
Diffstat (limited to 'packet-eth.c')
-rw-r--r--packet-eth.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/packet-eth.c b/packet-eth.c
index 41b455cdb9..a4a6f64f5f 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.26 2000/01/23 08:55:32 guy Exp $
+ * $Id: packet-eth.c,v 1.27 2000/01/24 01:15:37 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -95,10 +95,11 @@ capture_eth(const u_char *pd, int offset, packet_counts *ld)
}
/* Convert the LLC length from the 802.3 header to a total
- length, by adding in the Ethernet header size, and set
- the payload and captured-payload lengths to the minima
+ frame length, by adding in the size of any data that preceded
+ the Ethernet header, and adding in the Ethernet header size,
+ and set the payload and captured-payload lengths to the minima
of the total length and the frame lengths. */
- length += ETH_HEADER_SIZE;
+ length += offset + ETH_HEADER_SIZE;
if (pi.len > length)
pi.len = length;
if (pi.captured_len > length)
@@ -122,7 +123,8 @@ capture_eth(const u_char *pd, int offset, packet_counts *ld)
}
void
-dissect_eth(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
+dissect_eth(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
+{
guint16 etype, length;
proto_tree *fh_tree = NULL;
proto_item *ti;
@@ -177,10 +179,11 @@ dissect_eth(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
}
/* Convert the LLC length from the 802.3 header to a total
- length, by adding in the Ethernet header size, and set
- the payload and captured-payload lengths to the minima
+ frame length, by adding in the size of any data that preceded
+ the Ethernet header, and adding in the Ethernet header size,
+ and set the payload and captured-payload lengths to the minima
of the total length and the frame lengths. */
- length += ETH_HEADER_SIZE;
+ length += offset + ETH_HEADER_SIZE;
if (pi.len > length)
pi.len = length;
if (pi.captured_len > length)