diff options
Diffstat (limited to 'epan/dissectors/packet-eth.c')
-rw-r--r-- | epan/dissectors/packet-eth.c | 66 |
1 files changed, 55 insertions, 11 deletions
diff --git a/epan/dissectors/packet-eth.c b/epan/dissectors/packet-eth.c index 06bbd86b6f..eec1d2e7d6 100644 --- a/epan/dissectors/packet-eth.c +++ b/epan/dissectors/packet-eth.c @@ -49,10 +49,13 @@ static int hf_eth_src = -1; static int hf_eth_len = -1; static int hf_eth_type = -1; static int hf_eth_addr = -1; +static int hf_eth_multicast = -1; +static int hf_eth_local_admin = -1; static int hf_eth_trailer = -1; static gint ett_ieee8023 = -1; static gint ett_ether2 = -1; +static gint ett_addr = -1; static dissector_handle_t fw1_handle; static heur_dissector_list_t heur_subdissector_list; @@ -61,6 +64,15 @@ static int eth_tap = -1; #define ETH_HEADER_SIZE 14 +static const true_false_string multicast_tfs = { + "This is a MULTICAST frame", + "This is a UNICAST frame" +}; +static const true_false_string local_admin_tfs = { + "This is NOT a factory default address", + "This is a FACTORY DEFAULT address" +}; + /* These are the Netware-ish names for the different Ethernet frame types. EthernetII: The ethernet with a Type field instead of a length field Ethernet802.2: An 802.3 header followed by an 802.2 header @@ -171,6 +183,8 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, static eth_hdr ehdrs[4]; static int ehdr_num=0; proto_tree *volatile tree; + proto_item *addr_item; + proto_tree *addr_tree=NULL; ehdr_num++; if(ehdr_num>=4){ @@ -274,12 +288,21 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fh_tree=NULL; } - proto_tree_add_ether(fh_tree, hf_eth_dst, tvb, 0, 6, dst_addr); - proto_tree_add_ether(fh_tree, hf_eth_src, tvb, 6, 6, src_addr); + addr_item=proto_tree_add_ether(fh_tree, hf_eth_dst, tvb, 0, 6, dst_addr); + if(addr_item){ + addr_tree = proto_item_add_subtree(addr_item, ett_addr); + } + proto_tree_add_ether(addr_tree, hf_eth_addr, tvb, 0, 6, dst_addr); + proto_tree_add_item(addr_tree, hf_eth_multicast, tvb, 0, 3, FALSE); + proto_tree_add_item(addr_tree, hf_eth_local_admin, tvb, 0, 3, FALSE); -/* add items for eth.addr filter */ - proto_tree_add_ether_hidden(fh_tree, hf_eth_addr, tvb, 0, 6, dst_addr); - proto_tree_add_ether_hidden(fh_tree, hf_eth_addr, tvb, 6, 6, src_addr); + addr_item=proto_tree_add_ether(fh_tree, hf_eth_src, tvb, 6, 6, src_addr); + if(addr_item){ + addr_tree = proto_item_add_subtree(addr_item, ett_addr); + } + proto_tree_add_ether(addr_tree, hf_eth_addr, tvb, 6, 6, src_addr); + proto_tree_add_item(addr_tree, hf_eth_multicast, tvb, 6, 3, FALSE); + proto_tree_add_item(addr_tree, hf_eth_local_admin, tvb, 6, 3, FALSE); 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); @@ -302,11 +325,21 @@ dissect_eth_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, fh_tree = proto_item_add_subtree(ti, ett_ether2); } - proto_tree_add_ether(fh_tree, hf_eth_dst, tvb, 0, 6, dst_addr); - proto_tree_add_ether(fh_tree, hf_eth_src, tvb, 6, 6, src_addr); -/* add items for eth.addr filter */ - proto_tree_add_ether_hidden(fh_tree, hf_eth_addr, tvb, 0, 6, dst_addr); - proto_tree_add_ether_hidden(fh_tree, hf_eth_addr, tvb, 6, 6, src_addr); + addr_item=proto_tree_add_ether(fh_tree, hf_eth_dst, tvb, 0, 6, dst_addr); + if(addr_item){ + addr_tree = proto_item_add_subtree(addr_item, ett_addr); + } + proto_tree_add_ether(addr_tree, hf_eth_addr, tvb, 0, 6, dst_addr); + proto_tree_add_item(addr_tree, hf_eth_multicast, tvb, 0, 3, FALSE); + proto_tree_add_item(addr_tree, hf_eth_local_admin, tvb, 0, 3, FALSE); + + addr_item=proto_tree_add_ether(fh_tree, hf_eth_src, tvb, 6, 6, src_addr); + if(addr_item){ + addr_tree = proto_item_add_subtree(addr_item, ett_addr); + } + proto_tree_add_ether(addr_tree, hf_eth_addr, tvb, 6, 6, src_addr); + proto_tree_add_item(addr_tree, hf_eth_multicast, tvb, 6, 3, FALSE); + proto_tree_add_item(addr_tree, hf_eth_local_admin, tvb, 6, 3, FALSE); ethertype(ehdr->type, tvb, ETH_HEADER_SIZE, pinfo, parent_tree, fh_tree, hf_eth_type, hf_eth_trailer, fcs_len); @@ -444,17 +477,28 @@ proto_register_eth(void) { "Type", "eth.type", FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0, "", HFILL }}, { &hf_eth_addr, - { "Source or Destination Address", "eth.addr", FT_ETHER, BASE_NONE, NULL, 0x0, + { "Address", "eth.addr", FT_ETHER, BASE_NONE, NULL, 0x0, "Source or Destination Hardware Address", HFILL }}, { &hf_eth_trailer, { "Trailer", "eth.trailer", FT_BYTES, BASE_NONE, NULL, 0x0, "Ethernet Trailer or Checksum", HFILL }}, + { &hf_eth_multicast, + { "Multicast", "eth.multicast", FT_BOOLEAN, 24, + VALS(&multicast_tfs), 0x010000, + "Whether this is a multicast frame or not", HFILL }}, + + { &hf_eth_local_admin, + { "Locally Administrated Address", "eth.local_admin", FT_BOOLEAN, 24, + VALS(&local_admin_tfs), 0x020000, + "Whether this is a \"factory default\" address or not", HFILL }}, + }; static gint *ett[] = { &ett_ieee8023, &ett_ether2, + &ett_addr, }; module_t *eth_module; |