From 83fdea9ad6890b2f730e28565eb12c9207d39397 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Thu, 2 Jan 2020 21:56:55 +0100 Subject: GSM RLC/MAC: dissect Mobile Identity in Packet Paging Request Before this patch, Mobile Identity was displayed as an array: PACKET_PAGING_REQUEST (34) (downlink) 1000 10.. = MESSAGE_TYPE (DL): PACKET_PAGING_REQUEST (34) .... ..00 = PAGE_MODE: Normal Paging (0) 0... .... = Exist_PERSISTENCE_LEVEL: 0 .0.. .... = Exist_NLN: 0 ..1. .... = Repeated_Page_info Exist: 1 Repeated_Page_info ...1 .... = Repeated_Page_info: (Union) u.Page_req_RR .... 1... = Page_request_for_RR_conn: (Union) u.Mobile_Identity .... .100 0... .... = Length_of_Mobile_Identity_contents: 8 .001 0100 1... .... = Mobile_Identity_contents: 41 .001 0011 0... .... = Mobile_Identity_contents: 38 .001 0010 0... .... = Mobile_Identity_contents: 36 .000 0000 0... .... = Mobile_Identity_contents: 0 .000 0000 0... .... = Mobile_Identity_contents: 0 .000 0000 0... .... = Mobile_Identity_contents: 0 .000 0000 0... .... = Mobile_Identity_contents: 0 .001 0010 0... .... = Mobile_Identity_contents: 36 .00. .... = CHANNEL_NEEDED: 0 ...0 .... = Exist_eMLPP_PRIORITY: 0 after this patch: u.Mobile_Identity .... .100 0... .... = Length_of_Mobile_Identity_contents: 8 0010 .... = Identity Digit 1: 2 .... 1... = Odd/even indication: Odd number of identity digits .... .001 = Mobile Identity Type: IMSI (1) IMSI: 262420000000042 [Association IMSI: 262420000000042] Mobile Country Code (MCC): Germany (262) Mobile Network Code (MNC): Vodafone GmbH (42) .00. .... = CHANNEL_NEEDED: 0 ...0 .... = Exist_eMLPP_PRIORITY: 0 Achieved by calling de_mid() on an octet-aligned buffer. Change-Id: Ia77e388f9ac18e4ecda27eeb3e04ce1bd978a3a5 Reviewed-on: https://code.wireshark.org/review/35625 Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin --- epan/dissectors/packet-gsm_rlcmac.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/epan/dissectors/packet-gsm_rlcmac.c b/epan/dissectors/packet-gsm_rlcmac.c index 86b719921c..65f0874e0f 100644 --- a/epan/dissectors/packet-gsm_rlcmac.c +++ b/epan/dissectors/packet-gsm_rlcmac.c @@ -42,6 +42,7 @@ #include "packet-gsm_a_rr.h" #include "packet-gsm_rlcmac.h" +#include "packet-gsm_a_common.h" void proto_register_gsm_rlcmac(void); void proto_reg_handoff_gsm_rlcmac(void); @@ -648,7 +649,6 @@ static int hf_dl_timeslot_allocation = -1; /* < Packet Paging Request message content > */ static int hf_mobile_identity_length_of_mobile_identity_contents = -1; -static int hf_mobile_identity_mobile_identity_contents = -1; static int hf_page_request_for_rr_conn_channel_needed = -1; static int hf_page_request_for_rr_conn_emlpp_priority = -1; static int hf_page_request_ptmsi = -1; @@ -4471,13 +4471,28 @@ CSN_DESCR_END(DTM_Channel_Request_Description_t) typedef struct { guint8 Length_of_Mobile_Identity_contents;/* bit (4) */ - guint8 Mobile_Identity[8];/* octet (val (Length of Mobile Identity contents)) */ + /* NOTE: the rest is handled by cb_parse_mi() */ } Mobile_Identity_t; /* helper */ +static CSN_CallBackStatus_t cb_parse_mi(proto_tree *tree, tvbuff_t *tvb, + void *_mi_length, void *_param2 _U_, + int bit_offset, int ett_csn1 _U_, + packet_info *pinfo) +{ + guint8 mi_length = *((guint8 *) _mi_length); + + /* de_mid() requires an octet-aligned buffer */ + tvbuff_t *mi_tvb = tvb_new_octet_aligned(tvb, bit_offset, mi_length << 3); + add_new_data_source(pinfo, mi_tvb, "Mobile Identity"); + de_mid(mi_tvb, tree, pinfo, 0, -1, NULL, 0); + + return mi_length << 3; +} + static const CSN_DESCR_BEGIN(Mobile_Identity_t) M_UINT (Mobile_Identity_t, Length_of_Mobile_Identity_contents, 4, &hf_mobile_identity_length_of_mobile_identity_contents), - M_VAR_ARRAY (Mobile_Identity_t, Mobile_Identity, Length_of_Mobile_Identity_contents, 0, &hf_mobile_identity_mobile_identity_contents), + M_CALLBACK (Mobile_Identity_t, cb_parse_mi, Length_of_Mobile_Identity_contents, Length_of_Mobile_Identity_contents), CSN_DESCR_END (Mobile_Identity_t) static const @@ -12766,12 +12781,6 @@ proto_register_gsm_rlcmac(void) NULL, HFILL } }, - { &hf_mobile_identity_mobile_identity_contents, - { "Mobile_Identity_contents", "gsm_rlcmac.dl.ppr_mobile_identity_contents", - FT_UINT8, BASE_DEC, NULL, 0x0, - NULL, HFILL - } - }, { &hf_page_request_for_rr_conn_channel_needed, { "CHANNEL_NEEDED", "gsm_rlcmac.dl.ppr_channel_needed", FT_UINT8, BASE_DEC, NULL, 0x0, -- cgit v1.2.3