aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-vlan.c
diff options
context:
space:
mode:
authorUli Heilmeier <uh@heilmeier.eu>2016-03-13 23:16:20 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2016-03-18 05:41:36 +0000
commite1d54cfc3e8223bb4334e5aeed019dab35528e9b (patch)
treeab97ecbc78feb49dcd60f7b0bc053ac1954dfe5f /epan/dissectors/packet-vlan.c
parenteb6abe3a75f80776865332d4c28977a348b09a52 (diff)
IEEE 802.1Q/VLAN: Resolve ID to a describing name
A vlans file in the personal preference directory add an option to resolve VLAN IDs to a describing name. Format of vlan file is 123\tName of VLAN To enable the resolving the preference nameres.vlan_name must be set to TRUE. Bug: 11209 Change-Id: I3f00b4897aace89c03c57b68b6c4b6c8b7d4685a Reviewed-on: https://code.wireshark.org/review/14471 Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-vlan.c')
-rw-r--r--epan/dissectors/packet-vlan.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/epan/dissectors/packet-vlan.c b/epan/dissectors/packet-vlan.c
index 05ba381dac..915129b573 100644
--- a/epan/dissectors/packet-vlan.c
+++ b/epan/dissectors/packet-vlan.c
@@ -34,6 +34,7 @@
#include <epan/etypes.h>
#include <epan/prefs.h>
#include <epan/to_str.h>
+#include <epan/addr_resolv.h>
void proto_register_vlan(void);
void proto_reg_handoff_vlan(void);
@@ -81,6 +82,10 @@ static header_field_info hfi_vlan_id VLAN_HFI_INIT = {
"ID", "vlan.id", FT_UINT16, BASE_DEC,
NULL, 0x0FFF, "VLAN ID", HFILL };
+static header_field_info hfi_vlan_id_name VLAN_HFI_INIT = {
+ "Name", "vlan.id_name", FT_STRING, STR_UNICODE,
+ NULL, 0x0, "VLAN ID Name", HFILL };
+
static header_field_info hfi_vlan_etype VLAN_HFI_INIT = {
"Type", "vlan.etype", FT_UINT16, BASE_HEX,
VALS(etype_vals), 0x0, "Ethertype", HFILL };
@@ -141,6 +146,7 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
guint16 encap_proto;
gboolean is_802_2;
proto_tree *vlan_tree;
+ proto_item *item;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "VLAN");
col_clear(pinfo->cinfo, COL_INFO);
@@ -169,6 +175,14 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
proto_tree_add_item(vlan_tree, &hfi_vlan_priority, tvb, 0, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(vlan_tree, &hfi_vlan_cfi, tvb, 0, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(vlan_tree, &hfi_vlan_id, tvb, 0, 2, ENC_BIG_ENDIAN);
+
+ if (gbl_resolv_flags.vlan_name) {
+ item = proto_tree_add_string(vlan_tree, &hfi_vlan_id_name, tvb, 0, 2,
+ get_vlan_name(wmem_packet_scope(), vlan_id));
+ PROTO_ITEM_SET_GENERATED(item);
+
+ }
+
}
encap_proto = tvb_get_ntohs(tvb, 2);
@@ -214,6 +228,7 @@ proto_register_vlan(void)
&hfi_vlan_priority,
&hfi_vlan_cfi,
&hfi_vlan_id,
+ &hfi_vlan_id_name,
&hfi_vlan_etype,
&hfi_vlan_len,
&hfi_vlan_trailer,