Fix detection of H-RNTI when it is given after the DL-TransportChannelType configuration (typically in case of handoverToUTRANCommand)

svn path=/trunk/; revision=46012
This commit is contained in:
Pascal Quantin 2012-11-12 21:39:14 +00:00
parent 9f3ff78604
commit 4e96e6c475
5 changed files with 73 additions and 68 deletions

View File

@ -133,7 +133,6 @@ static const true_false_string rrc_eutra_feat_group_ind_4_val = {
};
static int flowd,type;
static tvbuff_t * hrnti = NULL;
static int cipher_start_val[2] _U_;
/*Stores how many channels we have detected for a HS-DSCH MAC-flow*/

View File

@ -44,6 +44,7 @@ enum rrc_message_type {
typedef struct rrc_info
{
enum rrc_message_type msgtype[MAX_RRC_FRAMES];
guint16 hrnti[MAX_RRC_FRAMES];
} rrc_info;
/*Struct for storing ciphering information*/

View File

@ -398,7 +398,7 @@ fp_info *fpinf ;
%(DEFAULT_BODY)s
fpinf = p_get_proto_data(actx->pinfo->fd, proto_fp);
if(fpinf && ((c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER((gint)fpinf->com_context_id))) != NULL) ){
if(fpinf && ((c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER(fpinf->com_context_id))) != NULL) ){
c_inf->setup_frame = actx->pinfo->fd->num;
}
@ -670,7 +670,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
gint *flowd_p;
gint *cur_val=NULL;
guint16 hr=0;
struct rrc_info *rrcinf;
%(DEFAULT_BODY)s
@ -679,20 +679,17 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
num_chans_per_flow[flowd]++;
if(num_chans_per_flow[flowd] > 1 ){
if(hrnti == NULL){
expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Did not detect any H-RNTI ");
rrcinf = p_get_proto_data(actx->pinfo->fd, proto_rrc);
if((rrcinf == NULL) || (rrcinf->hrnti[actx->pinfo->fd->subnum] == 0)){
expert_add_info_format(actx->pinfo, actx->created_item, PI_SEQUENCE, PI_NOTE, "Did not detect any H-RNTI");
}
else{
/*Read the H-RNTI value*/
hr = tvb_get_bits16(hrnti,0,16,TRUE);
/*If it doesnt exists, insert it*/
if( (cur_val=g_tree_lookup(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr))) == NULL ){
if( (cur_val=g_tree_lookup(hsdsch_muxed_flows, GUINT_TO_POINTER(rrcinf->hrnti[actx->pinfo->fd->subnum]))) == NULL ){
flowd_p = (guint*)g_malloc0(sizeof(gint));
*flowd_p = (1<<flowd); /*Set the bit to mark it as true*/
g_tree_insert(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr), flowd_p);
g_tree_insert(hsdsch_muxed_flows, GUINT_TO_POINTER(rrcinf->hrnti[actx->pinfo->fd->subnum]), flowd_p);
}else{
*cur_val = (1<<flowd) | *cur_val;
@ -708,7 +705,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
gint *flowd_p;
gint *cur_val=NULL;
guint16 hr=0;
struct rrc_info *rrcinf;
%(DEFAULT_BODY)s
@ -718,20 +715,17 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
if(num_chans_per_flow[flowd] > 1 ){
if(hrnti == NULL){
expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Did not detect any H-RNTI ");
rrcinf = p_get_proto_data(actx->pinfo->fd, proto_rrc);
if((rrcinf == NULL) || (rrcinf->hrnti[actx->pinfo->fd->subnum] == 0)){
expert_add_info_format(actx->pinfo, actx->created_item, PI_SEQUENCE, PI_NOTE, "Did not detect any H-RNTI");
}
else{
/*Read the H-RNTI value*/
hr = tvb_get_bits16(hrnti,0,16,TRUE);
/*If it doesnt exists, insert it*/
if( (cur_val=g_tree_lookup(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr))) == NULL ){
if( (cur_val=g_tree_lookup(hsdsch_muxed_flows, GUINT_TO_POINTER(rrcinf->hrnti[actx->pinfo->fd->subnum]))) == NULL ){
flowd_p = (guint*)g_malloc0(sizeof(gint));
*flowd_p = (1<<flowd); /* Set the bit to mark it as true*/
g_tree_insert(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr), flowd_p);
g_tree_insert(hsdsch_muxed_flows, GUINT_TO_POINTER(rrcinf->hrnti[actx->pinfo->fd->subnum]), flowd_p);
}else{
*cur_val = (1<<flowd) | *cur_val;
@ -746,9 +740,19 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
#.FN_BODY MAC-d-FlowIdentity VAL_PTR = &flowd
%(DEFAULT_BODY)s
#.FN_BODY H-RNTI VAL_PTR = &hrnti
#.FN_BODY H-RNTI VAL_PTR = &hrnti_tvb
tvbuff_t *hrnti_tvb;
struct rrc_info *rrcinf;
%(DEFAULT_BODY)s
#.FN_FTR H-RNTI
rrcinf = p_get_proto_data(actx->pinfo->fd, proto_rrc);
if (!rrcinf) {
rrcinf = se_alloc0(sizeof(struct rrc_info));
p_add_proto_data(actx->pinfo->fd, proto_rrc, rrcinf);
}
rrcinf->hrnti[actx->pinfo->fd->subnum] = tvb_get_ntohs(hrnti_tvb, 0);
#.FN_BODY START-Value VAL_PTR = &start_val
tvbuff_t * start_val;
fp_info *fpinf;
@ -775,7 +779,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
case RRC_NAS_SYS_INFO_PS:
/*Find the entry for the communication context (taken from FP)*/
if( (c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER((gint)fpinf->com_context_id))) == NULL ){
if( (c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER(fpinf->com_context_id))) == NULL ){
c_inf = g_malloc0(sizeof(rrc_ciphering_info));
/*Initiate tree with START_PS values.*/
@ -788,7 +792,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
c_inf->seq_no[i][0] = -1;
c_inf->seq_no[i][1] = -1;
}
g_tree_insert(rrc_ciph_inf, GINT_TO_POINTER((gint)fpinf->com_context_id), c_inf);
g_tree_insert(rrc_ciph_inf, GINT_TO_POINTER(fpinf->com_context_id), c_inf);
}
/*Retrieve and store the value*/
@ -796,7 +800,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
*start = tvb_get_bits32(start_val,0,20,ENC_BIG_ENDIAN);
if(c_inf && c_inf->start_ps)
/*Insert the value based on current frame num since this might vary over time*/
g_tree_insert(c_inf->start_ps, GINT_TO_POINTER((gint)actx->pinfo->fd->num), start);
g_tree_insert(c_inf->start_ps, GUINT_TO_POINTER(actx->pinfo->fd->num), start);
break;
default:
@ -819,7 +823,7 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
return offset;
}
/*This should not happen*/
if( (c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER((gint)fpinf->com_context_id))) == NULL ){
if( (c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER(fpinf->com_context_id))) == NULL ){
return offset;
}
/*Set the ciphering activation frame information*/
@ -841,11 +845,9 @@ HNBName TYPE=FT_STRING DISPLAY=BASE_NONE
#.FN_BODY DL-DCCH-Message
%(DEFAULT_BODY)s
hrnti = NULL;
#.FN_BODY HandoverToUTRANCommand
%(DEFAULT_BODY)s
hrnti = NULL;
#.END

View File

@ -14800,7 +14800,6 @@ static const true_false_string rrc_eutra_feat_group_ind_4_val = {
};
static int flowd,type;
static tvbuff_t * hrnti = NULL;
static int cipher_start_val[2] _U_;
/*Stores how many channels we have detected for a HS-DSCH MAC-flow*/
@ -15085,7 +15084,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 830 "../../asn1/rrc/rrc.cnf"
#line 834 "../../asn1/rrc/rrc.cnf"
offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
1U, 32U, &rbid, FALSE);
@ -15102,7 +15101,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 836 "../../asn1/rrc/rrc.cnf"
#line 840 "../../asn1/rrc/rrc.cnf"
offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
0U, 4095U, &activation_frame, FALSE);
@ -15122,7 +15121,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 809 "../../asn1/rrc/rrc.cnf"
#line 813 "../../asn1/rrc/rrc.cnf"
fp_info *fpinf;
rrc_ciphering_info * c_inf;
@ -15138,7 +15137,7 @@ dissect_rrc_RB_ActivationTimeInfo(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
return offset;
}
/*This should not happen*/
if( (c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER((gint)fpinf->com_context_id))) == NULL ){
if( (c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER(fpinf->com_context_id))) == NULL ){
return offset;
}
/*Set the ciphering activation frame information*/
@ -19200,13 +19199,24 @@ 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 750 "../../asn1/rrc/rrc.cnf"
#line 744 "../../asn1/rrc/rrc.cnf"
tvbuff_t *hrnti_tvb;
struct rrc_info *rrcinf;
offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index,
16, 16, FALSE, &hrnti);
16, 16, FALSE, &hrnti_tvb);
#line 749 "../../asn1/rrc/rrc.cnf"
rrcinf = p_get_proto_data(actx->pinfo->fd, proto_rrc);
if (!rrcinf) {
rrcinf = se_alloc0(sizeof(struct rrc_info));
p_add_proto_data(actx->pinfo->fd, proto_rrc, rrcinf);
}
rrcinf->hrnti[actx->pinfo->fd->subnum] = tvb_get_ntohs(hrnti_tvb, 0);
return offset;
}
@ -38373,7 +38383,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 747 "../../asn1/rrc/rrc.cnf"
#line 741 "../../asn1/rrc/rrc.cnf"
offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
0U, 7U, &flowd, FALSE);
@ -38425,7 +38435,7 @@ dissect_rrc_DL_TransportChannelType_r5(tvbuff_t *tvb _U_, int offset _U_, asn1_c
gint *flowd_p;
gint *cur_val=NULL;
guint16 hr=0;
struct rrc_info *rrcinf;
offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
ett_rrc_DL_TransportChannelType_r5, DL_TransportChannelType_r5_choice,
@ -38437,20 +38447,17 @@ dissect_rrc_DL_TransportChannelType_r5(tvbuff_t *tvb _U_, int offset _U_, asn1_c
num_chans_per_flow[flowd]++;
if(num_chans_per_flow[flowd] > 1 ){
if(hrnti == NULL){
expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Did not detect any H-RNTI ");
rrcinf = p_get_proto_data(actx->pinfo->fd, proto_rrc);
if((rrcinf == NULL) || (rrcinf->hrnti[actx->pinfo->fd->subnum] == 0)){
expert_add_info_format(actx->pinfo, actx->created_item, PI_SEQUENCE, PI_NOTE, "Did not detect any H-RNTI");
}
else{
/*Read the H-RNTI value*/
hr = tvb_get_bits16(hrnti,0,16,TRUE);
/*If it doesnt exists, insert it*/
if( (cur_val=g_tree_lookup(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr))) == NULL ){
if( (cur_val=g_tree_lookup(hsdsch_muxed_flows, GUINT_TO_POINTER(rrcinf->hrnti[actx->pinfo->fd->subnum]))) == NULL ){
flowd_p = (guint*)g_malloc0(sizeof(gint));
*flowd_p = (1<<flowd); /*Set the bit to mark it as true*/
g_tree_insert(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr), flowd_p);
g_tree_insert(hsdsch_muxed_flows, GUINT_TO_POINTER(rrcinf->hrnti[actx->pinfo->fd->subnum]), flowd_p);
}else{
*cur_val = (1<<flowd) | *cur_val;
@ -41898,11 +41905,11 @@ 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 708 "../../asn1/rrc/rrc.cnf"
#line 705 "../../asn1/rrc/rrc.cnf"
gint *flowd_p;
gint *cur_val=NULL;
guint16 hr=0;
struct rrc_info *rrcinf;
offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
ett_rrc_DL_TransportChannelType_r7, DL_TransportChannelType_r7_choice,
@ -41915,20 +41922,17 @@ dissect_rrc_DL_TransportChannelType_r7(tvbuff_t *tvb _U_, int offset _U_, asn1_c
if(num_chans_per_flow[flowd] > 1 ){
if(hrnti == NULL){
expert_add_info_format(actx->pinfo, NULL, PI_MALFORMED, PI_WARN, "Did not detect any H-RNTI ");
rrcinf = p_get_proto_data(actx->pinfo->fd, proto_rrc);
if((rrcinf == NULL) || (rrcinf->hrnti[actx->pinfo->fd->subnum] == 0)){
expert_add_info_format(actx->pinfo, actx->created_item, PI_SEQUENCE, PI_NOTE, "Did not detect any H-RNTI");
}
else{
/*Read the H-RNTI value*/
hr = tvb_get_bits16(hrnti,0,16,TRUE);
/*If it doesnt exists, insert it*/
if( (cur_val=g_tree_lookup(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr))) == NULL ){
if( (cur_val=g_tree_lookup(hsdsch_muxed_flows, GUINT_TO_POINTER(rrcinf->hrnti[actx->pinfo->fd->subnum]))) == NULL ){
flowd_p = (guint*)g_malloc0(sizeof(gint));
*flowd_p = (1<<flowd); /* Set the bit to mark it as true*/
g_tree_insert(hsdsch_muxed_flows, GINT_TO_POINTER((gint)hr), flowd_p);
g_tree_insert(hsdsch_muxed_flows, GUINT_TO_POINTER(rrcinf->hrnti[actx->pinfo->fd->subnum]), flowd_p);
}else{
*cur_val = (1<<flowd) | *cur_val;
@ -80080,7 +80084,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 840 "../../asn1/rrc/rrc.cnf"
#line 844 "../../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);
@ -80100,11 +80104,10 @@ 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 843 "../../asn1/rrc/rrc.cnf"
#line 847 "../../asn1/rrc/rrc.cnf"
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_rrc_DL_DCCH_Message, DL_DCCH_Message_sequence);
hrnti = NULL;
@ -80115,7 +80118,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 753 "../../asn1/rrc/rrc.cnf"
#line 757 "../../asn1/rrc/rrc.cnf"
tvbuff_t * start_val;
fp_info *fpinf;
rrc_ciphering_info * c_inf;
@ -80143,7 +80146,7 @@ dissect_rrc_START_Value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_,
case RRC_NAS_SYS_INFO_PS:
/*Find the entry for the communication context (taken from FP)*/
if( (c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER((gint)fpinf->com_context_id))) == NULL ){
if( (c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER(fpinf->com_context_id))) == NULL ){
c_inf = g_malloc0(sizeof(rrc_ciphering_info));
/*Initiate tree with START_PS values.*/
@ -80156,7 +80159,7 @@ dissect_rrc_START_Value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_,
c_inf->seq_no[i][0] = -1;
c_inf->seq_no[i][1] = -1;
}
g_tree_insert(rrc_ciph_inf, GINT_TO_POINTER((gint)fpinf->com_context_id), c_inf);
g_tree_insert(rrc_ciph_inf, GINT_TO_POINTER(fpinf->com_context_id), c_inf);
}
/*Retrieve and store the value*/
@ -80164,7 +80167,7 @@ dissect_rrc_START_Value(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_,
*start = tvb_get_bits32(start_val,0,20,ENC_BIG_ENDIAN);
if(c_inf && c_inf->start_ps)
/*Insert the value based on current frame num since this might vary over time*/
g_tree_insert(c_inf->start_ps, GINT_TO_POINTER((gint)actx->pinfo->fd->num), start);
g_tree_insert(c_inf->start_ps, GUINT_TO_POINTER(actx->pinfo->fd->num), start);
break;
default:
@ -90035,7 +90038,7 @@ fp_info *fpinf ;
fpinf = p_get_proto_data(actx->pinfo->fd, proto_fp);
if(fpinf && ((c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER((gint)fpinf->com_context_id))) != NULL) ){
if(fpinf && ((c_inf = g_tree_lookup(rrc_ciph_inf, GINT_TO_POINTER(fpinf->com_context_id))) != NULL) ){
c_inf->setup_frame = actx->pinfo->fd->num;
}
@ -104882,12 +104885,11 @@ 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 847 "../../asn1/rrc/rrc.cnf"
#line 850 "../../asn1/rrc/rrc.cnf"
offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
ett_rrc_HandoverToUTRANCommand, HandoverToUTRANCommand_choice,
NULL);
hrnti = NULL;
@ -131087,7 +131089,7 @@ static int dissect_MeasurementReport_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _
/*--- End of included file: packet-rrc-fn.c ---*/
#line 180 "../../asn1/rrc/packet-rrc-template.c"
#line 179 "../../asn1/rrc/packet-rrc-template.c"
#include "packet-rrc.h"
@ -166660,7 +166662,7 @@ void proto_register_rrc(void) {
NULL, HFILL }},
/*--- End of included file: packet-rrc-hfarr.c ---*/
#line 260 "../../asn1/rrc/packet-rrc-template.c"
#line 259 "../../asn1/rrc/packet-rrc-template.c"
{ &hf_test,
{ "RAB Test", "rrc.RAB.test",
FT_UINT8, BASE_DEC, NULL, 0,
@ -172300,7 +172302,7 @@ void proto_register_rrc(void) {
&ett_rrc_UL_RFC3095_Context,
/*--- End of included file: packet-rrc-ettarr.c ---*/
#line 286 "../../asn1/rrc/packet-rrc-template.c"
#line 285 "../../asn1/rrc/packet-rrc-template.c"
&ett_rrc_eutraFeatureGroupIndicators,
&ett_rrc_cn_CommonGSM_MAP_NAS_SysInfo,
};
@ -172380,7 +172382,7 @@ void proto_register_rrc(void) {
/*--- End of included file: packet-rrc-dis-reg.c ---*/
#line 300 "../../asn1/rrc/packet-rrc-template.c"
#line 299 "../../asn1/rrc/packet-rrc-template.c"

View File

@ -68,6 +68,7 @@ enum rrc_message_type {
typedef struct rrc_info
{
enum rrc_message_type msgtype[MAX_RRC_FRAMES];
guint16 hrnti[MAX_RRC_FRAMES];
} rrc_info;
/*Struct for storing ciphering information*/