diff options
author | sake <sake@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-12-16 00:35:34 +0000 |
---|---|---|
committer | sake <sake@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-12-16 00:35:34 +0000 |
commit | 75288b3b78fc89a0c24bc3f337a3534539a18961 (patch) | |
tree | d8fefa1faa3421049a7179dac2ce36f13e8644ae | |
parent | 746658e3964c58bcc1242db715677a78e55cd96d (diff) |
Big 2104 - From Benn Bollay:
This patch adds a heuristic dissector to the ethernet trailer under the
keystring "eth.trailer". This allows for other protocol plugins which coopt
the ethernet trailer for their own devices to register for trailer traffic
without requiring any further changes to the executable.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23880 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | epan/dissectors/packet-eth.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-eth.h | 5 | ||||
-rw-r--r-- | epan/dissectors/packet-ethertype.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee8023.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-isl.c | 2 |
5 files changed, 23 insertions, 14 deletions
diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c index 39cb919636..743ff1a435 100644 --- a/epan/dissectors/packet-eth.c +++ b/epan/dissectors/packet-eth.c @@ -59,6 +59,7 @@ static gint ett_addr = -1; static dissector_handle_t fw1_handle; static heur_dissector_list_t heur_subdissector_list; +static heur_dissector_list_t eth_trailer_subdissector_list; static int eth_tap = -1; @@ -376,8 +377,8 @@ static gboolean chek_is_802_2(tvbuff_t *tvb) * it does, maybe it doesn't"), we try to infer whether it has an FCS. */ void -add_ethernet_trailer(proto_tree *fh_tree, int trailer_id, tvbuff_t *tvb, - tvbuff_t *trailer_tvb, int fcs_len) +add_ethernet_trailer(packet_info *pinfo, proto_tree *fh_tree, int trailer_id, + tvbuff_t *tvb, tvbuff_t *trailer_tvb, int fcs_len) { /* If there're some bytes left over, show those bytes as a trailer. @@ -389,8 +390,14 @@ add_ethernet_trailer(proto_tree *fh_tree, int trailer_id, tvbuff_t *tvb, guint trailer_length, trailer_reported_length; gboolean has_fcs = FALSE; + if (dissector_try_heuristic(eth_trailer_subdissector_list, trailer_tvb, + pinfo, fh_tree)) { + return; + } + trailer_length = tvb_length(trailer_tvb); trailer_reported_length = tvb_reported_length(trailer_tvb); + if (fcs_len != 0) { /* If fcs_len is 4, we assume we definitely have an FCS. Otherwise, then, if the frame is big enough that, if we @@ -527,6 +534,7 @@ proto_register_eth(void) /* subdissector code */ register_heur_dissector_list("eth", &heur_subdissector_list); + register_heur_dissector_list("eth.trailer", ð_trailer_subdissector_list); /* Register configuration preferences */ eth_module = prefs_register_protocol(proto_eth, NULL); diff --git a/epan/dissectors/packet-eth.h b/epan/dissectors/packet-eth.h index 35b9c252f0..58471d6592 100644 --- a/epan/dissectors/packet-eth.h +++ b/epan/dissectors/packet-eth.h @@ -32,7 +32,8 @@ typedef struct _eth_hdr { void capture_eth(const guchar *, int, int, packet_counts *); -void add_ethernet_trailer(proto_tree *fh_tree, int trailer_id, tvbuff_t *tvb, - tvbuff_t *trailer_tvb, int fcs_len); +void add_ethernet_trailer(packet_info *pinfo, proto_tree *fh_tree, + int trailer_id, tvbuff_t *tvb, tvbuff_t *trailer_tvb, + int fcs_len); #endif diff --git a/epan/dissectors/packet-ethertype.c b/epan/dissectors/packet-ethertype.c index 203fe6918e..a524983b9a 100644 --- a/epan/dissectors/packet-ethertype.c +++ b/epan/dissectors/packet-ethertype.c @@ -142,9 +142,9 @@ const value_string etype_vals[] = { {ETHERTYPE_PTP, "PTPv2 over Ethernet (IEEE1588)"}, {0, NULL } }; -static void add_dix_trailer(proto_tree *fh_tree, int trailer_id, tvbuff_t *tvb, - tvbuff_t *next_tvb, int offset_after_etype, guint length_before, - gint fcs_len); +static void add_dix_trailer(packet_info *pinfo, proto_tree *fh_tree, + int trailer_id, tvbuff_t *tvb, tvbuff_t *next_tvb, int offset_after_etype, + guint length_before, gint fcs_len); void capture_ethertype(guint16 etype, const guchar *pd, int offset, int len, @@ -268,14 +268,14 @@ ethertype(guint16 etype, tvbuff_t *tvb, int offset_after_etype, } } - add_dix_trailer(fh_tree, trailer_id, tvb, next_tvb, offset_after_etype, + add_dix_trailer(pinfo, fh_tree, trailer_id, tvb, next_tvb, offset_after_etype, length_before, fcs_len); } static void -add_dix_trailer(proto_tree *fh_tree, int trailer_id, tvbuff_t *tvb, - tvbuff_t *next_tvb, int offset_after_etype, guint length_before, - gint fcs_len) +add_dix_trailer(packet_info *pinfo, proto_tree *fh_tree, int trailer_id, + tvbuff_t *tvb, tvbuff_t *next_tvb, int offset_after_etype, + guint length_before, gint fcs_len) { guint length; tvbuff_t *trailer_tvb; @@ -311,7 +311,7 @@ add_dix_trailer(proto_tree *fh_tree, int trailer_id, tvbuff_t *tvb, } else trailer_tvb = NULL; /* no trailer */ - add_ethernet_trailer(fh_tree, trailer_id, tvb, trailer_tvb, fcs_len); + add_ethernet_trailer(pinfo, fh_tree, trailer_id, tvb, trailer_tvb, fcs_len); } void diff --git a/epan/dissectors/packet-ieee8023.c b/epan/dissectors/packet-ieee8023.c index eaae439b41..fafe261b1d 100644 --- a/epan/dissectors/packet-ieee8023.c +++ b/epan/dissectors/packet-ieee8023.c @@ -100,7 +100,7 @@ dissect_802_3(int length, gboolean is_802_2, tvbuff_t *tvb, } ENDTRY; - add_ethernet_trailer(fh_tree, trailer_id, tvb, trailer_tvb, fcs_len); + add_ethernet_trailer(pinfo, fh_tree, trailer_id, tvb, trailer_tvb, fcs_len); } void diff --git a/epan/dissectors/packet-isl.c b/epan/dissectors/packet-isl.c index 01189a674a..35c98be408 100644 --- a/epan/dissectors/packet-isl.c +++ b/epan/dissectors/packet-isl.c @@ -300,7 +300,7 @@ dissect_isl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int fcs_len) /* Now add the Ethernet trailer and FCS. XXX - do this only if we're encapsulated in Ethernet? */ - add_ethernet_trailer(fh_tree, hf_isl_trailer, tvb, trailer_tvb, fcs_len); + add_ethernet_trailer(pinfo, fh_tree, hf_isl_trailer, tvb, trailer_tvb, fcs_len); } break; |