aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-09-05 01:39:35 +0000
committerMichael Mann <mmann78@netscape.net>2013-09-05 01:39:35 +0000
commit0c49b4d872c8d46cf4d28bf91f8861cf1bc0e122 (patch)
treec236fcc05e0fb91f87a5b628a5ca0a584c112757
parente65df7f453b4a2c7fcab788777c89c03eb12ed42 (diff)
Add filterable expert info to dissect_802_3() and clean up the shrapnel.
svn path=/trunk/; revision=51761
-rw-r--r--epan/dissectors/packet-cisco-metadata.c2
-rw-r--r--epan/dissectors/packet-eth.c6
-rw-r--r--epan/dissectors/packet-gmhdr.c4
-rw-r--r--epan/dissectors/packet-ieee8021ah.c2
-rw-r--r--epan/dissectors/packet-ieee8023.c6
-rw-r--r--epan/dissectors/packet-ieee8023.h2
-rw-r--r--epan/dissectors/packet-maccontrol.c1
-rw-r--r--epan/dissectors/packet-vlan.c11
8 files changed, 26 insertions, 8 deletions
diff --git a/epan/dissectors/packet-cisco-metadata.c b/epan/dissectors/packet-cisco-metadata.c
index 3642604674..53ba92b0b6 100644
--- a/epan/dissectors/packet-cisco-metadata.c
+++ b/epan/dissectors/packet-cisco-metadata.c
@@ -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;
diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c
index 0040ba2e2e..e4f72e9c8d 100644
--- a/epan/dissectors/packet-eth.c
+++ b/epan/dissectors/packet-eth.c
@@ -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;
diff --git a/epan/dissectors/packet-gmhdr.c b/epan/dissectors/packet-gmhdr.c
index 63e1adb68d..e9f78c3a48 100644
--- a/epan/dissectors/packet-gmhdr.c
+++ b/epan/dissectors/packet-gmhdr.c
@@ -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;
diff --git a/epan/dissectors/packet-ieee8021ah.c b/epan/dissectors/packet-ieee8021ah.c
index 499647ed33..5b0446462b 100644
--- a/epan/dissectors/packet-ieee8021ah.c
+++ b/epan/dissectors/packet-ieee8021ah.c
@@ -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"
diff --git a/epan/dissectors/packet-ieee8023.c b/epan/dissectors/packet-ieee8023.c
index 5cba83a3cd..dda7bc73a5 100644
--- a/epan/dissectors/packet-ieee8023.c
+++ b/epan/dissectors/packet-ieee8023.c
@@ -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. */
diff --git a/epan/dissectors/packet-ieee8023.h b/epan/dissectors/packet-ieee8023.h
index fec7a03b31..7173d40fab 100644
--- a/epan/dissectors/packet-ieee8023.h
+++ b/epan/dissectors/packet-ieee8023.h
@@ -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
diff --git a/epan/dissectors/packet-maccontrol.c b/epan/dissectors/packet-maccontrol.c
index 868566297f..76f7afad77 100644
--- a/epan/dissectors/packet-maccontrol.c
+++ b/epan/dissectors/packet-maccontrol.c
@@ -31,7 +31,6 @@
#include <glib.h>
#include <epan/packet.h>
-#include "packet-ieee8023.h"
#include "packet-llc.h"
#include <epan/etypes.h>
diff --git a/epan/dissectors/packet-vlan.c b/epan/dissectors/packet-vlan.c
index dbddf10758..340baf969d 100644
--- a/epan/dissectors/packet-vlan.c
+++ b/epan/dissectors/packet-vlan.c
@@ -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",