Add/clarify some comments about how the Experimental-Result-Code AVP is handled.

Specifically we put Experimental-Result-Codes specified by 3GPP in the XML file
and let other vendors' codes be handled through a dissector table.

Change-Id: I2c3977fb959ad84faa5cb90aeb3d191c8b465ede
Reviewed-on: https://code.wireshark.org/review/8319
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
This commit is contained in:
Jeff Morriss 2015-05-06 16:03:15 -04:00
parent 0f55a0f547
commit 80358079fe
2 changed files with 27 additions and 12 deletions

View File

@ -1820,8 +1820,19 @@
<gavp name="Experimental-Result-Code"/>
</grouped>
</avp>
<!-- 3GPP TS 29.230 version 9.2.0 Release 9, ETSI TS 129 230 V9.2.0 (2010-04) -->
<!-- Ideally we could specify, in XML, Experimental-Result-Code values for
different Vendor IDs. So far we don't have a way to do that, so:
1) The below values are for 3GPP (why 3GPP? Because that's the most
common Vendor ID for the people who did this). Note that
packet-diameter.c assumes that the codes specified here are from 3GPP.
2) Other Vendor-IDs are handled by registering a dissector to the
"diameter.vnd_exp_res" dissector table.
-->
<avp name="Experimental-Result-Code" code="298" mandatory="must" may-encrypt="no" protected="mustnot" vendor-bit="mustnot">
<!-- 3GPP TS 29.230 version 9.2.0 Release 9, ETSI TS 129 230 V9.2.0 (2010-04) -->
<type type-name="Enumerated"/>
<enum name="DIAMETER_FIRST_REGISTRATION" code="2001"/>
<enum name="DIAMETER_SUBSEQUENT_REGISTRATION" code="2002"/>

View File

@ -682,7 +682,7 @@ dissect_diameter_avp(diam_ctx_t *c, tvbuff_t *tvb, int offset, diam_sub_dis_t *d
return len+pad_len;
}
/* If we are dissecting a grouped AVP and find a Vendor Id AVP(266), save it */
if((diam_sub_dis_inf->dis_gouped)&&(!vendor_flag)&&(code==266)){
if ((diam_sub_dis_inf->dis_gouped) && (!vendor_flag) && (code==266)) {
diam_sub_dis_inf->vendor_id = tvb_get_ntohl(tvb,offset);
}
@ -692,22 +692,26 @@ dissect_diameter_avp(diam_ctx_t *c, tvbuff_t *tvb, int offset, diam_sub_dis_t *d
save_tree = c->tree;
c->tree = avp_tree;
/* If we are dissecting a grouped AVP and find Experimental-Result-Code AVP(298)
* it might be Vendor defined e.g we can't use the enum from the .xml file.
* Actually the xml enum is for 3GPP so let the AVP dissector handle that too
/* The Experimental-Result-Code AVP (298) comes inside the Experimental-Result
* grouped AVP (297). The Vendor-ID AVP in the Experimental-Result specifies the
* name space of the Experimental-Result-Code. Unfortunately we don't have a way
* to specify, in XML, different Experimental-Result-Code enum values for different
* Vendor-IDs so we choose a Vendor-ID whose values get to go in XML (we chose
* 3GPP) and handle other Vendor-IDs through the "diameter.vnd_exp_res" dissector
* table.
*/
if((diam_sub_dis_inf->dis_gouped)
&&(!vendor_flag)
&&(code==298)
&&(diam_sub_dis_inf->vendor_id != 0)
&&(diam_sub_dis_inf->vendor_id != VENDOR_THE3GPP))
if ((diam_sub_dis_inf->dis_gouped)
&& (!vendor_flag)
&& (code==298)
&& (diam_sub_dis_inf->vendor_id != 0)
&& (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(diam_sub_dis_inf->avp_str){
if (diam_sub_dis_inf->avp_str) {
proto_item_append_text(avp_item," val=%s", diam_sub_dis_inf->avp_str);
}
}else if (c->version_rfc) {
} else if (c->version_rfc) {
avp_str = a->dissector_rfc(c,a,subtvb, diam_sub_dis_inf);
} else {
avp_str = a->dissector_v16(c,a,subtvb, diam_sub_dis_inf);