aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-vntag.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-11-20 02:28:14 +0000
committerMichael Mann <mmann78@netscape.net>2013-11-20 02:28:14 +0000
commitf34e11fabead2968fab30e5c3caab8b377aaa287 (patch)
treee2711798ee2270721ea8aca29b2419bbe78bcf5a /epan/dissectors/packet-vntag.c
parentea278d3bf871239989365121270410930f197377 (diff)
Convert ethertype() function into a pure dissector. Bug 9454 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9454)
The main driving force for this was my new Decode As functionality (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9450) that wants a dissector/subdissector table relationship for all dissectors wanting to use Decode As functionality. The ethertype() function provides the value to the "ethertype" subdissector table, so I think it should be matched to a dissector. Only odd side effect is the display filter of "ethertype" returns no packets because there is no "item" associated with the dissector. svn path=/trunk/; revision=53443
Diffstat (limited to 'epan/dissectors/packet-vntag.c')
-rw-r--r--epan/dissectors/packet-vntag.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/epan/dissectors/packet-vntag.c b/epan/dissectors/packet-vntag.c
index 37c9d67743..34ef62426f 100644
--- a/epan/dissectors/packet-vntag.c
+++ b/epan/dissectors/packet-vntag.c
@@ -27,6 +27,8 @@
#include <epan/packet.h>
#include <epan/etypes.h>
+static dissector_handle_t ethertype_handle;
+
static int proto_vntag = -1;
static int hf_vntag_etype = -1;
@@ -40,6 +42,7 @@ dissect_vntag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint16 encap_proto;
proto_tree *vntag_tree = NULL;
+ ethertype_data_t ethertype_data;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "VNTAG");
col_clear(pinfo->cinfo, COL_INFO);
@@ -87,9 +90,19 @@ dissect_vntag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
dissect_802_3(encap_proto, is_802_2, tvb, 4, pinfo, tree, vntag_tree, hf_vntag_len, hf_vntag_trailer, 0);
- } else
+ } else {
+#endif
+ ethertype_data.etype = encap_proto;
+ ethertype_data.offset_after_ethertype = 6;
+ ethertype_data.fh_tree = vntag_tree;
+ ethertype_data.etype_id = hf_vntag_etype;
+ ethertype_data.trailer_id = hf_vntag_trailer;
+ ethertype_data.fcs_len = 0;
+
+ call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, &ethertype_data);
+#if 0
+ }
#endif
- ethertype(encap_proto, tvb, 6, pinfo, tree, vntag_tree, hf_vntag_etype, hf_vntag_trailer, 0);
}
void
@@ -127,4 +140,6 @@ proto_reg_handoff_vntag(void)
vntag_handle = create_dissector_handle(dissect_vntag, proto_vntag);
dissector_add_uint("ethertype", 0x8926, vntag_handle);
+
+ ethertype_handle = find_dissector("ethertype");
}