diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2015-10-26 16:44:18 -0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-10-27 07:27:40 +0000 |
commit | 49894f023339463a11e97b482ff5780d1ee14efd (patch) | |
tree | 2b35f951b0d5c8db2b1c708ff8e207ceae8cc16c | |
parent | 484c31c66e6d16c2d56e8fed4c10a3293de47f97 (diff) |
Show the Experimental-Result-Code if we don't know have a subdissector for that
vendor ID.
Otherwise the value is simply not shown to the user.
Adding support for a vendor ID's Experimental Result Codes isn't as easy as
modifying the XML so don't add an expert info about it.
Change-Id: I65f2cb13853cc7141fb242fa03c6e474a6c02cb9
Reviewed-on: https://code.wireshark.org/review/11294
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/packet-diameter.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c index f2240eb037..66edf48607 100644 --- a/epan/dissectors/packet-diameter.c +++ b/epan/dissectors/packet-diameter.c @@ -272,6 +272,7 @@ static int hf_framed_ipv6_prefix_length = -1; static int hf_framed_ipv6_prefix_bytes = -1; static int hf_framed_ipv6_prefix_ipv6 = -1; static int hf_diameter_3gpp2_exp_res = -1; +static int hf_diameter_other_vendor_exp_res = -1; static gint ett_diameter = -1; static gint ett_diameter_flags = -1; @@ -464,7 +465,8 @@ static const value_string diameter_3gpp2_exp_res_vals[]= { }; static int -dissect_diameter_3gpp2_exp_res(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data) { +dissect_diameter_3gpp2_exp_res(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data) +{ proto_item *pi; diam_sub_dis_t *diam_sub_dis; @@ -483,6 +485,19 @@ dissect_diameter_3gpp2_exp_res(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree return 4; } +static void +dissect_diameter_other_vendor_exp_res(tvbuff_t *tvb, proto_tree *tree, diam_sub_dis_t *diam_sub_dis) +{ + proto_item *pi; + + if (tree) { + pi = proto_tree_add_item(tree, hf_diameter_other_vendor_exp_res, tvb, 0, 4, ENC_BIG_ENDIAN); + diam_sub_dis->avp_str = (char *)wmem_alloc(wmem_packet_scope(), ITEM_LABEL_LENGTH+1); + proto_item_fill_label(PITEM_FINFO(pi), diam_sub_dis->avp_str); + diam_sub_dis->avp_str = strstr(diam_sub_dis->avp_str,": ")+2; + } +} + /* From RFC 3162 section 2.3 */ static int dissect_diameter_base_framed_ipv6_prefix(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data) @@ -770,7 +785,12 @@ dissect_diameter_avp(diam_ctx_t *c, tvbuff_t *tvb, int offset, diam_sub_dis_t *d && (diam_sub_dis_inf->vendor_id != VENDOR_THE3GPP)) { /* call subdissector */ - dissector_try_uint_new(diameter_expr_result_vnd_table, diam_sub_dis_inf->vendor_id, subtvb, c->pinfo, avp_tree, FALSE, diam_sub_dis_inf); + if (!dissector_try_uint_new(diameter_expr_result_vnd_table, diam_sub_dis_inf->vendor_id, + subtvb, c->pinfo, avp_tree, FALSE, diam_sub_dis_inf)) { + /* No subdissector for this vendor ID, use the generic one */ + dissect_diameter_other_vendor_exp_res(subtvb, avp_tree, diam_sub_dis_inf); + } + if (diam_sub_dis_inf->avp_str) { proto_item_append_text(avp_item," val=%s", diam_sub_dis_inf->avp_str); } @@ -2200,9 +2220,10 @@ real_proto_register_diameter(void) FT_IPv6, BASE_NONE, NULL, 0, "This field is present only if the prefix length is 128", HFILL }}, { &hf_diameter_3gpp2_exp_res, { "Experimental-Result-Code", "diameter.3gpp2.exp_res", - FT_UINT32, BASE_DEC, VALS(diameter_3gpp2_exp_res_vals), 0x0, NULL, HFILL } - }, - + FT_UINT32, BASE_DEC, VALS(diameter_3gpp2_exp_res_vals), 0x0, NULL, HFILL }}, + { &hf_diameter_other_vendor_exp_res, + { "Experimental-Result-Code", "diameter.other_vendor.Experimental-Result-Code", + FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }} }; gint *ett_base[] = { |