forked from osmocom/wireshark
Add filterable expert info to dissect_802_3() and clean up the shrapnel.
svn path=/trunk/; revision=51761
This commit is contained in:
parent
e65df7f453
commit
0c49b4d872
|
@ -28,7 +28,9 @@
|
|||
#include <glib.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/etypes.h>
|
||||
#if 0
|
||||
#include "packet-ieee8023.h"
|
||||
#endif
|
||||
|
||||
static int proto_cmd = -1;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <epan/prefs.h>
|
||||
#include <epan/etypes.h>
|
||||
#include <epan/addr_resolv.h>
|
||||
#include <epan/expert.h>
|
||||
#include "packet-eth.h"
|
||||
#include "packet-ieee8023.h"
|
||||
#include "packet-ipx.h"
|
||||
|
@ -38,7 +39,6 @@
|
|||
#include "packet-usb.h"
|
||||
#include <epan/crc32-tvb.h>
|
||||
#include <epan/tap.h>
|
||||
#include <epan/expert.h>
|
||||
|
||||
void proto_register_eth(void);
|
||||
void proto_reg_handoff_eth(void);
|
||||
|
@ -84,6 +84,7 @@ static gint ett_eth_fcs = -1;
|
|||
static expert_field ei_eth_invalid_lentype = EI_INIT;
|
||||
static expert_field ei_eth_src_not_group = EI_INIT;
|
||||
static expert_field ei_eth_fcs_bad = EI_INIT;
|
||||
static expert_field ei_eth_len = EI_INIT;
|
||||
|
||||
static dissector_handle_t fw1_handle;
|
||||
static dissector_handle_t data_handle;
|
||||
|
@ -397,7 +398,7 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
|
|||
proto_tree_add_item(addr_tree, hf_eth_ig, tvb, 6, 3, ENC_BIG_ENDIAN);
|
||||
|
||||
dissect_802_3(ehdr->type, is_802_2, tvb, ETH_HEADER_SIZE, pinfo,
|
||||
parent_tree, fh_tree, hf_eth_len, hf_eth_trailer, fcs_len);
|
||||
parent_tree, fh_tree, hf_eth_len, hf_eth_trailer, &ei_eth_len, fcs_len);
|
||||
} else {
|
||||
if (eth_interpret_as_fw1_monitor) {
|
||||
if ((dst_addr[0] == 'i') || (dst_addr[0] == 'I') ||
|
||||
|
@ -843,6 +844,7 @@ proto_register_eth(void)
|
|||
{ &ei_eth_invalid_lentype, { "eth.invalid_lentype", PI_PROTOCOL, PI_WARN, "Invalid length/type", EXPFILL }},
|
||||
{ &ei_eth_src_not_group, { "eth.src_not_group", PI_PROTOCOL, PI_WARN, "Source MAC must not be a group address: IEEE 802.3-2002, Section 3.2.3(b)", EXPFILL }},
|
||||
{ &ei_eth_fcs_bad, { "eth.fcs_bad.expert", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
|
||||
{ &ei_eth_len, { "eth.len.past_end", PI_MALFORMED, PI_ERROR, "Length field value goes past the end of the payload", EXPFILL }},
|
||||
};
|
||||
|
||||
module_t *eth_module;
|
||||
|
|
|
@ -121,6 +121,7 @@ static gint ett_srcport = -1;
|
|||
static gint ett_gmtrailer = -1;
|
||||
|
||||
static expert_field ei_gmhdr_field_length_invalid = EI_INIT;
|
||||
static expert_field ei_gmhdr_len = EI_INIT;
|
||||
|
||||
static void
|
||||
dissect_gmtlv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gmhdr_tree, guint offset, guint16 length)
|
||||
|
@ -256,7 +257,7 @@ dissect_gmhdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
}
|
||||
|
||||
dissect_802_3(encap_proto, is_802_2, tvb, offset, pinfo, tree, gmhdr_tree,
|
||||
hf_gmhdr_len, hf_gmhdr_trailer, 0);
|
||||
hf_gmhdr_len, hf_gmhdr_trailer, &ei_gmhdr_len, 0);
|
||||
} else {
|
||||
ethertype(encap_proto, tvb, offset, pinfo, tree, gmhdr_tree,
|
||||
hf_gmhdr_etype, hf_gmhdr_trailer, 0);
|
||||
|
@ -461,6 +462,7 @@ proto_register_gmhdr(void)
|
|||
};
|
||||
static ei_register_info ei[] = {
|
||||
{ &ei_gmhdr_field_length_invalid, { "gmhdr.field_length_invalid", PI_MALFORMED, PI_ERROR, "Field length invalid", EXPFILL }},
|
||||
{ &ei_gmhdr_len, { "gmhdr.len.past_end", PI_MALFORMED, PI_ERROR, "Length field value goes past the end of the payload", EXPFILL }},
|
||||
};
|
||||
|
||||
module_t *gmhdr_module;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <glib.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/addr_resolv.h>
|
||||
#include "packet-ieee8023.h"
|
||||
|
||||
#include "packet-ieee8021ah.h"
|
||||
#include "packet-ipx.h"
|
||||
#include "packet-llc.h"
|
||||
|
|
|
@ -38,7 +38,7 @@ static dissector_handle_t ccsds_handle;
|
|||
void
|
||||
dissect_802_3(volatile int length, gboolean is_802_2, tvbuff_t *tvb,
|
||||
int offset_after_length, packet_info *pinfo, proto_tree *tree,
|
||||
proto_tree *fh_tree, int length_id, int trailer_id,
|
||||
proto_tree *fh_tree, int length_id, int trailer_id, expert_field* ei_len,
|
||||
int fcs_len)
|
||||
{
|
||||
proto_item *length_it;
|
||||
|
@ -65,8 +65,12 @@ dissect_802_3(volatile int length, gboolean is_802_2, tvbuff_t *tvb,
|
|||
the payload. */
|
||||
if (length > reported_length) {
|
||||
length = reported_length;
|
||||
expert_add_info(pinfo, length_it, ei_len);
|
||||
/*
|
||||
expert_add_info_format(pinfo, length_it, PI_MALFORMED, PI_ERROR,
|
||||
"Length field value goes past the end of the payload");
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
/* Give the next dissector only 'length' number of bytes. */
|
||||
|
|
|
@ -29,6 +29,6 @@
|
|||
|
||||
void dissect_802_3(volatile int length, gboolean is_802_2, tvbuff_t *tvb,
|
||||
int offset_after_length, packet_info *pinfo, proto_tree *tree,
|
||||
proto_tree *fh_tree, int length_id, int trailer_id, int fcs_len);
|
||||
proto_tree *fh_tree, int length_id, int trailer_id, expert_field* ei_len, int fcs_len);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <epan/packet.h>
|
||||
#include "packet-ieee8023.h"
|
||||
#include "packet-llc.h"
|
||||
#include <epan/etypes.h>
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/expert.h>
|
||||
#include "packet-ieee8023.h"
|
||||
#include "packet-ipx.h"
|
||||
#include "packet-llc.h"
|
||||
|
@ -49,6 +50,8 @@ static int hf_vlan_trailer = -1;
|
|||
|
||||
static gint ett_vlan = -1;
|
||||
|
||||
static expert_field ei_vlan_len = EI_INIT;
|
||||
|
||||
/* From Table G-2 of IEEE standard 802.1D-2004 */
|
||||
static const value_string pri_vals[] = {
|
||||
{ 1, "Background" },
|
||||
|
@ -142,7 +145,7 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
}
|
||||
|
||||
dissect_802_3(encap_proto, is_802_2, tvb, 4, pinfo, tree, vlan_tree,
|
||||
hf_vlan_len, hf_vlan_trailer, 0);
|
||||
hf_vlan_len, hf_vlan_trailer, &ei_vlan_len, 0);
|
||||
} else {
|
||||
ethertype(encap_proto, tvb, 4, pinfo, tree, vlan_tree,
|
||||
hf_vlan_etype, hf_vlan_trailer, 0);
|
||||
|
@ -175,11 +178,17 @@ proto_register_vlan(void)
|
|||
static gint *ett[] = {
|
||||
&ett_vlan
|
||||
};
|
||||
static ei_register_info ei[] = {
|
||||
{ &ei_vlan_len, { "vlan.len.past_end", PI_MALFORMED, PI_ERROR, "Length field value goes past the end of the payload", EXPFILL }},
|
||||
};
|
||||
module_t *vlan_module;
|
||||
expert_module_t* expert_vlan;
|
||||
|
||||
proto_vlan = proto_register_protocol("802.1Q Virtual LAN", "VLAN", "vlan");
|
||||
proto_register_field_array(proto_vlan, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
expert_vlan = expert_register_protocol(proto_vlan);
|
||||
expert_register_field_array(expert_vlan, ei, array_length(ei));
|
||||
|
||||
vlan_module = prefs_register_protocol(proto_vlan, proto_reg_handoff_vlan);
|
||||
prefs_register_bool_preference(vlan_module, "summary_in_tree",
|
||||
|
|
Loading…
Reference in New Issue