Fix for Bug 4588:
RANAP and friends want the MNC encoded in big endian form. svn path=/trunk/; revision=32257
This commit is contained in:
parent
f8387d1240
commit
dfde72f247
|
@ -566,7 +566,7 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV;
|
|||
if (!parameter_tvb)
|
||||
return offset;
|
||||
subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_LAIFixedLength);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, TRUE);
|
||||
|
||||
#.FN_BODY RadioResourceInformation VAL_PTR = ¶meter_tvb
|
||||
tvbuff_t *parameter_tvb;
|
||||
|
|
|
@ -243,7 +243,7 @@ MAX_VAL = asn1_param_get_integer(%(ACTX)s,"upperBound")
|
|||
|
||||
if (!parameter_tvb)
|
||||
return offset;
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0, FALSE);
|
||||
#.END
|
||||
|
||||
# FN_BODY MBMSSessionDuration VAL_PTR = ¶meter_tvb
|
||||
|
|
|
@ -173,7 +173,7 @@ MAX_VAL = asn1_param_get_integer(%(ACTX)s,"upperBound")
|
|||
|
||||
if (!parameter_tvb)
|
||||
return offset;
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0, FALSE);
|
||||
#.END
|
||||
|
||||
#.FN_BODY NAS-PDU VAL_PTR = ¶meter_tvb
|
||||
|
|
|
@ -163,7 +163,7 @@ Error-Indication N sabp.proc.imsg id-Error-Indication
|
|||
if (!parameter_tvb)
|
||||
return offset;
|
||||
subtree = proto_item_add_subtree(actx->created_item, ett_sabp_e212);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, FALSE);
|
||||
|
||||
#.FN_BODY Data-Coding-Scheme VAL_PTR = ¶meter_tvb
|
||||
tvbuff_t *parameter_tvb=NULL;
|
||||
|
|
|
@ -84,7 +84,7 @@ ProtocolIE-ContainerPairList
|
|||
|
||||
if (!parameter_tvb)
|
||||
return offset;
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0, FALSE);
|
||||
#.END
|
||||
|
||||
#.FN_BODY TargeteNBtoSource-eNBTransparentContainer VAL_PTR = ¶meter_tvb
|
||||
|
|
|
@ -1631,7 +1631,7 @@ dissect_bssap_global_cn_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
*/
|
||||
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, pinfo, plmn_tree, offset);
|
||||
dissect_e212_mcc_mnc(tvb, pinfo, plmn_tree, offset, TRUE);
|
||||
offset = offset + 3;
|
||||
|
||||
/* Octet 6 - 7 CN-Id (INTEGER 0..4095) */
|
||||
|
|
|
@ -120,7 +120,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, pinfo, sub_tree, offset);
|
||||
offset = dissect_e212_mcc_mnc(tvb, pinfo, sub_tree, offset, TRUE);
|
||||
|
||||
return offset;
|
||||
|
||||
|
|
|
@ -1596,6 +1596,21 @@ static int hf_E212_mnc = -1;
|
|||
static int hf_E212_msin = -1;
|
||||
|
||||
/*
|
||||
* MCC/MNC dissection - little endian MNC encoding
|
||||
*
|
||||
* MNC of length 2:
|
||||
*
|
||||
* 8 7 6 5 4 3 2 1
|
||||
* +---+---+---+---+---+---+---+---+
|
||||
* | MCC digit 2 | MCC digit 1 | octet x
|
||||
* +---------------+---------------+
|
||||
* | Filler | MCC digit 3 | octet x+1
|
||||
* +---------------+---------------+
|
||||
* | MNC digit 2 | MNC digit 1 | octet x+2
|
||||
* +---------------+---------------+
|
||||
*
|
||||
* MNC of length 3:
|
||||
*
|
||||
* 8 7 6 5 4 3 2 1
|
||||
* +---+---+---+---+---+---+---+---+
|
||||
* | MCC digit 2 | MCC digit 1 | octet x
|
||||
|
@ -1604,9 +1619,34 @@ static int hf_E212_msin = -1;
|
|||
* +---------------+---------------+
|
||||
* | MNC digit 2 | MNC digit 1 | octet x+2
|
||||
* +---------------+---------------+
|
||||
*
|
||||
*
|
||||
* MCC/MNC dissection - big endian MNC encoding
|
||||
*
|
||||
* MNC of length 2:
|
||||
*
|
||||
* 8 7 6 5 4 3 2 1
|
||||
* +---+---+---+---+---+---+---+---+
|
||||
* | MCC digit 2 | MCC digit 1 | octet x
|
||||
* +---------------+---------------+
|
||||
* | Filler | MCC digit 3 | octet x+1
|
||||
* +---------------+---------------+
|
||||
* | MNC digit 2 | MNC digit 1 | octet x+2
|
||||
* +---------------+---------------+
|
||||
*
|
||||
* MNC of length 3:
|
||||
*
|
||||
* 8 7 6 5 4 3 2 1
|
||||
* +---+---+---+---+---+---+---+---+
|
||||
* | MCC digit 2 | MCC digit 1 | octet x
|
||||
* +---------------+---------------+
|
||||
* | MNC digit 1 | MCC digit 3 | octet x+1
|
||||
* +---------------+---------------+
|
||||
* | MNC digit 3 | MNC digit 2 | octet x+2
|
||||
* +---------------+---------------+
|
||||
*/
|
||||
int
|
||||
dissect_e212_mcc_mnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset){
|
||||
dissect_e212_mcc_mnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean little_endian){
|
||||
|
||||
int start_offset;
|
||||
guint8 octet;
|
||||
|
@ -1632,7 +1672,10 @@ dissect_e212_mcc_mnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
|
|||
mcc = 100 * mcc1 + 10 * mcc2 + mcc3;
|
||||
mnc = 10 * mnc1 + mnc2;
|
||||
if (mnc3 != 0xf) {
|
||||
if(little_endian)
|
||||
mnc = 10 * mnc + mnc3;
|
||||
else
|
||||
mnc = 100 * mnc3 + mnc;
|
||||
}
|
||||
item = proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc );
|
||||
if ((mcc1 > 9) || (mcc2 > 9) || (mcc3 > 9))
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
extern const value_string E212_codes[];
|
||||
|
||||
int dissect_e212_mcc_mnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
|
||||
int dissect_e212_mcc_mnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean little_endian);
|
||||
int dissect_e212_mcc_mnc_in_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset);
|
||||
|
||||
#endif /* __PACKET_E212_H__ */
|
||||
|
|
|
@ -1520,7 +1520,10 @@ be_cell_id_aux(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar
|
|||
*/
|
||||
/* FALLTHRU */
|
||||
case 0x0c: /* For identification of a UTRAN cell for cell load information: */
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, g_pinfo, tree, curr_offset);
|
||||
if (disc != 0x0b)
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, g_pinfo, tree, curr_offset, TRUE);
|
||||
else
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, g_pinfo, tree, curr_offset, FALSE);
|
||||
/* FALLTHRU */
|
||||
|
||||
case 0x01:
|
||||
|
|
|
@ -1705,7 +1705,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, gsm_a_dtap_pinfo, subtree, curr_offset);
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, gsm_a_dtap_pinfo, subtree, curr_offset, TRUE);
|
||||
|
||||
value = tvb_get_ntohs(tvb, curr_offset);
|
||||
|
||||
|
@ -1904,7 +1904,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, gsm_a_dtap_pinfo, tree, curr_offset);
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, gsm_a_dtap_pinfo, tree, curr_offset,TRUE);
|
||||
}
|
||||
if((oct&0x20)==0x20){
|
||||
/* MBMS Session Identity (octet 7)
|
||||
|
|
|
@ -2541,7 +2541,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, gsm_a_dtap_pinfo, subtree, offset);
|
||||
dissect_e212_mcc_mnc(tvb, gsm_a_dtap_pinfo, subtree, offset, TRUE);
|
||||
|
||||
proto_tree_add_item(subtree, hf_gsm_a_lac, tvb, curr_offset+3, 2, FALSE);
|
||||
proto_tree_add_item(subtree, hf_gsm_a_gm_rac, tvb, curr_offset+5, 1, FALSE);
|
||||
|
@ -4291,7 +4291,7 @@ de_sm_tmgi(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *ad
|
|||
curr_offset += 3;
|
||||
|
||||
NO_MORE_DATA_CHECK(len);
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, gsm_a_dtap_pinfo, tree, curr_offset);
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, gsm_a_dtap_pinfo, tree, curr_offset, TRUE);
|
||||
|
||||
EXTRANEOUS_DATA_CHECK(len, curr_offset - offset);
|
||||
|
||||
|
|
|
@ -3653,7 +3653,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, actx->pinfo, subtree, 0);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, TRUE);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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, pinfo, tree, 0);
|
||||
dissect_e212_mcc_mnc(tvb, pinfo, tree, 0, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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, pinfo, tree, offset);
|
||||
dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
|
||||
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, pinfo, tree, offset);
|
||||
dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
|
||||
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, pinfo, tree, offset);
|
||||
dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
|
||||
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, pinfo, tree, offset);
|
||||
dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
|
||||
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, pinfo, tree, offset);
|
||||
dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
|
||||
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 */
|
||||
|
|
|
@ -886,7 +886,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, gpinfo, tree, curr_offset);
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, gpinfo, tree, curr_offset, TRUE);
|
||||
/* 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;
|
||||
|
@ -1277,7 +1277,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, gpinfo, tree, curr_offset);
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, gpinfo, tree, curr_offset, TRUE);
|
||||
proto_tree_add_item(tree, hf_nas_eps_emm_tai_tac, tvb, curr_offset, 2, FALSE);
|
||||
curr_offset+=2;
|
||||
|
||||
|
@ -1329,7 +1329,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, gpinfo, tree, curr_offset);
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, gpinfo, tree, curr_offset, TRUE);
|
||||
/* type of list = "000" */
|
||||
/* TAC 1 octet 5
|
||||
* TAC 1 (continued) octet 6
|
||||
|
@ -1352,7 +1352,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, gpinfo, tree, curr_offset);
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, gpinfo, tree, curr_offset, TRUE);
|
||||
proto_tree_add_item(tree, hf_nas_eps_emm_tai_tac, tvb, curr_offset, 2, FALSE);
|
||||
curr_offset+=2;
|
||||
break;
|
||||
|
@ -1368,7 +1368,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, gpinfo, tree, curr_offset);
|
||||
curr_offset = dissect_e212_mcc_mnc(tvb, gpinfo, tree, curr_offset, TRUE);
|
||||
proto_tree_add_item(tree, hf_nas_eps_emm_tai_tac, tvb, curr_offset, 2, FALSE);
|
||||
curr_offset+=2;
|
||||
}
|
||||
|
|
|
@ -2495,7 +2495,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, actx->pinfo, tree, 0);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0, FALSE);
|
||||
|
||||
|
||||
return offset;
|
||||
|
|
|
@ -1587,7 +1587,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, actx->pinfo, tree, 0);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0, FALSE);
|
||||
|
||||
|
||||
return offset;
|
||||
|
|
|
@ -688,7 +688,7 @@ dissect_sabp_T_pLMNidentity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx
|
|||
if (!parameter_tvb)
|
||||
return offset;
|
||||
subtree = proto_item_add_subtree(actx->created_item, ett_sabp_e212);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, subtree, 0, FALSE);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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, pinfo, urr_ie_tree, ie_offset);
|
||||
ie_offset = dissect_e212_mcc_mnc(tvb, pinfo, urr_ie_tree, ie_offset, TRUE);
|
||||
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'.
|
||||
|
|
|
@ -1007,7 +1007,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, actx->pinfo, tree, 0);
|
||||
dissect_e212_mcc_mnc(parameter_tvb, actx->pinfo, tree, 0, FALSE);
|
||||
|
||||
|
||||
return offset;
|
||||
|
|
Loading…
Reference in New Issue