summaryrefslogtreecommitdiff
path: root/packet-eth.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-02-03 23:19:54 +0000
committerGuy Harris <guy@alum.mit.edu>2004-02-03 23:19:54 +0000
commit78461c0180dee2336db99b91cfd126dfbb4ecff3 (patch)
treeb788c711cc367cc7b12ebb25e4b0c2f39dfb1a13 /packet-eth.c
parent880010fbd1d7cd94a66c74a19025d6b4d5085984 (diff)
downloadwireshark-78461c0180dee2336db99b91cfd126dfbb4ecff3.tar.gz
From Peter J. Creath: add a heuristic dissector table, so that
dissectors for protocols that put non-802.3 packets inside 802.3 frames can intercept 802.3/Ethernet frames before they're dissected as 802.3/Ethernet packets. svn path=/trunk/; revision=9976
Diffstat (limited to 'packet-eth.c')
-rw-r--r--packet-eth.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/packet-eth.c b/packet-eth.c
index dbe2e8a6b7..ecfc644f3c 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.88 2003/10/01 07:11:44 guy Exp $
+ * $Id: packet-eth.c,v 1.89 2004/02/03 23:19:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -56,6 +56,7 @@ static gint ett_ether2 = -1;
static dissector_handle_t isl_handle;
static dissector_handle_t fw1_handle;
+static heur_dissector_list_t heur_subdissector_list;
static int eth_tap = -1;
@@ -190,6 +191,15 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
ehdr->type = tvb_get_ntohs(tvb, 12);
/*
+ * In case the packet is a non-Ethernet packet inside
+ * Ethernet framing, allow heuristic dissectors to take
+ * a first look before we assume that it's actually an
+ * Ethernet packet.
+ */
+ if (dissector_try_heuristic(heur_subdissector_list, tvb, pinfo, tree))
+ goto end_of_eth;
+
+ /*
* If the type/length field is <= the maximum 802.3 length,
* and is not zero, this is an 802.3 frame, and it's a length
* field; it might be an Novell "raw 802.3" frame, with no
@@ -425,6 +435,9 @@ proto_register_eth(void)
proto_register_field_array(proto_eth, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ /* subdissector code */
+ register_heur_dissector_list("eth", &heur_subdissector_list);
+
/* Register configuration preferences */
eth_module = prefs_register_protocol(proto_eth, NULL);
prefs_register_bool_preference(eth_module, "interpret_as_fw1_monitor",