From cb89fdd1f664d68dcf3ed5251a4d3d43fe9504e4 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Mon, 9 Oct 2017 15:17:32 -0400 Subject: Add support for BASE_OUI Modeled after BASE_PT_XXX, this will format a FT_UINT24 to look a OUI, in the form of: XX:XX:XX (Manufacturer Name) for display. For display filtering, it will treat the value as hexadecimal. It requires that FT_UINT24 be the field type. Change-Id: I8716ae4dfcd4e854764a2425e2ff13c50f571d52 Reviewed-on: https://code.wireshark.org/review/23869 Reviewed-by: Richard Sharpe Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-ossp.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'epan/dissectors/packet-ossp.c') diff --git a/epan/dissectors/packet-ossp.c b/epan/dissectors/packet-ossp.c index 2d524d72e7..bee1be7a4d 100644 --- a/epan/dissectors/packet-ossp.c +++ b/epan/dissectors/packet-ossp.c @@ -226,24 +226,21 @@ dissect_ossp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data { gint offset = 0; const gchar *str; - proto_item *oui_item, *ossp_item; + proto_item *ossp_item; proto_tree *ossp_tree; tvbuff_t *ossp_tvb; + guint32 oui; const guint8 itu_oui[] = {ITU_OUI_0, ITU_OUI_1, ITU_OUI_2}; - /* OUI of the organization defining the protocol */ - str = tvb_get_manuf_name(tvb, offset); - col_set_str(pinfo->cinfo, COL_PROTOCOL, "OSSP"); - col_add_fstr(pinfo->cinfo, COL_INFO, "OUI: %s", str); ossp_item = proto_tree_add_protocol_format(tree, proto_ossp, tvb, 0, -1, "Organization Specific Slow Protocol"); ossp_tree = proto_item_add_subtree(ossp_item, ett_ossppdu); - oui_item = proto_tree_add_item(ossp_tree, hf_ossp_oui, - tvb, offset, OUI_SIZE, ENC_NA); - proto_item_append_text(oui_item, " (%s)", str); + proto_tree_add_item_ret_uint(ossp_tree, hf_ossp_oui, tvb, offset, OUI_SIZE, ENC_BIG_ENDIAN, &oui); + str = uint_get_manuf_name_if_known(oui); + col_add_fstr(pinfo->cinfo, COL_INFO, "OUI: %s", (str != NULL) ? str : "(Unknown OSSP organization)"); offset += 3; /* @@ -266,10 +263,7 @@ dissect_ossp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data dissect_yyy_ossp(ossp_tvb, pinfo, ossp_tree); } #endif - else - { - proto_item_append_text(oui_item, " (Unknown OSSP organization)"); - } + return tvb_captured_length(tvb); } @@ -569,7 +563,7 @@ proto_register_ossp(void) static hf_register_info hf[] = { { &hf_ossp_oui, { "OUI", "ossp.oui", - FT_BYTES, BASE_NONE, NULL, 0, + FT_UINT24, BASE_OUI, NULL, 0, "IEEE assigned Organizationally Unique Identifier", HFILL }}, { &hf_itu_subtype, -- cgit v1.2.3