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. svn path=/trunk/; revision=23880
This commit is contained in:
parent
9a2d18d386
commit
4f05930abe
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue