diff options
author | Anders Broman <anders.broman@ericsson.com> | 2019-03-18 17:13:26 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-03-19 09:53:55 +0000 |
commit | 50408de7628c96cfe49b808c4565b8b1a7d74a84 (patch) | |
tree | 125df76123b63cfe0c1c4eaf33c5084d92a5e4a2 /epan/dissectors/packet-vlan.c | |
parent | 879c05335ffb01d1bc7a6c34d1f47ba022e6b01c (diff) |
vlan: Use proto_tree_add_bitmask_list() to add flags.
Change-Id: I1c71e9d4a672cd5781ac9aebd0c0ac7c01f83e1f
Reviewed-on: https://code.wireshark.org/review/32469
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-vlan.c')
-rw-r--r-- | epan/dissectors/packet-vlan.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/epan/dissectors/packet-vlan.c b/epan/dissectors/packet-vlan.c index 8f23257465..01bcd72645 100644 --- a/epan/dissectors/packet-vlan.c +++ b/epan/dissectors/packet-vlan.c @@ -238,6 +238,14 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ proto_tree *vlan_tree; proto_item *item; guint vlan_nested_count; + int hf1, hf2; + + int * flags[] = { + &hf1, + &hf2, + &hfi_vlan_id.id, + NULL + }; col_set_str(pinfo->cinfo, COL_PROTOCOL, "VLAN"); col_clear(pinfo->cinfo, COL_INFO); @@ -276,34 +284,36 @@ dissect_vlan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ vlan_tree = proto_item_add_subtree(ti, ett_vlan); if (vlan_version == IEEE_8021Q_1998) { - proto_tree_add_item(vlan_tree, &hfi_vlan_priority_old, tvb, 0, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(vlan_tree, &hfi_vlan_cfi, tvb, 0, 2, ENC_BIG_ENDIAN); + hf1 = hfi_vlan_priority_old.id; + hf2 = hfi_vlan_cfi.id; } else { switch (vlan_priority_drop) { case Priority_Drop_8P0D: - proto_tree_add_item(vlan_tree, &hfi_vlan_priority, tvb, 0, 2, ENC_BIG_ENDIAN); + hf1 = hfi_vlan_priority.id; break; case Priority_Drop_7P1D: - proto_tree_add_item(vlan_tree, &hfi_vlan_priority_7, tvb, 0, 2, ENC_BIG_ENDIAN); + hf1 = hfi_vlan_priority_7.id; break; case Priority_Drop_6P2D: - proto_tree_add_item(vlan_tree, &hfi_vlan_priority_6, tvb, 0, 2, ENC_BIG_ENDIAN); + hf1 = hfi_vlan_priority_6.id; break; case Priority_Drop_5P3D: - proto_tree_add_item(vlan_tree, &hfi_vlan_priority_5, tvb, 0, 2, ENC_BIG_ENDIAN); + hf1 = hfi_vlan_priority_5.id; break; } if (vlan_version == IEEE_8021Q_2005) { - proto_tree_add_item(vlan_tree, &hfi_vlan_cfi, tvb, 0, 2, ENC_BIG_ENDIAN); + hf2 = hfi_vlan_cfi.id; } else { - proto_tree_add_item(vlan_tree, &hfi_vlan_dei, tvb, 0, 2, ENC_BIG_ENDIAN); + hf2 = hfi_vlan_dei.id; } } - proto_tree_add_item(vlan_tree, &hfi_vlan_id, tvb, 0, 2, ENC_BIG_ENDIAN); + + proto_tree_add_bitmask_list(vlan_tree, tvb, 0, 2, (const int **)flags, 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)); |