From b7261fe2e473db602f73c3b3b12c21fbd4ccdc76 Mon Sep 17 00:00:00 2001 From: Gerasimos Dimitriadis Date: Fri, 27 Nov 2009 22:57:50 +0000 Subject: Expert info when E.212 MCC/MNC contain non-decimal digits svn path=/trunk/; revision=31102 --- epan/dissectors/packet-bssap.c | 6 +++--- epan/dissectors/packet-diameter_3gpp.c | 2 +- epan/dissectors/packet-e212.c | 26 +++++++++++++++++++------- epan/dissectors/packet-e212.h | 2 +- epan/dissectors/packet-gsm_a_bssmap.c | 2 +- epan/dissectors/packet-gsm_a_common.c | 4 ++-- epan/dissectors/packet-gsm_a_gm.c | 2 +- epan/dissectors/packet-gsm_map.c | 4 ++-- epan/dissectors/packet-gtpv2.c | 12 ++++++------ epan/dissectors/packet-nas_eps.c | 10 +++++----- epan/dissectors/packet-ranap.c | 2 +- epan/dissectors/packet-s1ap.c | 2 +- epan/dissectors/packet-sabp.c | 2 +- epan/dissectors/packet-sccp.c | 8 ++++---- epan/dissectors/packet-uma.c | 2 +- epan/dissectors/packet-x2ap.c | 2 +- 16 files changed, 50 insertions(+), 38 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-bssap.c b/epan/dissectors/packet-bssap.c index 0928e6d512..e88ae8e11d 100644 --- a/epan/dissectors/packet-bssap.c +++ b/epan/dissectors/packet-bssap.c @@ -1599,7 +1599,7 @@ dissect_bssap_vlr_number(tvbuff_t *tvb, proto_tree *tree, int offset) } /* 18.4.27 Global CN-Id */ static int -dissect_bssap_global_cn_id(tvbuff_t *tvb, proto_tree *tree, int offset) +dissect_bssap_global_cn_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) { proto_item *item = NULL; proto_tree *ie_tree = NULL; @@ -1631,7 +1631,7 @@ dissect_bssap_global_cn_id(tvbuff_t *tvb, proto_tree *tree, int offset) */ plmn_item = proto_tree_add_item(global_cn_id_tree, hf_bssap_plmn_id, tvb, offset, 3, FALSE); plmn_tree = proto_item_add_subtree(plmn_item, ett_bssap_plmn); - dissect_e212_mcc_mnc(tvb, plmn_tree, offset); + dissect_e212_mcc_mnc(tvb, pinfo, plmn_tree, offset); offset = offset + 3; /* Octet 6 - 7 CN-Id (INTEGER 0..4095) */ @@ -1709,7 +1709,7 @@ static void dissect_bssap_plus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr /* Global CN-Id Global CN-Id 18.4.27 O TLV 7 */ if ( check_optional_ie(tvb, offset, BSSAP_GLOBAL_CN_ID)) - offset = dissect_bssap_global_cn_id(tvb, bssap_tree, offset); + offset = dissect_bssap_global_cn_id(tvb, pinfo, bssap_tree, offset); if (tvb_length_remaining(tvb,offset) == 0) return; diff --git a/epan/dissectors/packet-diameter_3gpp.c b/epan/dissectors/packet-diameter_3gpp.c index bd58cf3f97..f6c1a7cb3d 100644 --- a/epan/dissectors/packet-diameter_3gpp.c +++ b/epan/dissectors/packet-diameter_3gpp.c @@ -93,7 +93,7 @@ dissect_diameter_3gpp_tmgi(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree proto_tree_add_item(sub_tree, hf_diameter_mbms_service_id, tvb, offset, 3, FALSE); offset = offset+3; - offset = dissect_e212_mcc_mnc(tvb,sub_tree, offset); + offset = dissect_e212_mcc_mnc(tvb, pinfo, sub_tree, offset); return offset; diff --git a/epan/dissectors/packet-e212.c b/epan/dissectors/packet-e212.c index d44d5b5bf8..b74bdab4fb 100644 --- a/epan/dissectors/packet-e212.c +++ b/epan/dissectors/packet-e212.c @@ -32,6 +32,7 @@ #include #include "packet-e212.h" +#include "expert.h" /* @@ -1594,20 +1595,25 @@ static int hf_E212_mnc = -1; static int hf_E212_msin = -1; /* - * 8 7 6 5 4 3 2 1 - * MCC digit 2 MCC digit 1 octet x - * MNC digit 3 MCC digit 3 octet x+1 - * MNC digit 2 MNC digit 1 octet x+2 + * 8 7 6 5 4 3 2 1 + * +---+---+---+---+---+---+---+---+ + * | MCC digit 2 | MCC digit 1 | octet x + * +---------------+---------------+ + * | MNC digit 3 | MCC digit 3 | octet x+1 + * +---------------+---------------+ + * | MNC digit 2 | MNC digit 1 | octet x+2 + * +---------------+---------------+ */ int -dissect_e212_mcc_mnc(tvbuff_t *tvb, proto_tree *tree, int offset){ +dissect_e212_mcc_mnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset){ int start_offset; guint8 octet; guint16 mcc, mnc; guint8 mcc1, mcc2, mcc3, mnc1, mnc2, mnc3; + proto_item *item; start_offset = offset; /* Mobile country code MCC */ @@ -1629,11 +1635,17 @@ dissect_e212_mcc_mnc(tvbuff_t *tvb, proto_tree *tree, int offset){ if (mnc3 != 0xf) { mnc = 10 * mnc + mnc3; } - proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc ); - proto_tree_add_uint_format(tree, hf_E212_mnc , tvb, start_offset + 1, 2, mnc, + item = proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc ); + if ((mcc1 > 9) || (mcc2 > 9) || (mcc3 > 9)) + expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "MCC contains non-decimal digits"); + + item = proto_tree_add_uint_format(tree, hf_E212_mnc , tvb, start_offset + 1, 2, mnc, "Mobile Network Code (MNC): %s (%u)", val_to_str(mcc * 1000 + mnc, mcc_mnc_codes, "Unknown"), mnc); + if ((mnc1 > 9) || (mnc2 > 9) || ((mnc3 > 9) && (mnc3 != 0x0f))) + expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "MNC contains non-decimal digits"); + offset++; return offset; } diff --git a/epan/dissectors/packet-e212.h b/epan/dissectors/packet-e212.h index d1a070bb94..6f53d2fedc 100644 --- a/epan/dissectors/packet-e212.h +++ b/epan/dissectors/packet-e212.h @@ -30,7 +30,7 @@ extern const value_string E212_codes[]; -int dissect_e212_mcc_mnc(tvbuff_t *tvb, proto_tree *tree, int offset); +int dissect_e212_mcc_mnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset); #endif /* __PACKET_E212_H__ */ diff --git a/epan/dissectors/packet-gsm_a_bssmap.c b/epan/dissectors/packet-gsm_a_bssmap.c index 0f38f33193..65f9c8774f 100644 --- a/epan/dissectors/packet-gsm_a_bssmap.c +++ b/epan/dissectors/packet-gsm_a_bssmap.c @@ -1503,7 +1503,7 @@ be_cell_id_aux(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar case 0x08: /* For intersystem handover from GSM to UMTS or cdma2000: */ case 0x0c: /* For identification of a UTRAN cell for cell load information: */ - curr_offset = dissect_e212_mcc_mnc(tvb, tree, curr_offset); + curr_offset = dissect_e212_mcc_mnc(tvb, g_pinfo, tree, curr_offset); /* FALLTHRU */ case 0x01: diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c index 38d85f37cf..9a0560b161 100644 --- a/epan/dissectors/packet-gsm_a_common.c +++ b/epan/dissectors/packet-gsm_a_common.c @@ -1704,7 +1704,7 @@ de_lai(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar *ad mcc_mnc_aux(octs, mcc, mnc); - curr_offset = dissect_e212_mcc_mnc(tvb, subtree, curr_offset); + curr_offset = dissect_e212_mcc_mnc(tvb, gsm_a_dtap_pinfo, subtree, curr_offset); value = tvb_get_ntohs(tvb, curr_offset); @@ -1907,7 +1907,7 @@ de_mid(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add_st /* MCC/MNC*/ /* MCC, Mobile country code (octet 6a, octet 6b bits 1 to 4)*/ /* MNC, Mobile network code (octet 6b bits 5 to 8, octet 6c) */ - curr_offset = dissect_e212_mcc_mnc(tvb, tree, curr_offset); + curr_offset = dissect_e212_mcc_mnc(tvb, gsm_a_dtap_pinfo, tree, curr_offset); } if((oct&0x20)==0x20){ /* MBMS Session Identity (octet 7) diff --git a/epan/dissectors/packet-gsm_a_gm.c b/epan/dissectors/packet-gsm_a_gm.c index 2093b660e8..b3d76332e5 100644 --- a/epan/dissectors/packet-gsm_a_gm.c +++ b/epan/dissectors/packet-gsm_a_gm.c @@ -2483,7 +2483,7 @@ de_gmm_rai(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, gchar mcc,mnc,lac,rac); subtree = proto_item_add_subtree(item, ett_gmm_rai); - dissect_e212_mcc_mnc(tvb, subtree, offset); + dissect_e212_mcc_mnc(tvb, gsm_a_dtap_pinfo, subtree, offset); curr_offset+=6; /* no length check possible */ diff --git a/epan/dissectors/packet-gsm_map.c b/epan/dissectors/packet-gsm_map.c index f6a8e0041d..26cf5992ed 100644 --- a/epan/dissectors/packet-gsm_map.c +++ b/epan/dissectors/packet-gsm_map.c @@ -2602,7 +2602,7 @@ dissect_gsm_map_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) if ((na == 1) && (np==1))/*International Number & E164*/ dissect_e164_cc(tvb, tree, 1, TRUE); else if(np==6) - dissect_e212_mcc_mnc(tvb, tree, 1); + dissect_e212_mcc_mnc(tvb, pinfo, tree, 1); } @@ -3521,7 +3521,7 @@ dissect_gsm_map_LAIFixedLength(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int if (!parameter_tvb) return offset; subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LAIFixedLength); - dissect_e212_mcc_mnc(parameter_tvb, subtree, 0); + dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0); diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c index 2a323f908a..1a93d55c8c 100644 --- a/epan/dissectors/packet-gtpv2.c +++ b/epan/dissectors/packet-gtpv2.c @@ -788,7 +788,7 @@ dissect_gtpv2_rat_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, static void dissect_gtpv2_serv_net(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 instance _U_) { - dissect_e212_mcc_mnc(tvb, tree, 0); + dissect_e212_mcc_mnc(tvb, pinfo, tree, 0); } /* @@ -1150,7 +1150,7 @@ dissect_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto /* 8.22.1 CGI field */ if (flags&0x01) { - dissect_e212_mcc_mnc(tvb, tree, offset); + dissect_e212_mcc_mnc(tvb, pinfo, tree, offset); offset+=3; proto_tree_add_item(tree, hf_gtpv2_uli_cgi_lac, tvb, offset, 2, FALSE); proto_tree_add_item(tree, hf_gtpv2_uli_cgi_ci, tvb, offset, 2, FALSE); @@ -1162,7 +1162,7 @@ dissect_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto /* 8.22.2 SAI field */ if (flags&0x02) { - dissect_e212_mcc_mnc(tvb, tree, offset); + dissect_e212_mcc_mnc(tvb, pinfo, tree, offset); offset+=3; proto_tree_add_item(tree, hf_gtpv2_uli_sai_lac, tvb, offset, 2, FALSE); proto_tree_add_item(tree, hf_gtpv2_uli_sai_sac, tvb, offset, 2, FALSE); @@ -1173,7 +1173,7 @@ dissect_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto /* 8.22.3 RAI field */ if (flags&0x04) { - dissect_e212_mcc_mnc(tvb, tree, offset); + dissect_e212_mcc_mnc(tvb, pinfo, tree, offset); offset+=3; proto_tree_add_item(tree, hf_gtpv2_uli_rai_lac, tvb, offset, 2, FALSE); proto_tree_add_item(tree, hf_gtpv2_uli_rai_rac, tvb, offset, 2, FALSE); @@ -1184,7 +1184,7 @@ dissect_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto /* 8.22.4 TAI field */ if (flags&0x08) { - dissect_e212_mcc_mnc(tvb, tree, offset); + dissect_e212_mcc_mnc(tvb, pinfo, tree, offset); offset+=3; proto_tree_add_item(tree, hf_gtpv2_uli_tai_tac, tvb, offset, 2, FALSE); offset+=2; @@ -1194,7 +1194,7 @@ dissect_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto /* 8.22.5 ECGI field */ if (flags&0x10) { - dissect_e212_mcc_mnc(tvb, tree, offset); + dissect_e212_mcc_mnc(tvb, pinfo, tree, offset); offset+=3; /* The bits 8 through 5, of octet e+3 (Fig 8.21.5-1 in TS 29.274 V8.2.0) are spare and hence they would not make any difference to the hex string following it, thus we directly read 4 bytes from tvb */ diff --git a/epan/dissectors/packet-nas_eps.c b/epan/dissectors/packet-nas_eps.c index 84fb1e2a35..dc1bd7398a 100644 --- a/epan/dissectors/packet-nas_eps.c +++ b/epan/dissectors/packet-nas_eps.c @@ -885,7 +885,7 @@ de_emm_eps_mid(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _U_, g case 6: /* GUTI */ curr_offset++; - curr_offset = dissect_e212_mcc_mnc(tvb, tree, curr_offset); + curr_offset = dissect_e212_mcc_mnc(tvb, gpinfo, tree, curr_offset); /* MME Group ID octet 7 - 8 */ proto_tree_add_item(tree, hf_nas_eps_emm_mme_grp_id, tvb, curr_offset, 2, FALSE); curr_offset+=2; @@ -1272,7 +1272,7 @@ de_emm_trac_area_id(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len _ curr_offset = offset; - curr_offset = dissect_e212_mcc_mnc(tvb, tree, curr_offset); + curr_offset = dissect_e212_mcc_mnc(tvb, gpinfo, tree, curr_offset); proto_tree_add_item(tree, hf_nas_eps_emm_tai_tac, tvb, curr_offset, 2, FALSE); curr_offset+=2; @@ -1324,7 +1324,7 @@ de_emm_trac_area_id_lst(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint l * MNC digit 3 MCC digit 3 octet 3 * MNC digit 2 MNC digit 1 octet 4 */ - curr_offset = dissect_e212_mcc_mnc(tvb, tree, curr_offset); + curr_offset = dissect_e212_mcc_mnc(tvb, gpinfo, tree, curr_offset); /* type of list = "000" */ /* TAC 1 octet 5 * TAC 1 (continued) octet 6 @@ -1347,7 +1347,7 @@ de_emm_trac_area_id_lst(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint l * MNC digit 3 MCC digit 3 octet 3 * MNC digit 2 MNC digit 1 octet 4 */ - curr_offset = dissect_e212_mcc_mnc(tvb, tree, curr_offset); + curr_offset = dissect_e212_mcc_mnc(tvb, gpinfo, tree, curr_offset); proto_tree_add_item(tree, hf_nas_eps_emm_tai_tac, tvb, curr_offset, 2, FALSE); curr_offset+=2; break; @@ -1363,7 +1363,7 @@ de_emm_trac_area_id_lst(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint l * MNC digit 3 MCC digit 3 octet 3 * MNC digit 2 MNC digit 1 octet 4 */ - curr_offset = dissect_e212_mcc_mnc(tvb, tree, curr_offset); + curr_offset = dissect_e212_mcc_mnc(tvb, gpinfo, tree, curr_offset); proto_tree_add_item(tree, hf_nas_eps_emm_tai_tac, tvb, curr_offset, 2, FALSE); curr_offset+=2; } diff --git a/epan/dissectors/packet-ranap.c b/epan/dissectors/packet-ranap.c index 4c129bb232..57e63a8bed 100644 --- a/epan/dissectors/packet-ranap.c +++ b/epan/dissectors/packet-ranap.c @@ -2483,7 +2483,7 @@ dissect_ranap_PLMNidentity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _ if (!parameter_tvb) return offset; - dissect_e212_mcc_mnc(parameter_tvb, tree, 0); + dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0); return offset; diff --git a/epan/dissectors/packet-s1ap.c b/epan/dissectors/packet-s1ap.c index 5508e5ed2c..8890ce3a65 100644 --- a/epan/dissectors/packet-s1ap.c +++ b/epan/dissectors/packet-s1ap.c @@ -1553,7 +1553,7 @@ dissect_s1ap_PLMNidentity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U if (!parameter_tvb) return offset; - dissect_e212_mcc_mnc(parameter_tvb, tree, 0); + dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0); return offset; diff --git a/epan/dissectors/packet-sabp.c b/epan/dissectors/packet-sabp.c index ab3c935051..bfb40304df 100644 --- a/epan/dissectors/packet-sabp.c +++ b/epan/dissectors/packet-sabp.c @@ -662,7 +662,7 @@ dissect_sabp_PLMNidentity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U if (!parameter_tvb) return offset; subtree = proto_item_add_subtree(actx->created_item, ett_sabp_e212); - dissect_e212_mcc_mnc(parameter_tvb, subtree, 0); + dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0); diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c index bb534d61db..6c4592626a 100644 --- a/epan/dissectors/packet-sccp.c +++ b/epan/dissectors/packet-sccp.c @@ -1090,7 +1090,7 @@ dissect_sccp_gt_address_information(tvbuff_t *tvb, proto_tree *tree, } static void -dissect_sccp_global_title(tvbuff_t *tvb, proto_tree *tree, guint length, +dissect_sccp_global_title(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint length, guint8 gti, gboolean called) { proto_item *gt_item = 0; @@ -1194,7 +1194,7 @@ dissect_sccp_global_title(tvbuff_t *tvb, proto_tree *tree, guint length, case GT_NP_LAND_MOBILE: digits_tree = proto_item_add_subtree(digits_item, ett_sccp_digits); - dissect_e212_mcc_mnc(signals_tvb, digits_tree, 0); + dissect_e212_mcc_mnc(signals_tvb, pinfo, digits_tree, 0); break; default: break; @@ -1411,7 +1411,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * gt_tvb = tvb_new_subset(tvb, offset, (length - offset), (length - offset)); - dissect_sccp_global_title(gt_tvb, call_tree, (length - offset), gti, + dissect_sccp_global_title(gt_tvb, pinfo, call_tree, (length - offset), gti, called); } @@ -1472,7 +1472,7 @@ dissect_sccp_called_calling_param(tvbuff_t *tvb, proto_tree *tree, packet_info * return; gt_tvb = tvb_new_subset(tvb, offset, (length - offset), (length - offset)); - dissect_sccp_global_title(gt_tvb, call_tree, (length - offset), gti, + dissect_sccp_global_title(gt_tvb, pinfo, call_tree, (length - offset), gti, called); } diff --git a/epan/dissectors/packet-uma.c b/epan/dissectors/packet-uma.c index 295f47295c..a4f6e7be93 100644 --- a/epan/dissectors/packet-uma.c +++ b/epan/dissectors/packet-uma.c @@ -1358,7 +1358,7 @@ dissect_uma_IE(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) octet = tvb_get_guint8(tvb,ie_offset); ie_offset++; if ( octet == 0 ){ - ie_offset = dissect_e212_mcc_mnc(tvb, urr_ie_tree, ie_offset); + ie_offset = dissect_e212_mcc_mnc(tvb, pinfo, urr_ie_tree, ie_offset); proto_tree_add_item(urr_ie_tree, hf_uma_urr_lac, tvb, ie_offset, 2, FALSE); ie_offset = ie_offset + 2; /* The octets 9-12 are coded as shown in 3GPP TS 25.331, Table 'Cell identity'. diff --git a/epan/dissectors/packet-x2ap.c b/epan/dissectors/packet-x2ap.c index a7689fb778..df5756a3fc 100644 --- a/epan/dissectors/packet-x2ap.c +++ b/epan/dissectors/packet-x2ap.c @@ -938,7 +938,7 @@ dissect_x2ap_PLMN_Identity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _ if (!parameter_tvb) return offset; - dissect_e212_mcc_mnc(parameter_tvb, tree, 0); + dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0); return offset; -- cgit v1.2.3