diff options
author | Jim Young <jyoung@gsu.edu> | 2017-01-20 07:59:12 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-01-22 10:39:31 +0000 |
commit | b83bbd92b5763a29ef352fa2162496c6ba3640b0 (patch) | |
tree | fd2421920e3994292a20674033b3f86a6fac0634 /epan/dissectors | |
parent | 7722003908ade4d36365c0a11e8a37895edfc066 (diff) |
packet-frame: Make interface_name a filterable field.
Change-Id: I1cc180abd7e73e5aea55b1b7eef9dc4b0e66e164
Reviewed-on: https://code.wireshark.org/review/19692
Petri-Dish: Jim Young <jim.young.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-frame.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 52592d54ff..509c8ca2c7 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -73,6 +73,7 @@ static int hf_frame_protocols = -1; static int hf_frame_color_filter_name = -1; static int hf_frame_color_filter_text = -1; static int hf_frame_interface_id = -1; +static int hf_frame_interface_name = -1; static int hf_frame_pack_flags = -1; static int hf_frame_pack_direction = -1; static int hf_frame_pack_reception_type = -1; @@ -90,6 +91,7 @@ static int hf_frame_wtap_encap = -1; static int hf_comments_text = -1; static gint ett_frame = -1; +static gint ett_ifname = -1; static gint ett_flags = -1; static gint ett_comments = -1; @@ -338,13 +340,22 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* fh_tree = proto_item_add_subtree(ti, ett_frame); - if (pinfo->phdr->presence_flags & WTAP_HAS_INTERFACE_ID && proto_field_is_referenced(tree, hf_frame_interface_id)) { + if (pinfo->phdr->presence_flags & WTAP_HAS_INTERFACE_ID && + (proto_field_is_referenced(tree, hf_frame_interface_id) || + proto_field_is_referenced(tree, hf_frame_interface_name))) { const char *interface_name = epan_get_interface_name(pinfo->epan, pinfo->phdr->interface_id); - if (interface_name) - proto_tree_add_uint_format_value(fh_tree, hf_frame_interface_id, tvb, 0, 0, pinfo->phdr->interface_id, "%u (%s)", pinfo->phdr->interface_id, interface_name); - else + if (interface_name) { + proto_tree *if_tree; + proto_item *if_item; + if_item = proto_tree_add_uint_format_value(fh_tree, hf_frame_interface_id, tvb, 0, 0, + pinfo->phdr->interface_id, "%u (%s)", + pinfo->phdr->interface_id, interface_name); + if_tree = proto_item_add_subtree(if_item, ett_ifname); + proto_tree_add_string(if_tree, hf_frame_interface_name, tvb, 0, 0, interface_name); + } else { proto_tree_add_uint(fh_tree, hf_frame_interface_id, tvb, 0, 0, pinfo->phdr->interface_id); + } } if (pinfo->phdr->presence_flags & WTAP_HAS_PACK_FLAGS) { @@ -799,6 +810,11 @@ proto_register_frame(void) FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_frame_interface_name, + { "Interface name", "frame.interface_name", + FT_STRING, BASE_NONE, NULL, 0x0, + "The friendly name for this interface", HFILL }}, + { &hf_frame_pack_flags, { "Packet flags", "frame.packet_flags", FT_UINT32, BASE_HEX, NULL, 0x0, @@ -878,6 +894,7 @@ proto_register_frame(void) static gint *ett[] = { &ett_frame, + &ett_ifname, &ett_flags, &ett_comments }; |