aboutsummaryrefslogtreecommitdiffstats
path: root/packet-eth.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-02-09 00:35:38 +0000
committerGuy Harris <guy@alum.mit.edu>1999-02-09 00:35:38 +0000
commit75305346b532da113629c21311817099305762f3 (patch)
tree80d9f3e8a36588385000c9c9e0ffd34ab77c7629 /packet-eth.c
parentfacb50396007c70e5616ff61a4aa22ff43e44001 (diff)
downloadwireshark-75305346b532da113629c21311817099305762f3.tar.gz
wireshark-75305346b532da113629c21311817099305762f3.tar.bz2
wireshark-75305346b532da113629c21311817099305762f3.zip
When doing a capture, decode enough of the incoming packets to correctly
update the packet counts and percentages in the dialog box popped up during a capture, even for non-Ethernet captures. svn path=/trunk/; revision=184
Diffstat (limited to 'packet-eth.c')
-rw-r--r--packet-eth.c61
1 files changed, 50 insertions, 11 deletions
diff --git a/packet-eth.c b/packet-eth.c
index 57ef1fcc46..51c41f080c 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.7 1998/11/17 04:28:52 gerald Exp $
+ * $Id: packet-eth.c,v 1.8 1999/02/09 00:35:36 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -56,6 +56,46 @@
#define ETHERNET_SNAP 3
void
+capture_eth(const u_char *pd, guint32 cap_len, packet_counts *ld) {
+ guint16 etype;
+ int offset = 14;
+ int ethhdr_type; /* the type of ethernet frame */
+
+ etype = (pd[12] << 8) | pd[13];
+
+ /* either ethernet802.3 or ethernet802.2 */
+ if (etype <= IEEE_802_3_MAX_LEN) {
+
+ /* Is there an 802.2 layer? I can tell by looking at the first 2
+ bytes after the 802.3 header. If they are 0xffff, then what
+ follows the 802.3 header is an IPX payload, meaning no 802.2.
+ (IPX/SPX is they only thing that can be contained inside a
+ straight 802.3 packet). A non-0xffff value means that there's an
+ 802.2 layer inside the 802.3 layer */
+ if (pd[14] == 0xff && pd[15] == 0xff) {
+ ethhdr_type = ETHERNET_802_3;
+ }
+ else {
+ ethhdr_type = ETHERNET_802_2;
+ }
+ } else {
+ ethhdr_type = ETHERNET_II;
+ }
+
+ switch (ethhdr_type) {
+ case ETHERNET_802_3:
+ ld->other++; /* IPX */
+ break;
+ case ETHERNET_802_2:
+ capture_llc(pd, offset, cap_len, ld);
+ break;
+ case ETHERNET_II:
+ capture_ethertype(etype, offset, pd, cap_len, ld);
+ break;
+ }
+}
+
+void
dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) {
guint16 etype, length;
int offset = 14;
@@ -126,17 +166,16 @@ dissect_eth(const u_char *pd, frame_data *fd, GtkTree *tree) {
}
}
- /* either ethernet802.3 or ethernet802.2 */
switch (ethhdr_type) {
- case ETHERNET_802_3:
- dissect_ipx(pd, offset, fd, tree);
- return;
- case ETHERNET_802_2:
- dissect_llc(pd, offset, fd, tree);
- return;
+ case ETHERNET_802_3:
+ dissect_ipx(pd, offset, fd, tree);
+ break;
+ case ETHERNET_802_2:
+ dissect_llc(pd, offset, fd, tree);
+ break;
+ case ETHERNET_II:
+ ethertype(etype, offset, pd, fd, tree, fh_tree);
+ break;
}
-
- /* Ethernet_II */
- ethertype(etype, offset, pd, fd, tree, fh_tree);
}