diff options
author | S. Shapira <sswsdev@gmail.com> | 2017-05-12 00:03:29 +0300 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-05-12 19:42:20 +0000 |
commit | 900695547b096b1be34fb58bea98c0474e9c72ab (patch) | |
tree | e8bd6461c49c8c925503db686364655e9512688d | |
parent | a8228fa80bd584ec8cb093cc868add56bf9346b6 (diff) | |
download | wireshark-900695547b096b1be34fb58bea98c0474e9c72ab.tar.gz |
UMTS Iub: Resolve U-RNTI for C-RNTI
This commit includes logic used to store pairs of C-RNTIs and U-RNTIs based on allocations in RRC and logic to retrive those when encountering C-RNTIs in the MAC header for DCCH over FACH/RACH.
Change-Id: I629ab061b7a73416e5730a980480b81a1aaade11
Reviewed-on: https://code.wireshark.org/review/21607
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/asn1/nbap/nbap.cnf | 12 | ||||
-rw-r--r-- | epan/dissectors/asn1/rrc/packet-rrc-template.c | 70 | ||||
-rw-r--r-- | epan/dissectors/asn1/rrc/packet-rrc-template.h | 2 | ||||
-rw-r--r-- | epan/dissectors/asn1/rrc/rrc.cnf | 74 | ||||
-rw-r--r-- | epan/dissectors/packet-nbap.c | 114 | ||||
-rw-r--r-- | epan/dissectors/packet-rrc.c | 195 | ||||
-rw-r--r-- | epan/dissectors/packet-rrc.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_fp.c | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_fp.h | 24 | ||||
-rw-r--r-- | epan/dissectors/packet-umts_mac.c | 81 |
10 files changed, 465 insertions, 122 deletions
diff --git a/epan/dissectors/asn1/nbap/nbap.cnf b/epan/dissectors/asn1/nbap/nbap.cnf index 2bcdcc6f21..30bf5b8785 100644 --- a/epan/dissectors/asn1/nbap/nbap.cnf +++ b/epan/dissectors/asn1/nbap/nbap.cnf @@ -748,6 +748,7 @@ hsdsch_macdflow_ids[num_items-1] = hsdsch_macdflow_id; #.FN_BODY RACH-ParametersItem-CTCH-SetupRqstFDD address dst_addr, null_addr; conversation_t *conversation; +fp_rach_channel_info_t* fp_rach_channel_info; umts_fp_conversation_info_t *umts_fp_conversation_info; int j, num_tf; @@ -789,6 +790,12 @@ transportFormatSet_type = NBAP_CPCH; umts_fp_conversation_info->crnc_port = BindingID_port; umts_fp_conversation_info->rlc_mode = FP_RLC_MODE_UNKNOWN; + /* Adding the 'channel specific info' for RACH */ + fp_rach_channel_info = wmem_new0(wmem_file_scope(), fp_rach_channel_info_t); + fp_rach_channel_info->crnti_to_urnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + umts_fp_conversation_info->channel_specific_info = (void*)fp_rach_channel_info; + + /*Save unique UE-identifier */ umts_fp_conversation_info->com_context_id = crcn_context_present ? com_context_id : 1; @@ -949,6 +956,7 @@ num_items = 1; address dst_addr, null_addr; conversation_t *conversation; +fp_fach_channel_info_t* fp_fach_channel_info; umts_fp_conversation_info_t *umts_fp_conversation_info; int i, j, num_tf; @@ -993,6 +1001,10 @@ transportFormatSet_type = NBAP_CPCH; /*Save unique UE-identifier */ umts_fp_conversation_info->com_context_id = crcn_context_present ? com_context_id : 1; + /* Adding the 'channel specific info' for FACH */ + fp_fach_channel_info = wmem_new0(wmem_file_scope(), fp_fach_channel_info_t); + fp_fach_channel_info->crnti_to_urnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + umts_fp_conversation_info->channel_specific_info = (void*)fp_fach_channel_info; /* DCH's in this flow */ umts_fp_conversation_info->dch_crc_present = g_nbap_msg_info_for_fp.dch_crc_present; diff --git a/epan/dissectors/asn1/rrc/packet-rrc-template.c b/epan/dissectors/asn1/rrc/packet-rrc-template.c index 2af4f2b1a3..1b24415209 100644 --- a/epan/dissectors/asn1/rrc/packet-rrc-template.c +++ b/epan/dissectors/asn1/rrc/packet-rrc-template.c @@ -45,6 +45,8 @@ #include "packet-gsm_a_common.h" #include "packet-nbap.h" #include "packet-umts_fp.h" +#include "packet-umts_mac.h" +#include "packet-rlc.h" #ifdef _MSC_VER /* disable: "warning C4049: compiler limit : terminating line number emission" */ @@ -57,10 +59,14 @@ #define PSNAME "RRC" #define PFNAME "rrc" -extern int proto_fp; /*Handler to FP*/ +extern int proto_fp; /*Handler to FP*/ +extern int proto_umts_mac; /*Handler to MAC*/ +extern int proto_rlc; /*Handler to RLC*/ GTree * hsdsch_muxed_flows = NULL; GTree * rrc_ciph_inf = NULL; +GTree * rrc_scrambling_code_urnti = NULL; +wmem_tree_t* rrc_rach_urnti_crnti_map = NULL; static int msg_type _U_; /*****************************************************************************/ @@ -81,6 +87,7 @@ typedef struct umts_rrc_private_data_t guint32 s_rnc_id; /* The S-RNC ID part of a U-RNTI */ guint32 s_rnti; /* The S-RNTI part of a U-RNTI */ guint32 new_u_rnti; + guint32 current_u_rnti; guint32 scrambling_code; enum nas_sys_info_gsm_map cn_domain; } umts_rrc_private_data_t; @@ -101,62 +108,74 @@ static umts_rrc_private_data_t* umts_rrc_get_private_data(asn1_ctx_t *actx) static guint32 private_data_get_s_rnc_id(asn1_ctx_t *actx) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - return private_data->s_rnc_id; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->s_rnc_id; } static void private_data_set_s_rnc_id(asn1_ctx_t *actx, guint32 s_rnc_id) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - private_data->s_rnc_id = s_rnc_id; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->s_rnc_id = s_rnc_id; } static guint32 private_data_get_s_rnti(asn1_ctx_t *actx) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - return private_data->s_rnti; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->s_rnti; } static void private_data_set_s_rnti(asn1_ctx_t *actx, guint32 s_rnti) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - private_data->s_rnti = s_rnti; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->s_rnti = s_rnti; } static guint32 private_data_get_new_u_rnti(asn1_ctx_t *actx) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - return private_data->new_u_rnti; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->new_u_rnti; } static void private_data_set_new_u_rnti(asn1_ctx_t *actx, guint32 new_u_rnti) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - private_data->new_u_rnti = new_u_rnti; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->new_u_rnti = new_u_rnti; +} + +static guint32 private_data_get_current_u_rnti(asn1_ctx_t *actx) +{ + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->current_u_rnti; +} + +static void private_data_set_current_u_rnti(asn1_ctx_t *actx, guint32 current_u_rnti) +{ + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->current_u_rnti = current_u_rnti; } static guint32 private_data_get_scrambling_code(asn1_ctx_t *actx) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - return private_data->scrambling_code; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->scrambling_code; } static void private_data_set_scrambling_code(asn1_ctx_t *actx, guint32 scrambling_code) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - private_data->scrambling_code = scrambling_code; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->scrambling_code = scrambling_code; } static enum nas_sys_info_gsm_map private_data_get_cn_domain(asn1_ctx_t *actx) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - return private_data->cn_domain; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->cn_domain; } static void private_data_set_cn_domain(asn1_ctx_t *actx, enum nas_sys_info_gsm_map cn_domain) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - private_data->cn_domain = cn_domain; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->cn_domain = cn_domain; } /*****************************************************************************/ @@ -351,6 +370,15 @@ rrc_init(void) { NULL, /* data pointer, optional */ NULL, rrc_free_value); + + /*Initialize Scrambling code to U-RNTI dictionary*/ + rrc_scrambling_code_urnti = g_tree_new_full(rrc_key_cmp, + NULL, + NULL, + NULL); + + /* Global U-RNTI / C-RNTI map to be used in RACH channels */ + rrc_rach_urnti_crnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); } static void diff --git a/epan/dissectors/asn1/rrc/packet-rrc-template.h b/epan/dissectors/asn1/rrc/packet-rrc-template.h index 6ae2b0661d..72efe6c20e 100644 --- a/epan/dissectors/asn1/rrc/packet-rrc-template.h +++ b/epan/dissectors/asn1/rrc/packet-rrc-template.h @@ -60,5 +60,7 @@ typedef struct rrc_ciph_info_ extern GTree * hsdsch_muxed_flows; extern GTree * rrc_ciph_inf; +extern GTree * rrc_scrambling_code_urnti; +extern wmem_tree_t* rrc_rach_urnti_crnti_map; #endif /* PACKET_RRC_H */ diff --git a/epan/dissectors/asn1/rrc/rrc.cnf b/epan/dissectors/asn1/rrc/rrc.cnf index d444fcbbc8..1f471f7850 100644 --- a/epan/dissectors/asn1/rrc/rrc.cnf +++ b/epan/dissectors/asn1/rrc/rrc.cnf @@ -787,16 +787,88 @@ HNBName TYPE=FT_STRING DISPLAY=STR_UNICODE s_rnti = private_data_get_s_rnti(actx); if(s_rnc_id != 0 && s_rnti != 0) { u_rnti_value = (s_rnc_id << 20) | s_rnti; - /* We are looking for new allocated U-RNTIs, not previously used ones */ + /* Distinguishing between new allocated U-RNTIs and previously used ones */ if (is_new_urnti) { private_data_set_new_u_rnti(actx, u_rnti_value); } + else { + private_data_set_current_u_rnti(actx, u_rnti_value); + } /* Adding U-RNTI value to it's tree item */ proto_item_append_text(actx->created_item,": %%08x", u_rnti_value); } private_data_set_s_rnc_id(actx, 0); private_data_set_s_rnti(actx, 0); +#.FN_BODY C-RNTI VAL_PTR = &c_rnti_tvb + fp_info *fpinf = NULL; + umts_mac_info *macinf = NULL; + rlc_info *rlcinf = NULL; + conversation_t *p_conv; + umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; + fp_fach_channel_info_t *fp_fach_channel_info = NULL; + tvbuff_t * c_rnti_tvb = NULL; + guint16 c_rnti = 0; + guint32 u_rnti = 0; + fp_crnti_allocation_info_t *fp_crnti_allocation_info = NULL; +%(DEFAULT_BODY)s + if (!c_rnti_tvb) + return offset; + + if(tvb_reported_length(c_rnti_tvb)>=2){ + c_rnti = tvb_get_ntohs(c_rnti_tvb,0); + } + + if(actx->pinfo->fd->flags.visited) /* Frame was already checked*/ + return offset; + + /* Trying to figure where to get the U-RNTI from Either from an ASN.1 field (if this is CCCH) or RLC's attached info (if this is DCCH) */ + fpinf = (fp_info *)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_fp, 0); + macinf = (umts_mac_info *)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_umts_mac, 0); + rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_rlc, 0); + if (fpinf && macinf && rlcinf) { + switch(macinf->content[fpinf->cur_tb]){ + case MAC_DCCH: + u_rnti = rlcinf->urnti[fpinf->cur_tb]; + break; + case MAC_CCCH: + default: + u_rnti = private_data_get_current_u_rnti(actx); + break; + } + } + else { + /* Either FP, MAC or RLC info is missing - looking for ASN.1 field as last resort*/ + u_rnti = private_data_get_current_u_rnti(actx); + } + + if(u_rnti == 0 || c_rnti == 0) /* U-RNTI missing or failed to parse C-RNTI */ + return offset; + + /* Both U-RNTI and C-RNTI present - storing the match*/ + fp_crnti_allocation_info = wmem_new0(wmem_file_scope(), fp_crnti_allocation_info_t); + fp_crnti_allocation_info->urnti = u_rnti; + fp_crnti_allocation_info->alloc_frame_number = actx->pinfo->num; + + /* Finding FP conversation info */ + p_conv = (conversation_t *)find_conversation(actx->pinfo->num, &actx->pinfo->net_dst, &actx->pinfo->net_src, + actx->pinfo->ptype, + actx->pinfo->destport, actx->pinfo->srcport, NO_ADDR_B); + + /* If the current FP channel is FACH, Adding the C-RNTI / U-RNTI match to the FACH's RNTIs map*/ + if (p_conv != NULL) { + umts_fp_conversation_info = (umts_fp_conversation_info_t *)conversation_get_proto_data(p_conv, proto_fp); + if (umts_fp_conversation_info && umts_fp_conversation_info->channel == CHANNEL_FACH_FDD) { + fp_fach_channel_info = (fp_fach_channel_info_t *)umts_fp_conversation_info->channel_specific_info; + if(fp_fach_channel_info) { + wmem_tree_insert32(fp_fach_channel_info->crnti_to_urnti_map, c_rnti, (void *)fp_crnti_allocation_info); + } + } + } + + /* Also adding the C-RNTI / U-RNTI match to the global RNTIs map for the RACH channel */ + wmem_tree_insert32(rrc_rach_urnti_crnti_map, c_rnti, (void *)fp_crnti_allocation_info); + #.FN_BODY UL-ScramblingCode VAL_PTR = &scrambling_code guint32 scrambling_code; %(DEFAULT_BODY)s diff --git a/epan/dissectors/packet-nbap.c b/epan/dissectors/packet-nbap.c index 029216ef38..9d0c974831 100644 --- a/epan/dissectors/packet-nbap.c +++ b/epan/dissectors/packet-nbap.c @@ -10074,7 +10074,7 @@ dissect_nbap_AddorDeleteIndicator(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t static int dissect_nbap_CFN(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 2174 "./asn1/nbap/nbap.cnf" +#line 2186 "./asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, 255U, &cfn, FALSE); @@ -10327,7 +10327,7 @@ dissect_nbap_AvailabilityStatus(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a static int dissect_nbap_HSDSCH_RNTI(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 2139 "./asn1/nbap/nbap.cnf" +#line 2151 "./asn1/nbap/nbap.cnf" umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; address null_addr; conversation_t *conversation = NULL; @@ -11549,7 +11549,7 @@ dissect_nbap_Common_E_DCH_Resource_Combination_InfoList(tvbuff_t *tvb _U_, int o static int dissect_nbap_Common_MACFlow_ID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1998 "./asn1/nbap/nbap.cnf" +#line 2010 "./asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, maxNrOfCommonMACFlows_1, &common_macdflow_id, FALSE); @@ -11683,7 +11683,7 @@ dissect_nbap_E_DCH_MACdFlow_Multiplexing_List(tvbuff_t *tvb _U_, int offset _U_, static int dissect_nbap_LogicalChannelID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1652 "./asn1/nbap/nbap.cnf" +#line 1664 "./asn1/nbap/nbap.cnf" /* Set logical channel id for this entry*/ offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 1U, 15U, &logical_channel_id, FALSE); @@ -11701,7 +11701,7 @@ dissect_nbap_LogicalChannelID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *act static int dissect_nbap_MAC_PDU_SizeExtended(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1754 "./asn1/nbap/nbap.cnf" +#line 1766 "./asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 1U, 1504U, NULL, TRUE); @@ -12124,7 +12124,7 @@ static const per_sequence_t CommonMACFlow_Specific_InfoItem_sequence[] = { static int dissect_nbap_CommonMACFlow_Specific_InfoItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 2005 "./asn1/nbap/nbap.cnf" +#line 2017 "./asn1/nbap/nbap.cnf" address dst_addr; transportLayerAddress_ipv4 = 0; BindingID_port = 0; @@ -12169,7 +12169,7 @@ dissect_nbap_CommonMACFlow_Specific_InfoList(tvbuff_t *tvb _U_, int offset _U_, static int dissect_nbap_MACdPDU_Size(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1642 "./asn1/nbap/nbap.cnf" +#line 1654 "./asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 1U, 5000U, &MACdPDU_Size, TRUE); @@ -13390,7 +13390,7 @@ dissect_nbap_CriticalityDiagnostics(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_ static int dissect_nbap_CRNC_CommunicationContextID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 2113 "./asn1/nbap/nbap.cnf" +#line 2125 "./asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, 1048575U, &com_context_id, FALSE); @@ -14843,7 +14843,7 @@ dissect_nbap_T_dCH_ID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, p static int dissect_nbap_TransportFormatSet_NrOfTransportBlocks(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1081 "./asn1/nbap/nbap.cnf" +#line 1093 "./asn1/nbap/nbap.cnf" guint32 NrOfTransportBlocks; offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, @@ -14886,7 +14886,7 @@ guint32 NrOfTransportBlocks; static int dissect_nbap_TransportFormatSet_TransportBlockSize(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1113 "./asn1/nbap/nbap.cnf" +#line 1125 "./asn1/nbap/nbap.cnf" guint32 TransportBlockSize; offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, @@ -15014,7 +15014,7 @@ static const per_sequence_t TransportFormatSet_DynamicPartList_item_sequence[] = static int dissect_nbap_TransportFormatSet_DynamicPartList_item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1077 "./asn1/nbap/nbap.cnf" +#line 1089 "./asn1/nbap/nbap.cnf" num_items++; @@ -15032,7 +15032,7 @@ static const per_sequence_t TransportFormatSet_DynamicPartList_sequence_of[1] = static int dissect_nbap_TransportFormatSet_DynamicPartList(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1074 "./asn1/nbap/nbap.cnf" +#line 1086 "./asn1/nbap/nbap.cnf" num_items = 0; @@ -15203,7 +15203,7 @@ dissect_nbap_TransportFormatSet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a static int dissect_nbap_T_ul_TransportFormatSet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1052 "./asn1/nbap/nbap.cnf" +#line 1064 "./asn1/nbap/nbap.cnf" transportFormatSet_type = NBAP_DCH_UL; nbap_dch_chnl_info[dch_id].num_ul_chans = 0; @@ -15217,7 +15217,7 @@ dissect_nbap_T_ul_TransportFormatSet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx static int dissect_nbap_T_dl_TransportFormatSet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1056 "./asn1/nbap/nbap.cnf" +#line 1068 "./asn1/nbap/nbap.cnf" transportFormatSet_type = NBAP_DCH_DL; nbap_dch_chnl_info[dch_id].num_dl_chans = 0; @@ -15267,14 +15267,14 @@ static const per_sequence_t DCH_Specific_FDD_Item_sequence[] = { static int dissect_nbap_DCH_Specific_FDD_Item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1046 "./asn1/nbap/nbap.cnf" +#line 1058 "./asn1/nbap/nbap.cnf" g_num_dch_in_flow++; offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_nbap_DCH_Specific_FDD_Item, DCH_Specific_FDD_Item_sequence); -#line 1049 "./asn1/nbap/nbap.cnf" +#line 1061 "./asn1/nbap/nbap.cnf" prev_dch_id = dch_id; @@ -15288,7 +15288,7 @@ static const per_sequence_t DCH_Specific_FDD_InformationList_sequence_of[1] = { static int dissect_nbap_DCH_Specific_FDD_InformationList(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1042 "./asn1/nbap/nbap.cnf" +#line 1054 "./asn1/nbap/nbap.cnf" g_num_dch_in_flow = 0; prev_dch_id = 0; @@ -15582,7 +15582,7 @@ dissect_nbap_T_dCH_ID_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ static int dissect_nbap_T_ul_TransportFormatSet_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1060 "./asn1/nbap/nbap.cnf" +#line 1072 "./asn1/nbap/nbap.cnf" transportFormatSet_type = NBAP_DCH_UL; nbap_dch_chnl_info[dch_id].num_ul_chans = 0; @@ -15596,7 +15596,7 @@ dissect_nbap_T_ul_TransportFormatSet_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ static int dissect_nbap_T_dl_TransportFormatSet_01(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1064 "./asn1/nbap/nbap.cnf" +#line 1076 "./asn1/nbap/nbap.cnf" transportFormatSet_type = NBAP_DCH_DL; nbap_dch_chnl_info[dch_id].num_dl_chans = 0; @@ -15652,7 +15652,7 @@ static const per_sequence_t FDD_DCHs_to_ModifyItem_sequence[] = { static int dissect_nbap_FDD_DCHs_to_ModifyItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1140 "./asn1/nbap/nbap.cnf" +#line 1152 "./asn1/nbap/nbap.cnf" offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_nbap_FDD_DCHs_to_ModifyItem, FDD_DCHs_to_ModifyItem_sequence); @@ -18074,7 +18074,7 @@ dissect_nbap_E_DCH_HARQ_Combining_Capability(tvbuff_t *tvb _U_, int offset _U_, static int dissect_nbap_E_DCH_DDI_Value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1631 "./asn1/nbap/nbap.cnf" +#line 1643 "./asn1/nbap/nbap.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, 62U, &e_dch_ddi_value, FALSE); @@ -18209,7 +18209,7 @@ static const per_sequence_t E_DCH_LogicalChannelInformationItem_sequence[] = { static int dissect_nbap_E_DCH_LogicalChannelInformationItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1628 "./asn1/nbap/nbap.cnf" +#line 1640 "./asn1/nbap/nbap.cnf" num_items++; @@ -18226,7 +18226,7 @@ static const per_sequence_t E_DCH_LogicalChannelInformation_sequence_of[1] = { static int dissect_nbap_E_DCH_LogicalChannelInformation(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1621 "./asn1/nbap/nbap.cnf" +#line 1633 "./asn1/nbap/nbap.cnf" num_items = 0; offset = dissect_per_constrained_sequence_of(tvb, offset, actx, tree, hf_index, @@ -18259,7 +18259,7 @@ static const per_sequence_t E_DCH_MACdFlow_Specific_InfoItem_sequence[] = { static int dissect_nbap_E_DCH_MACdFlow_Specific_InfoItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1378 "./asn1/nbap/nbap.cnf" +#line 1390 "./asn1/nbap/nbap.cnf" umts_fp_conversation_info_t *p_conv_data = NULL; address null_addr; conversation_t *p_conv; @@ -18442,7 +18442,7 @@ static const per_sequence_t E_DCH_LogicalChannelToModifyItem_sequence[] = { static int dissect_nbap_E_DCH_LogicalChannelToModifyItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1616 "./asn1/nbap/nbap.cnf" +#line 1628 "./asn1/nbap/nbap.cnf" offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_nbap_E_DCH_LogicalChannelToModifyItem, E_DCH_LogicalChannelToModifyItem_sequence); @@ -18517,7 +18517,7 @@ static const per_sequence_t E_DCH_MACdFlow_Specific_InfoItem_to_Modify_sequence[ static int dissect_nbap_E_DCH_MACdFlow_Specific_InfoItem_to_Modify(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1524 "./asn1/nbap/nbap.cnf" +#line 1536 "./asn1/nbap/nbap.cnf" guint32 no_ddi_entries, i; address null_addr; nbap_edch_port_info_t *old_info; @@ -18659,7 +18659,7 @@ static const per_sequence_t E_DCH_FDD_Information_to_Modify_sequence[] = { static int dissect_nbap_E_DCH_FDD_Information_to_Modify(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1431 "./asn1/nbap/nbap.cnf" +#line 1443 "./asn1/nbap/nbap.cnf" address dst_addr, null_addr; conversation_t *conversation,*old_conversation = NULL; @@ -23241,7 +23241,7 @@ static const value_string nbap_PICH_Mode_vals[] = { static int dissect_nbap_PICH_Mode(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 817 "./asn1/nbap/nbap.cnf" +#line 824 "./asn1/nbap/nbap.cnf" guint32 PICH_Mode = 0; offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index, 4, &PICH_Mode, TRUE, 0, NULL); @@ -23356,7 +23356,7 @@ static const per_sequence_t HSDSCH_Common_System_InformationFDD_sequence[] = { static int dissect_nbap_HSDSCH_Common_System_InformationFDD(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 2025 "./asn1/nbap/nbap.cnf" +#line 2037 "./asn1/nbap/nbap.cnf" /* * 5.1.6 High Speed Downlink Shared Channels * The Data Transfer procedure is used to transfer a HS-DSCH DATA FRAME (TYPE 1, TYPE 2 [FDD and 1.28Mcps @@ -23517,7 +23517,7 @@ static const per_sequence_t HSDSCH_MACdFlow_Specific_InfoItem_sequence[] = { static int dissect_nbap_HSDSCH_MACdFlow_Specific_InfoItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1732 "./asn1/nbap/nbap.cnf" +#line 1744 "./asn1/nbap/nbap.cnf" address dst_addr; @@ -23620,7 +23620,7 @@ static const value_string nbap_RLC_Mode_vals[] = { static int dissect_nbap_RLC_Mode(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1659 "./asn1/nbap/nbap.cnf" +#line 1671 "./asn1/nbap/nbap.cnf" guint32 rlc_mode; offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index, @@ -23661,7 +23661,7 @@ static const per_sequence_t PriorityQueue_InfoItem_sequence[] = { static int dissect_nbap_PriorityQueue_InfoItem(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1723 "./asn1/nbap/nbap.cnf" +#line 1735 "./asn1/nbap/nbap.cnf" num_items++; @@ -23695,7 +23695,7 @@ static const per_sequence_t HSDSCH_MACdFlows_Information_sequence[] = { static int dissect_nbap_HSDSCH_MACdFlows_Information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1683 "./asn1/nbap/nbap.cnf" +#line 1695 "./asn1/nbap/nbap.cnf" int protocol_ie_id; guint32 i; @@ -23739,7 +23739,7 @@ dissect_nbap_HSDSCH_MACdFlows_Information(tvbuff_t *tvb _U_, int offset _U_, asn static int dissect_nbap_T_hSDSCH_Physical_Layer_Category(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1676 "./asn1/nbap/nbap.cnf" +#line 1688 "./asn1/nbap/nbap.cnf" guint32 hsdsch_physical_layer_category; offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, @@ -23807,7 +23807,7 @@ static const per_sequence_t HSDSCH_FDD_Information_sequence[] = { static int dissect_nbap_HSDSCH_FDD_Information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1784 "./asn1/nbap/nbap.cnf" +#line 1796 "./asn1/nbap/nbap.cnf" /* * Collect the information about the HSDSCH MACdFlows set up conversation(s) and set the conversation data. */ @@ -23944,7 +23944,7 @@ static const per_sequence_t HSDSCH_MACdFlow_Specific_InfoItem_to_Modify_sequence static int dissect_nbap_HSDSCH_MACdFlow_Specific_InfoItem_to_Modify(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1873 "./asn1/nbap/nbap.cnf" +#line 1885 "./asn1/nbap/nbap.cnf" address dst_addr; transportLayerAddress_ipv4 = 0; BindingID_port = 0; @@ -24002,7 +24002,7 @@ static const per_sequence_t PriorityQueue_InfoItem_to_Add_sequence[] = { static int dissect_nbap_PriorityQueue_InfoItem_to_Add(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1726 "./asn1/nbap/nbap.cnf" +#line 1738 "./asn1/nbap/nbap.cnf" num_items = 1; @@ -24137,7 +24137,7 @@ static const per_sequence_t HSDSCH_Information_to_Modify_sequence[] = { static int dissect_nbap_HSDSCH_Information_to_Modify(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1893 "./asn1/nbap/nbap.cnf" +#line 1905 "./asn1/nbap/nbap.cnf" /* * This is pretty much the same like if we setup a previous flow */ @@ -24259,7 +24259,7 @@ static const value_string nbap_HSDSCH_MACdPDUSizeFormat_vals[] = { static int dissect_nbap_HSDSCH_MACdPDUSizeFormat(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1761 "./asn1/nbap/nbap.cnf" +#line 1773 "./asn1/nbap/nbap.cnf" /* * Removed 10 Aug. 2012, I'm not sure if this was right, it wrongfully * set some packets as type 2 for HSDHCH modified items. @@ -24370,7 +24370,7 @@ static const per_sequence_t HSDSCH_MACdFlow_Specific_InformationResp_Item_sequen static int dissect_nbap_HSDSCH_MACdFlow_Specific_InformationResp_Item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1729 "./asn1/nbap/nbap.cnf" +#line 1741 "./asn1/nbap/nbap.cnf" num_items++; @@ -24786,7 +24786,7 @@ static const per_sequence_t HSDSCH_Paging_System_InformationFDD_sequence[] = { static int dissect_nbap_HSDSCH_Paging_System_InformationFDD(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 2103 "./asn1/nbap/nbap.cnf" +#line 2115 "./asn1/nbap/nbap.cnf" /* g_warning("HS-DSCH Type 3 NOT Implemented!"); */ @@ -24980,7 +24980,7 @@ static const per_sequence_t HSDSCH_MACdFlows_to_Delete_Item_sequence[] = { static int dissect_nbap_HSDSCH_MACdFlows_to_Delete_Item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1720 "./asn1/nbap/nbap.cnf" +#line 1732 "./asn1/nbap/nbap.cnf" num_items++; @@ -24997,7 +24997,7 @@ static const per_sequence_t HSDSCH_MACdFlows_to_Delete_sequence_of[1] = { static int dissect_nbap_HSDSCH_MACdFlows_to_Delete(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1715 "./asn1/nbap/nbap.cnf" +#line 1727 "./asn1/nbap/nbap.cnf" num_items = 0; @@ -28099,7 +28099,7 @@ dissect_nbap_NI_Information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx static int dissect_nbap_NodeB_CommunicationContextID(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 2117 "./asn1/nbap/nbap.cnf" +#line 2129 "./asn1/nbap/nbap.cnf" /*Set up and map that maps Node-B ids to CRNC ids, since often you only have one of them present in nbap*/ nbap_com_context_id_t *cur_val; @@ -28664,7 +28664,7 @@ dissect_nbap_RACH_SubChannelNumbers(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_ static int dissect_nbap_T_dCH_id(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1146 "./asn1/nbap/nbap.cnf" +#line 1158 "./asn1/nbap/nbap.cnf" offset = dissect_nbap_DCH_ID(tvb, offset, actx, tree, hf_index); @@ -28686,7 +28686,7 @@ static const per_sequence_t RL_Specific_DCH_Info_Item_sequence[] = { static int dissect_nbap_RL_Specific_DCH_Info_Item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1151 "./asn1/nbap/nbap.cnf" +#line 1163 "./asn1/nbap/nbap.cnf" address dst_addr, null_addr; conversation_t *conversation = NULL; umts_fp_conversation_info_t *umts_fp_conversation_info; @@ -28831,7 +28831,7 @@ static const per_sequence_t RL_Specific_E_DCH_Information_Item_sequence[] = { static int dissect_nbap_RL_Specific_E_DCH_Information_Item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1266 "./asn1/nbap/nbap.cnf" +#line 1278 "./asn1/nbap/nbap.cnf" address dst_addr, null_addr; conversation_t *conversation; umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; @@ -32398,10 +32398,11 @@ static const per_sequence_t FACH_ParametersItem_CTCH_SetupRqstFDD_sequence[] = { static int dissect_nbap_FACH_ParametersItem_CTCH_SetupRqstFDD(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 949 "./asn1/nbap/nbap.cnf" +#line 956 "./asn1/nbap/nbap.cnf" address dst_addr, null_addr; conversation_t *conversation; +fp_fach_channel_info_t* fp_fach_channel_info; umts_fp_conversation_info_t *umts_fp_conversation_info; int i, j, num_tf; @@ -32448,6 +32449,10 @@ transportFormatSet_type = NBAP_CPCH; /*Save unique UE-identifier */ umts_fp_conversation_info->com_context_id = crcn_context_present ? com_context_id : 1; + /* Adding the 'channel specific info' for FACH */ + fp_fach_channel_info = wmem_new0(wmem_file_scope(), fp_fach_channel_info_t); + fp_fach_channel_info->crnti_to_urnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + umts_fp_conversation_info->channel_specific_info = (void*)fp_fach_channel_info; /* DCH's in this flow */ umts_fp_conversation_info->dch_crc_present = g_nbap_msg_info_for_fp.dch_crc_present; @@ -32516,7 +32521,7 @@ dissect_nbap_FACH_ParametersListIE_CTCH_SetupRqstFDD(tvbuff_t *tvb _U_, int offs static int dissect_nbap_T_transportFormatSet(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1068 "./asn1/nbap/nbap.cnf" +#line 1080 "./asn1/nbap/nbap.cnf" transportFormatSet_type = NBAP_PCH; nbap_dch_chnl_info[commontransportchannelid].num_dl_chans = 0; nbap_dch_chnl_info[commontransportchannelid].num_ul_chans = 0; @@ -32561,7 +32566,7 @@ static const per_sequence_t PCH_ParametersItem_CTCH_SetupRqstFDD_sequence[] = { static int dissect_nbap_PCH_ParametersItem_CTCH_SetupRqstFDD(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 838 "./asn1/nbap/nbap.cnf" +#line 845 "./asn1/nbap/nbap.cnf" address dst_addr, null_addr; conversation_t *conversation; @@ -32711,6 +32716,7 @@ dissect_nbap_RACH_ParametersItem_CTCH_SetupRqstFDD(tvbuff_t *tvb _U_, int offset #line 749 "./asn1/nbap/nbap.cnf" address dst_addr, null_addr; conversation_t *conversation; +fp_rach_channel_info_t* fp_rach_channel_info; umts_fp_conversation_info_t *umts_fp_conversation_info; int j, num_tf; @@ -32754,6 +32760,12 @@ transportFormatSet_type = NBAP_CPCH; umts_fp_conversation_info->crnc_port = BindingID_port; umts_fp_conversation_info->rlc_mode = FP_RLC_MODE_UNKNOWN; + /* Adding the 'channel specific info' for RACH */ + fp_rach_channel_info = wmem_new0(wmem_file_scope(), fp_rach_channel_info_t); + fp_rach_channel_info->crnti_to_urnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + umts_fp_conversation_info->channel_specific_info = (void*)fp_rach_channel_info; + + /*Save unique UE-identifier */ umts_fp_conversation_info->com_context_id = crcn_context_present ? com_context_id : 1; @@ -41117,7 +41129,7 @@ col_set_str(actx->pinfo->cinfo, COL_INFO,"RadioLinkReconfigurationCommit "); actx->pinfo->link_dir=P2P_DIR_DL; -#line 2166 "./asn1/nbap/nbap.cnf" +#line 2178 "./asn1/nbap/nbap.cnf" /* * Here we need to signal the CFN value, down to FP so * that lowert layers know when a reconfiguration becomes active diff --git a/epan/dissectors/packet-rrc.c b/epan/dissectors/packet-rrc.c index 7235d2e269..3c6784330f 100644 --- a/epan/dissectors/packet-rrc.c +++ b/epan/dissectors/packet-rrc.c @@ -53,6 +53,8 @@ #include "packet-gsm_a_common.h" #include "packet-nbap.h" #include "packet-umts_fp.h" +#include "packet-umts_mac.h" +#include "packet-rlc.h" #ifdef _MSC_VER /* disable: "warning C4049: compiler limit : terminating line number emission" */ @@ -65,10 +67,14 @@ #define PSNAME "RRC" #define PFNAME "rrc" -extern int proto_fp; /*Handler to FP*/ +extern int proto_fp; /*Handler to FP*/ +extern int proto_umts_mac; /*Handler to MAC*/ +extern int proto_rlc; /*Handler to RLC*/ GTree * hsdsch_muxed_flows = NULL; GTree * rrc_ciph_inf = NULL; +GTree * rrc_scrambling_code_urnti = NULL; +wmem_tree_t* rrc_rach_urnti_crnti_map = NULL; static int msg_type _U_; /*****************************************************************************/ @@ -89,6 +95,7 @@ typedef struct umts_rrc_private_data_t guint32 s_rnc_id; /* The S-RNC ID part of a U-RNTI */ guint32 s_rnti; /* The S-RNTI part of a U-RNTI */ guint32 new_u_rnti; + guint32 current_u_rnti; guint32 scrambling_code; enum nas_sys_info_gsm_map cn_domain; } umts_rrc_private_data_t; @@ -109,62 +116,74 @@ static umts_rrc_private_data_t* umts_rrc_get_private_data(asn1_ctx_t *actx) static guint32 private_data_get_s_rnc_id(asn1_ctx_t *actx) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - return private_data->s_rnc_id; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->s_rnc_id; } static void private_data_set_s_rnc_id(asn1_ctx_t *actx, guint32 s_rnc_id) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - private_data->s_rnc_id = s_rnc_id; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->s_rnc_id = s_rnc_id; } static guint32 private_data_get_s_rnti(asn1_ctx_t *actx) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - return private_data->s_rnti; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->s_rnti; } static void private_data_set_s_rnti(asn1_ctx_t *actx, guint32 s_rnti) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - private_data->s_rnti = s_rnti; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->s_rnti = s_rnti; } static guint32 private_data_get_new_u_rnti(asn1_ctx_t *actx) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - return private_data->new_u_rnti; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->new_u_rnti; } static void private_data_set_new_u_rnti(asn1_ctx_t *actx, guint32 new_u_rnti) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - private_data->new_u_rnti = new_u_rnti; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->new_u_rnti = new_u_rnti; +} + +static guint32 private_data_get_current_u_rnti(asn1_ctx_t *actx) +{ + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->current_u_rnti; +} + +static void private_data_set_current_u_rnti(asn1_ctx_t *actx, guint32 current_u_rnti) +{ + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->current_u_rnti = current_u_rnti; } static guint32 private_data_get_scrambling_code(asn1_ctx_t *actx) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - return private_data->scrambling_code; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->scrambling_code; } static void private_data_set_scrambling_code(asn1_ctx_t *actx, guint32 scrambling_code) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - private_data->scrambling_code = scrambling_code; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->scrambling_code = scrambling_code; } static enum nas_sys_info_gsm_map private_data_get_cn_domain(asn1_ctx_t *actx) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - return private_data->cn_domain; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + return private_data->cn_domain; } static void private_data_set_cn_domain(asn1_ctx_t *actx, enum nas_sys_info_gsm_map cn_domain) { - umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); - private_data->cn_domain = cn_domain; + umts_rrc_private_data_t *private_data = (umts_rrc_private_data_t*)umts_rrc_get_private_data(actx); + private_data->cn_domain = cn_domain; } /*****************************************************************************/ @@ -393,7 +412,7 @@ static int dissect_SysInfoType22_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tr #define maxWLANs 64 /*--- End of included file: packet-rrc-val.h ---*/ -#line 190 "./asn1/rrc/packet-rrc-template.c" +#line 209 "./asn1/rrc/packet-rrc-template.c" /* Initialize the protocol and registered fields */ int proto_rrc = -1; @@ -11107,7 +11126,7 @@ static int hf_rrc_GsmSecurityCapability_a5_2 = -1; static int hf_rrc_GsmSecurityCapability_a5_1 = -1; /*--- End of included file: packet-rrc-hf.c ---*/ -#line 195 "./asn1/rrc/packet-rrc-template.c" +#line 214 "./asn1/rrc/packet-rrc-template.c" /* Initialize the subtree pointers */ static int ett_rrc = -1; @@ -17929,7 +17948,7 @@ static gint ett_rrc_UE_RadioAccessCapability_r6 = -1; static gint ett_rrc_UL_RFC3095_Context = -1; /*--- End of included file: packet-rrc-ett.c ---*/ -#line 200 "./asn1/rrc/packet-rrc-template.c" +#line 219 "./asn1/rrc/packet-rrc-template.c" static gint ett_rrc_eutraFeatureGroupIndicators = -1; static gint ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo = -1; @@ -18260,7 +18279,7 @@ dissect_rrc_ActivationTime(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _ static int dissect_rrc_RB_Identity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 986 "./asn1/rrc/rrc.cnf" +#line 1058 "./asn1/rrc/rrc.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 1U, 32U, &rbid, FALSE); @@ -18277,7 +18296,7 @@ dissect_rrc_RB_Identity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, static int dissect_rrc_RLC_SequenceNumber(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 992 "./asn1/rrc/rrc.cnf" +#line 1064 "./asn1/rrc/rrc.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, 4095U, &activation_frame, FALSE); @@ -18297,7 +18316,7 @@ static const per_sequence_t RB_ActivationTimeInfo_sequence[] = { static int dissect_rrc_RB_ActivationTimeInfo(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 964 "./asn1/rrc/rrc.cnf" +#line 1036 "./asn1/rrc/rrc.cnf" fp_info *fpinf; rrc_ciphering_info * c_inf; @@ -18415,10 +18434,13 @@ dissect_rrc_U_RNTI(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, prot s_rnti = private_data_get_s_rnti(actx); if(s_rnc_id != 0 && s_rnti != 0) { u_rnti_value = (s_rnc_id << 20) | s_rnti; - /* We are looking for new allocated U-RNTIs, not previously used ones */ + /* Distinguishing between new allocated U-RNTIs and previously used ones */ if (is_new_urnti) { private_data_set_new_u_rnti(actx, u_rnti_value); } + else { + private_data_set_current_u_rnti(actx, u_rnti_value); + } /* Adding U-RNTI value to it's tree item */ proto_item_append_text(actx->created_item,": %08x", u_rnti_value); } @@ -22209,7 +22231,7 @@ dissect_rrc_SSDT_UL(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, pro static int dissect_rrc_CellIdentity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 806 "./asn1/rrc/rrc.cnf" +#line 878 "./asn1/rrc/rrc.cnf" tvbuff_t * cell_id_tvb = NULL; proto_item *temp_ti; proto_tree *cell_identity_tree; @@ -22434,7 +22456,7 @@ dissect_rrc_T_r3(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_ static int dissect_rrc_H_RNTI(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 894 "./asn1/rrc/rrc.cnf" +#line 966 "./asn1/rrc/rrc.cnf" tvbuff_t *hrnti_tvb; struct rrc_info *rrcinf; offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, @@ -22443,7 +22465,7 @@ dissect_rrc_H_RNTI(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, prot -#line 899 "./asn1/rrc/rrc.cnf" +#line 971 "./asn1/rrc/rrc.cnf" rrcinf = (struct rrc_info *)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_rrc, 0); if (!rrcinf) { rrcinf = wmem_new0(wmem_file_scope(), struct rrc_info); @@ -27943,7 +27965,7 @@ dissect_rrc_ScramblingCodeType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac static int dissect_rrc_UL_ScramblingCode(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 801 "./asn1/rrc/rrc.cnf" +#line 873 "./asn1/rrc/rrc.cnf" guint32 scrambling_code; offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, 16777215U, &scrambling_code, FALSE); @@ -38688,8 +38710,78 @@ dissect_rrc_CellChangeOrderFromUTRAN(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx static int dissect_rrc_C_RNTI(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +#line 804 "./asn1/rrc/rrc.cnf" + fp_info *fpinf = NULL; + umts_mac_info *macinf = NULL; + rlc_info *rlcinf = NULL; + conversation_t *p_conv; + umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; + fp_fach_channel_info_t *fp_fach_channel_info = NULL; + tvbuff_t * c_rnti_tvb = NULL; + guint16 c_rnti = 0; + guint32 u_rnti = 0; + fp_crnti_allocation_info_t *fp_crnti_allocation_info = NULL; offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, - 16, 16, FALSE, NULL, NULL); + 16, 16, FALSE, &c_rnti_tvb, NULL); + + if (!c_rnti_tvb) + return offset; + + if(tvb_reported_length(c_rnti_tvb)>=2){ + c_rnti = tvb_get_ntohs(c_rnti_tvb,0); + } + + if(actx->pinfo->fd->flags.visited) /* Frame was already checked*/ + return offset; + + /* Trying to figure where to get the U-RNTI from Either from an ASN.1 field (if this is CCCH) or RLC's attached info (if this is DCCH) */ + fpinf = (fp_info *)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_fp, 0); + macinf = (umts_mac_info *)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_umts_mac, 0); + rlcinf = (rlc_info *)p_get_proto_data(wmem_file_scope(), actx->pinfo, proto_rlc, 0); + if (fpinf && macinf && rlcinf) { + switch(macinf->content[fpinf->cur_tb]){ + case MAC_DCCH: + u_rnti = rlcinf->urnti[fpinf->cur_tb]; + break; + case MAC_CCCH: + default: + u_rnti = private_data_get_current_u_rnti(actx); + break; + } + } + else { + /* Either FP, MAC or RLC info is missing - looking for ASN.1 field as last resort*/ + u_rnti = private_data_get_current_u_rnti(actx); + } + + if(u_rnti == 0 || c_rnti == 0) /* U-RNTI missing or failed to parse C-RNTI */ + return offset; + + /* Both U-RNTI and C-RNTI present - storing the match*/ + fp_crnti_allocation_info = wmem_new0(wmem_file_scope(), fp_crnti_allocation_info_t); + fp_crnti_allocation_info->urnti = u_rnti; + fp_crnti_allocation_info->alloc_frame_number = actx->pinfo->num; + + /* Finding FP conversation info */ + p_conv = (conversation_t *)find_conversation(actx->pinfo->num, &actx->pinfo->net_dst, &actx->pinfo->net_src, + actx->pinfo->ptype, + actx->pinfo->destport, actx->pinfo->srcport, NO_ADDR_B); + + /* If the current FP channel is FACH, Adding the C-RNTI / U-RNTI match to the FACH's RNTIs map*/ + if (p_conv != NULL) { + umts_fp_conversation_info = (umts_fp_conversation_info_t *)conversation_get_proto_data(p_conv, proto_fp); + if (umts_fp_conversation_info && umts_fp_conversation_info->channel == CHANNEL_FACH_FDD) { + fp_fach_channel_info = (fp_fach_channel_info_t *)umts_fp_conversation_info->channel_specific_info; + if(fp_fach_channel_info) { + wmem_tree_insert32(fp_fach_channel_info->crnti_to_urnti_map, c_rnti, (void *)fp_crnti_allocation_info); + } + } + } + + /* Also adding the C-RNTI / U-RNTI match to the global RNTIs map for the RACH channel */ + wmem_tree_insert32(rrc_rach_urnti_crnti_map, c_rnti, (void *)fp_crnti_allocation_info); + + return offset; } @@ -45726,7 +45818,7 @@ dissect_rrc_RLC_Info_r5(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, static int dissect_rrc_MAC_d_FlowIdentity(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 891 "./asn1/rrc/rrc.cnf" +#line 963 "./asn1/rrc/rrc.cnf" offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, 0U, 7U, &flowd, FALSE); @@ -45774,7 +45866,7 @@ static const per_choice_t DL_TransportChannelType_r5_choice[] = { static int dissect_rrc_DL_TransportChannelType_r5(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 820 "./asn1/rrc/rrc.cnf" +#line 892 "./asn1/rrc/rrc.cnf" /*Here we try to figure out which HS-DSCH channels are multiplexed*/ guint *flowd_p; guint *cur_val=NULL; @@ -49248,7 +49340,7 @@ static const per_choice_t DL_TransportChannelType_r7_choice[] = { static int dissect_rrc_DL_TransportChannelType_r7(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 855 "./asn1/rrc/rrc.cnf" +#line 927 "./asn1/rrc/rrc.cnf" /*Here we try to figure out which HS-DSCH channels are multiplexed*/ guint *flowd_p; guint *cur_val=NULL; @@ -88512,7 +88604,7 @@ static const value_string rrc_ReleaseCause_vals[] = { static int dissect_rrc_ReleaseCause(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1013 "./asn1/rrc/rrc.cnf" +#line 1085 "./asn1/rrc/rrc.cnf" guint32 value; offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index, 8, &value, FALSE, 0, NULL); @@ -97933,7 +98025,7 @@ static const per_choice_t DL_DCCH_MessageType_choice[] = { static int dissect_rrc_DL_DCCH_MessageType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 996 "./asn1/rrc/rrc.cnf" +#line 1068 "./asn1/rrc/rrc.cnf" offset = dissect_per_choice(tvb, offset, actx, tree, hf_index, ett_rrc_DL_DCCH_MessageType, DL_DCCH_MessageType_choice, &msg_type); @@ -97953,7 +98045,7 @@ static const per_sequence_t DL_DCCH_Message_sequence[] = { static int dissect_rrc_DL_DCCH_Message(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 999 "./asn1/rrc/rrc.cnf" +#line 1071 "./asn1/rrc/rrc.cnf" offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_rrc_DL_DCCH_Message, DL_DCCH_Message_sequence); @@ -97967,7 +98059,7 @@ dissect_rrc_DL_DCCH_Message(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx static int dissect_rrc_START_Value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 907 "./asn1/rrc/rrc.cnf" +#line 979 "./asn1/rrc/rrc.cnf" tvbuff_t * start_val; fp_info *fpinf; rrc_ciphering_info * c_inf; @@ -127523,7 +127615,7 @@ static const per_choice_t HandoverToUTRANCommand_choice[] = { static int dissect_rrc_HandoverToUTRANCommand(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1002 "./asn1/rrc/rrc.cnf" +#line 1074 "./asn1/rrc/rrc.cnf" offset = dissect_per_choice(tvb, offset, actx, tree, hf_index, ett_rrc_HandoverToUTRANCommand, HandoverToUTRANCommand_choice, NULL); @@ -127664,7 +127756,7 @@ static const per_sequence_t UE_SecurityInformation_sequence[] = { static int dissect_rrc_UE_SecurityInformation(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1005 "./asn1/rrc/rrc.cnf" +#line 1077 "./asn1/rrc/rrc.cnf" private_data_set_cn_domain(actx, RRC_NAS_SYS_INFO_CS); offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_rrc_UE_SecurityInformation, UE_SecurityInformation_sequence); @@ -128067,7 +128159,7 @@ static const per_sequence_t UE_SecurityInformation2_sequence[] = { static int dissect_rrc_UE_SecurityInformation2(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 1009 "./asn1/rrc/rrc.cnf" +#line 1081 "./asn1/rrc/rrc.cnf" private_data_set_cn_domain(actx, RRC_NAS_SYS_INFO_PS); offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_rrc_UE_SecurityInformation2, UE_SecurityInformation2_sequence); @@ -160550,7 +160642,7 @@ static int dissect_MeasurementReport_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _ /*--- End of included file: packet-rrc-fn.c ---*/ -#line 289 "./asn1/rrc/packet-rrc-template.c" +#line 308 "./asn1/rrc/packet-rrc-template.c" @@ -160616,6 +160708,15 @@ rrc_init(void) { NULL, /* data pointer, optional */ NULL, rrc_free_value); + + /*Initialize Scrambling code to U-RNTI dictionary*/ + rrc_scrambling_code_urnti = g_tree_new_full(rrc_key_cmp, + NULL, + NULL, + NULL); + + /* Global U-RNTI / C-RNTI map to be used in RACH channels */ + rrc_rach_urnti_crnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); } static void @@ -203448,7 +203549,7 @@ void proto_register_rrc(void) { NULL, HFILL }}, /*--- End of included file: packet-rrc-hfarr.c ---*/ -#line 370 "./asn1/rrc/packet-rrc-template.c" +#line 398 "./asn1/rrc/packet-rrc-template.c" { &hf_test, { "RAB Test", "rrc.RAB.test", FT_UINT8, BASE_DEC, NULL, 0, @@ -210315,7 +210416,7 @@ void proto_register_rrc(void) { &ett_rrc_UL_RFC3095_Context, /*--- End of included file: packet-rrc-ettarr.c ---*/ -#line 420 "./asn1/rrc/packet-rrc-template.c" +#line 448 "./asn1/rrc/packet-rrc-template.c" &ett_rrc_eutraFeatureGroupIndicators, &ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo, &ett_rrc_ims_info, @@ -210414,7 +210515,7 @@ void proto_register_rrc(void) { /*--- End of included file: packet-rrc-dis-reg.c ---*/ -#line 443 "./asn1/rrc/packet-rrc-template.c" +#line 471 "./asn1/rrc/packet-rrc-template.c" diff --git a/epan/dissectors/packet-rrc.h b/epan/dissectors/packet-rrc.h index bea2ed8f1a..58acb84cbd 100644 --- a/epan/dissectors/packet-rrc.h +++ b/epan/dissectors/packet-rrc.h @@ -84,5 +84,7 @@ typedef struct rrc_ciph_info_ extern GTree * hsdsch_muxed_flows; extern GTree * rrc_ciph_inf; +extern GTree * rrc_scrambling_code_urnti; +extern wmem_tree_t* rrc_rach_urnti_crnti_map; #endif /* PACKET_RRC_H */ diff --git a/epan/dissectors/packet-umts_fp.c b/epan/dissectors/packet-umts_fp.c index a7106e5fdf..31c0170cac 100644 --- a/epan/dissectors/packet-umts_fp.c +++ b/epan/dissectors/packet-umts_fp.c @@ -4112,6 +4112,7 @@ static gboolean heur_dissect_fp_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { conversation_t *p_conv; + fp_fach_channel_info_t* fp_fach_channel_info; umts_fp_conversation_info_t* umts_fp_conversation_info; struct fp_info *p_fp_info; int length; @@ -4202,6 +4203,11 @@ heur_dissect_fp_fach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * umts_fp_conversation_info->fp_dch_channel_info[0].dl_chan_tf_size[1] = 168; umts_fp_conversation_info->fp_dch_channel_info[0].dl_chan_num_tbs[2] = 2; umts_fp_conversation_info->fp_dch_channel_info[0].dl_chan_tf_size[2] = 168; + /* Adding the 'channel specific info' for FACH */ + fp_fach_channel_info = wmem_new0(wmem_file_scope(), fp_fach_channel_info_t); + fp_fach_channel_info->crnti_to_urnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + umts_fp_conversation_info->channel_specific_info = (void*)fp_fach_channel_info; + set_both_sides_umts_fp_conv_data(pinfo, umts_fp_conversation_info); conversation_set_dissector(find_or_create_conversation(pinfo), fp_handle); dissect_fp(tvb, pinfo, tree, data); @@ -4211,6 +4217,7 @@ static gboolean heur_dissect_fp_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { conversation_t *p_conv; + fp_rach_channel_info_t* fp_rach_channel_info; umts_fp_conversation_info_t* umts_fp_conversation_info; struct fp_info *p_fp_info; int length; @@ -4292,6 +4299,12 @@ heur_dissect_fp_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * umts_fp_conversation_info->fp_dch_channel_info[0].num_ul_chans = 0; umts_fp_conversation_info->fp_dch_channel_info[0].ul_chan_num_tbs[0] = 1; umts_fp_conversation_info->fp_dch_channel_info[0].ul_chan_tf_size[0] = 168; + + /* Adding the 'channel specific info' for RACH */ + fp_rach_channel_info = wmem_new0(wmem_file_scope(), fp_rach_channel_info_t); + fp_rach_channel_info->crnti_to_urnti_map = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); + umts_fp_conversation_info->channel_specific_info = (void*)fp_rach_channel_info; + set_both_sides_umts_fp_conv_data(pinfo, umts_fp_conversation_info); conversation_set_dissector(find_or_create_conversation(pinfo), fp_handle); dissect_fp(tvb, pinfo, tree, data); diff --git a/epan/dissectors/packet-umts_fp.h b/epan/dissectors/packet-umts_fp.h index 39239930a6..7bac45bd51 100644 --- a/epan/dissectors/packet-umts_fp.h +++ b/epan/dissectors/packet-umts_fp.h @@ -137,6 +137,28 @@ typedef struct } fp_dch_channel_info_t; +typedef struct fp_crnti_allocation_info_t +{ + guint32 alloc_frame_number; /* Frame where C-RNTI was allocated */ + guint32 urnti; /* The U-RNTI to which the C-RNTI was allocated*/ +} fp_crnti_allocation_info_t; + +/* Used in the 'channel_specific_info' field for FACH channels */ +typedef struct fp_fach_channel_info_t +{ + /* Key: (guint32) C-RNTI */ + /* Value: (fp_crnti_allocation_info_t) U-RNTI allocation info */ + wmem_tree_t* crnti_to_urnti_map; /* Mapping between C-RNTIs and U-RNTIs using them in this FACH */ +} fp_fach_channel_info_t; + +/* Used in the 'channel_specific_info' field for RACH channels */ +typedef struct fp_rach_channel_info_t +{ + /* Key: (guint32) C-RNTI */ + /* Value: (fp_crnti_allocation_info_t) U-RNTI allocation info */ + wmem_tree_t* crnti_to_urnti_map; /* Mapping between C-RNTIs and U-RNTIs using them in this RACH */ +} fp_rach_channel_info_t; + typedef struct { @@ -150,6 +172,8 @@ typedef struct gint com_context_id; /* Identifies a single UE in all NBAP messages */ guint32 scrambling_code; /* Identifies a single UE's radio transmissions in the UTRAN */ + void* channel_specific_info; /* Extended channel info based on the channel type */ + /* For PCH channel */ gint paging_indications; diff --git a/epan/dissectors/packet-umts_mac.c b/epan/dissectors/packet-umts_mac.c index 70dcca49da..9d4ef97e1b 100644 --- a/epan/dissectors/packet-umts_mac.c +++ b/epan/dissectors/packet-umts_mac.c @@ -47,6 +47,8 @@ static int hf_mac_ct = -1; static int hf_mac_ueid_type = -1; static int hf_mac_crnti = -1; static int hf_mac_urnti = -1; +static int hf_mac_resolved_urnti = -1; +static int hf_mac_crnti_urnti_match_frame = -1; static int hf_mac_channel = -1; /* static int hf_mac_channel_str = -1; */ @@ -78,6 +80,7 @@ static int ett_mac_edch = -1; static int ett_mac_hsdsch = -1; static int ett_mac_edch_type2 = -1; static int ett_mac_edch_type2_sdu = -1; +static int ett_mac_resolved_urnti = -1; static expert_field ei_mac_cs_dtch_not_implemented = EI_INIT; static expert_field ei_mac_rach_tctf_unknown = EI_INIT; @@ -231,6 +234,12 @@ static guint16 tree_add_common_dcch_dtch_fields(tvbuff_t *tvb, packet_info *pinf proto_tree *tree, guint16 bitoffs, fp_info *fpinf, umts_mac_info *macinf, rlc_info *rlcinf) { guint8 ueid_type; + conversation_t *p_conv; + umts_fp_conversation_info_t *umts_fp_conversation_info = NULL; + fp_rach_channel_info_t *fp_rach_channel_info = NULL; + fp_fach_channel_info_t *fp_fach_channel_info = NULL; + guint16 c_rnti; + fp_crnti_allocation_info_t *fp_crnti_allocation_info = NULL; ueid_type = tvb_get_bits8(tvb, bitoffs, 2); proto_tree_add_bits_item(tree, hf_mac_ueid_type, tvb, bitoffs, 2, ENC_BIG_ENDIAN); @@ -241,7 +250,62 @@ static guint16 tree_add_common_dcch_dtch_fields(tvbuff_t *tvb, packet_info *pinf bitoffs += 32; } else if (ueid_type == MAC_UEID_TYPE_CRNTI) { proto_tree_add_bits_item(tree, hf_mac_crnti, tvb, 4, 16, ENC_BIG_ENDIAN); - rlcinf->urnti[fpinf->cur_tb] = tvb_get_bits16(tvb, bitoffs, 16,ENC_BIG_ENDIAN); + c_rnti = tvb_get_bits16(tvb, bitoffs, 16,ENC_BIG_ENDIAN); + p_conv = (conversation_t *)find_conversation(pinfo->num, &pinfo->net_dst, &pinfo->net_src, + pinfo->ptype, + pinfo->destport, pinfo->srcport, NO_ADDR_B); + if (p_conv != NULL) { + umts_fp_conversation_info = (umts_fp_conversation_info_t *)conversation_get_proto_data(p_conv, proto_fp); + } + /* Trying to resolve the U-RNTI for this C-RNTI based on the channel type*/ + switch(fpinf->channel){ + case CHANNEL_RACH_FDD: + /* In RACH: First look in the channel's RNTIs map */ + if (umts_fp_conversation_info) { + fp_rach_channel_info = (fp_rach_channel_info_t *)umts_fp_conversation_info->channel_specific_info; + if(fp_rach_channel_info) { + fp_crnti_allocation_info = (fp_crnti_allocation_info_t *)wmem_tree_lookup32(fp_rach_channel_info->crnti_to_urnti_map, c_rnti); + } + } + if(fp_crnti_allocation_info == NULL) { + /* If not found in the channel's map, Look in the global RNTIs map */ + fp_crnti_allocation_info = (fp_crnti_allocation_info_t *)wmem_tree_lookup32(rrc_rach_urnti_crnti_map, c_rnti); + if(fp_crnti_allocation_info != NULL) { + /* If found in the global map, remove and insert to the channel's map*/ + wmem_tree_remove32(rrc_rach_urnti_crnti_map, c_rnti); + if(fp_rach_channel_info) { + wmem_tree_insert32(fp_rach_channel_info->crnti_to_urnti_map, c_rnti, (void *)fp_crnti_allocation_info); + } + } + } + break; + case CHANNEL_FACH_FDD: + /* In FACH: Look in the channel's RNTIs map */ + if (umts_fp_conversation_info) { + fp_fach_channel_info = (fp_fach_channel_info_t *)umts_fp_conversation_info->channel_specific_info; + if(fp_fach_channel_info) { + fp_crnti_allocation_info = (fp_crnti_allocation_info_t *)wmem_tree_lookup32(fp_fach_channel_info->crnti_to_urnti_map, c_rnti); + } + } + break; + } + /* Choosing between resolved U-RNTI (if found) or the C-RNTI as UE-ID for RLC */ + if(fp_crnti_allocation_info != NULL) { + /* Using U-RNTI */ + rlcinf->urnti[fpinf->cur_tb] = fp_crnti_allocation_info->urnti; + /* Adding 'Resolved U-RNTI' related tree items*/ + proto_item *temp; + proto_tree *resolved_urnti_tree; + temp = proto_tree_add_uint(tree, hf_mac_resolved_urnti, tvb, 0, 0, fp_crnti_allocation_info->urnti); + PROTO_ITEM_SET_GENERATED(temp); + resolved_urnti_tree = proto_item_add_subtree(temp, ett_mac_resolved_urnti); + temp = proto_tree_add_uint(resolved_urnti_tree , hf_mac_crnti_urnti_match_frame, tvb, 0, 0, fp_crnti_allocation_info->alloc_frame_number); + PROTO_ITEM_SET_GENERATED(temp); + } + else { + /* Using C-RNTI */ + rlcinf->urnti[fpinf->cur_tb] = c_rnti; + } bitoffs += 16; } @@ -1311,7 +1375,8 @@ proto_register_umts_mac(void) &ett_mac_edch, &ett_mac_hsdsch, &ett_mac_edch_type2, - &ett_mac_edch_type2_sdu + &ett_mac_edch_type2_sdu, + &ett_mac_resolved_urnti }; /** XX: Looks like some duplicate filter names ?? **/ /** XX: May be OK: See doc/README.developer **/ @@ -1340,6 +1405,18 @@ proto_register_umts_mac(void) { "U-RNTI (UEID)", "mac.ueid", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_mac_resolved_urnti, + { "Resolved U-RNTI", "mac.resolved_urnti", + FT_UINT32, BASE_HEX, NULL, 0x0, + "The U-RNTI of the UE which is using the C-RNTI seen in this frame", + HFILL } + }, + { &hf_mac_crnti_urnti_match_frame, + { "C-RNTI Allocation Frame", "mac.crnti_urnti_match_frame", + FT_FRAMENUM, BASE_NONE, NULL, 0x0, + "The frame number where the C-RNTI was allocated for the UE", + HFILL } + }, { &hf_mac_channel, { "Logical Channel Type", "mac.logical_channel", FT_UINT16, BASE_DEC, VALS(mac_logical_channel_vals), 0, NULL, HFILL } |