Commit d62a111c authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/NR_UE_fix_ASN1_memleak' into integration_2022_wk49

parents 78a67592 7da2ed30
...@@ -551,43 +551,31 @@ int8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){ ...@@ -551,43 +551,31 @@ int8_t nr_ue_process_spcell_config(NR_SpCellConfig_t *spcell_config){
} }
/*brief decode BCCH-BCH (MIB) message*/ /*brief decode BCCH-BCH (MIB) message*/
int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len)
const module_id_t module_id, {
const uint8_t gNB_index, NR_BCCH_BCH_Message_t *bcch_message = NULL;
uint8_t *const bufferP,
const uint8_t buffer_len ){
NR_BCCH_BCH_Message_t *bcch_message = NULL;
if (NR_UE_rrc_inst[module_id].mib != NULL)
SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 );
else
LOG_A(NR_RRC, "Configuring MAC for first MIB reception\n");
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
&asn_DEF_NR_BCCH_BCH_Message,
(void **)&bcch_message,
(const void *)bufferP,
buffer_len );
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
LOG_E(NR_RRC,"NR_BCCH_BCH decode error\n");
// free the memory
SEQUENCE_free( &asn_DEF_NR_BCCH_BCH_Message, (void *)bcch_message, 1 );
return -1;
}
else {
// link to rrc instance
SEQUENCE_free( &asn_DEF_NR_MIB, (void *)NR_UE_rrc_inst[module_id].mib, 1 );
NR_UE_rrc_inst[module_id].mib = bcch_message->message.choice.mib;
//memcpy( (void *)mib,
// (void *)&bcch_message->message.choice.mib,
// sizeof(NR_MIB_t) );
nr_rrc_mac_config_req_ue( 0, 0, 0, NR_UE_rrc_inst[module_id].mib, NULL, NULL, NULL);
}
return 0; if (NR_UE_rrc_inst[module_id].mib == NULL)
LOG_A(NR_RRC, "Configuring MAC for first MIB reception\n");
asn_dec_rval_t dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_BCCH_BCH_Message, (void **)&bcch_message, (const void *)bufferP, buffer_len);
int ret;
if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) {
LOG_E(NR_RRC, "NR_BCCH_BCH decode error\n");
ret = -1;
} else {
// link to rrc instance
ASN_STRUCT_FREE(asn_DEF_NR_MIB, NR_UE_rrc_inst[module_id].mib);
NR_UE_rrc_inst[module_id].mib = bcch_message->message.choice.mib;
bcch_message->message.choice.mib = NULL;
nr_rrc_mac_config_req_ue(0, 0, 0, NR_UE_rrc_inst[module_id].mib, NULL, NULL, NULL);
ret = 0;
}
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, bcch_message);
return ret;
} }
const char *nr_SIBreserved( long value ) { const char *nr_SIBreserved( long value ) {
...@@ -2245,6 +2233,7 @@ nr_rrc_ue_establish_srb2( ...@@ -2245,6 +2233,7 @@ nr_rrc_ue_establish_srb2(
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
LOG_E(NR_RRC, "Failed to decode DL-DCCH (%zu bytes)\n", dec_rval.consumed); LOG_E(NR_RRC, "Failed to decode DL-DCCH (%zu bytes)\n", dec_rval.consumed);
ASN_STRUCT_FREE(asn_DEF_NR_DL_DCCH_Message, dl_dcch_msg);
return -1; return -1;
} }
...@@ -2252,88 +2241,88 @@ nr_rrc_ue_establish_srb2( ...@@ -2252,88 +2241,88 @@ nr_rrc_ue_establish_srb2(
xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg); xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg);
} }
if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) {
switch (dl_dcch_msg->message.choice.c1->present) { switch (dl_dcch_msg->message.choice.c1->present) {
case NR_DL_DCCH_MessageType__c1_PR_NOTHING: case NR_DL_DCCH_MessageType__c1_PR_NOTHING:
LOG_I(NR_RRC, "Received PR_NOTHING on DL-DCCH-Message\n"); LOG_I(NR_RRC, "Received PR_NOTHING on DL-DCCH-Message\n");
break; break;
case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration:
{ {
rrc_ue_process_rrcReconfiguration(ctxt_pP, rrc_ue_process_rrcReconfiguration(ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration, dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration,
gNB_indexP); gNB_indexP);
nr_rrc_ue_generate_RRCReconfigurationComplete(ctxt_pP, nr_rrc_ue_generate_RRCReconfigurationComplete(ctxt_pP,
gNB_indexP, gNB_indexP,
dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier); dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration->rrc_TransactionIdentifier);
break; break;
} }
case NR_DL_DCCH_MessageType__c1_PR_rrcResume: case NR_DL_DCCH_MessageType__c1_PR_rrcResume:
case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: case NR_DL_DCCH_MessageType__c1_PR_rrcRelease:
LOG_I(NR_RRC, "[UE %d] Received RRC Release (gNB %d)\n", LOG_I(NR_RRC, "[UE %d] Received RRC Release (gNB %d)\n",
ctxt_pP->module_id, gNB_indexP); ctxt_pP->module_id, gNB_indexP);
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND); msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND);
if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) && if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present ==
(dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){ NR_RRCRelease__criticalExtensions_PR_rrcRelease) &&
dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer = (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)) {
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5; dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer =
dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType = NR_RRCRelease_IEs__deprioritisationReq__deprioritisationTimer_min5;
NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency; dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationType =
} NR_RRCRelease_IEs__deprioritisationReq__deprioritisationType_frequency;
}
itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p);
break; break;
case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry:
LOG_I(NR_RRC, "[UE %d] Received Capability Enquiry (gNB %d)\n", ctxt_pP->module_id,gNB_indexP); LOG_I(NR_RRC, "[UE %d] Received Capability Enquiry (gNB %d)\n", ctxt_pP->module_id,gNB_indexP);
nr_rrc_ue_process_ueCapabilityEnquiry( nr_rrc_ue_process_ueCapabilityEnquiry(
ctxt_pP, ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.ueCapabilityEnquiry, dl_dcch_msg->message.choice.c1->choice.ueCapabilityEnquiry,
gNB_indexP); gNB_indexP);
break; break;
case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment:
LOG_I(NR_RRC, LOG_I(NR_RRC,
"[UE%d] Frame %d : Logical Channel DL-DCCH (SRB1), Received RRCReestablishment\n", "[UE%d] Frame %d : Logical Channel DL-DCCH (SRB1), Received RRCReestablishment\n",
ctxt_pP->module_id, ctxt_pP->module_id,
ctxt_pP->frame); ctxt_pP->frame);
nr_rrc_ue_generate_rrcReestablishmentComplete( nr_rrc_ue_generate_rrcReestablishmentComplete(
ctxt_pP, ctxt_pP,
dl_dcch_msg->message.choice.c1->choice.rrcReestablishment, dl_dcch_msg->message.choice.c1->choice.rrcReestablishment,
gNB_indexP); gNB_indexP);
break; break;
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer:
{ {
NR_DLInformationTransfer_t *dlInformationTransfer = dl_dcch_msg->message.choice.c1->choice.dlInformationTransfer; NR_DLInformationTransfer_t *dlInformationTransfer = dl_dcch_msg->message.choice.c1->choice.dlInformationTransfer;
if (dlInformationTransfer->criticalExtensions.present if (dlInformationTransfer->criticalExtensions.present
== NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer) { == NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer) {
/* This message hold a dedicated info NAS payload, forward it to NAS */ /* This message hold a dedicated info NAS payload, forward it to NAS */
NR_DedicatedNAS_Message_t *dedicatedNAS_Message = NR_DedicatedNAS_Message_t *dedicatedNAS_Message =
dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message; dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message;
MessageDef *msg_p; MessageDef *msg_p;
msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_DOWNLINK_DATA_IND); msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_DOWNLINK_DATA_IND);
NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ? NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ?
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = dedicatedNAS_Message->size; NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = dedicatedNAS_Message->size;
NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = dedicatedNAS_Message->buf; NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = dedicatedNAS_Message->buf;
itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p); itti_send_msg_to_task(TASK_NAS_NRUE, ctxt_pP->instance, msg_p);
} }
} }
break;
break; case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand:
case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16:
case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16:
case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16: case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16:
case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16: case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16:
case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16: case NR_DL_DCCH_MessageType__c1_PR_spare3:
case NR_DL_DCCH_MessageType__c1_PR_spare3: case NR_DL_DCCH_MessageType__c1_PR_spare2:
case NR_DL_DCCH_MessageType__c1_PR_spare2: case NR_DL_DCCH_MessageType__c1_PR_spare1:
case NR_DL_DCCH_MessageType__c1_PR_spare1: case NR_DL_DCCH_MessageType__c1_PR_counterCheck:
case NR_DL_DCCH_MessageType__c1_PR_counterCheck: break;
break; case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand:
LOG_I(NR_RRC, "[UE %d] Received securityModeCommand (gNB %d)\n", LOG_I(NR_RRC, "[UE %d] Received securityModeCommand (gNB %d)\n",
ctxt_pP->module_id, gNB_indexP); ctxt_pP->module_id, gNB_indexP);
nr_rrc_ue_process_securityModeCommand( nr_rrc_ue_process_securityModeCommand(
...@@ -2342,8 +2331,8 @@ nr_rrc_ue_establish_srb2( ...@@ -2342,8 +2331,8 @@ nr_rrc_ue_establish_srb2(
gNB_indexP); gNB_indexP);
break; break;
}
} }
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment