diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index f0b7194bce..6f6a84e404 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -965,35 +965,36 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[instance], rnti); - - /* The following is normally done in the function rrc_rx_tx() */ - rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(instance, - ue_context_p->ue_context.eNB_ue_s1ap_id); - - rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(instance, ue_context_p); - // erase data of GTP tunnels in UE context - for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], - 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); - ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; - } - - struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = - rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], 0, - ue_context_p->ue_context.eNB_ue_s1ap_id); - if (rrc_ue_s1ap_ids) - rrc_eNB_S1AP_remove_ue_ids(RC.rrc[instance], rrc_ue_s1ap_ids); - - /* The following is normally done in the function release_UE_in_freeList() */ - /* remove PDCP entry */ protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, instance, ENB_FLAG_YES, rnti, 0, 0, instance); - pdcp_remove_UE(&ctxt); - /* trigger UE release in RRC */ - if (ue_context_p) + if (ue_context_p) { + /* The following is normally done in the function rrc_rx_tx() */ + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(instance, + ue_context_p->ue_context.eNB_ue_s1ap_id); + + rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(instance, ue_context_p); + // erase data of GTP tunnels in UE context + for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], + 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); + ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; + } + + struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = + rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], 0, + ue_context_p->ue_context.eNB_ue_s1ap_id); + if (rrc_ue_s1ap_ids) + rrc_eNB_S1AP_remove_ue_ids(RC.rrc[instance], rrc_ue_s1ap_ids); + + /* trigger UE release in RRC */ rrc_eNB_remove_ue_context(&ctxt, RC.rrc[instance], ue_context_p); + } else { + LOG_E(F1AP, "could not find ue_context of UE RNTI %x\n", rnti); + } + + pdcp_remove_UE(&ctxt); /* notify the agent */ if (flexran_agent_get_rrc_xface(instance)) diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 5b3fc4addd..f076b28a44 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -563,7 +563,7 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, //void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, instance_t du_mod_idP, - f1ap_setup_req_t *f1ap_du_data) { + f1ap_setup_req_t *f1ap_setup_req) { F1AP_F1AP_PDU_t pdu; F1AP_GNBDUConfigurationUpdate_t *out; F1AP_GNBDUConfigurationUpdateIEs_t *ie; @@ -619,22 +619,22 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", nRCGI.nRCellIdentity.buf[0], nRCGI.nRCellIdentity.buf[1], nRCGI.nRCellIdentity.buf[2], nRCGI.nRCellIdentity.buf[3], nRCGI.nRCellIdentity.buf[4]); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; /* - nRPCI */ - served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 + served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - (const char *) &f1ap_du_data->tac[i], + (const char *) &f1ap_setup_req->tac[i], 3); /* - Configured_EPS_TAC */ @@ -653,14 +653,14 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* > PLMN BroadcastPLMNs Item */ F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); } // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; - if ("FDD") { + if (f1ap_setup_req->fdd_flag) { nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); @@ -778,9 +778,9 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* 3.1 oldNRCGI */ F1AP_NRCGI_t oldNRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &oldNRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); served_cells_to_modify_item.oldNRCGI = oldNRCGI; @@ -790,17 +790,17 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - nRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); served_cell_information.nRCGI = nRCGI; /* - nRPCI */ - served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 + served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, - (const char *) &f1ap_du_data->tac[i], + (const char *) &f1ap_setup_req->tac[i], 3); /* - Configured_EPS_TAC */ @@ -819,14 +819,14 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* > PLMN BroadcastPLMNs Item */ F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); } // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; - if ("FDD") { + if (f1ap_setup_req->fdd_flag) { nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); @@ -944,9 +944,9 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* 3.1 oldNRCGI */ F1AP_NRCGI_t oldNRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &oldNRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); served_cells_to_delete_item.oldNRCGI = oldNRCGI; /* ADD */ @@ -980,9 +980,9 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* 3.1 oldNRCGI */ F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); active_cells_item.nRCGI = nRCGI; /* ADD */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index a5aa5da569..1a0494eccc 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -522,8 +522,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, boolean_t ret = TRUE; mem_block_t *pdcp_pdu_p = NULL; pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); - memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len); - memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); //LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size); //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) @@ -534,7 +532,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, //printf("\n"); - if (pdcp_pdu_p != NULL) { + if (pdcp_pdu_p != NULL) { + memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len); + memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); rlc_status = rlc_data_req(&ctxt , 1 , MBMS_FLAG_NO diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 4af453e4e4..1a80132ea8 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -301,8 +301,8 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { /* OPTIONAL */ /* lCID */ - drbs_setup_item.lCID = (F1AP_LCID_t *)calloc(1, sizeof(F1AP_LCID_t)); - drbs_setup_item.lCID = 0L; + //drbs_setup_item.lCID = (F1AP_LCID_t *)calloc(1, sizeof(F1AP_LCID_t)); + //drbs_setup_item.lCID = 1L; for (j=0; j<1; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index a1f04edf54..35046a4b36 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -1179,7 +1179,7 @@ rrc_eNB_generate_SecurityModeCommand( rrc_eNB_mui, size); - if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) || + if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_DU) && (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_DU)) { LOG_I(RRC,"calling rrc_data_req :securityModeCommand\n"); @@ -6507,8 +6507,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); */ - if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + if ( (RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) && (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { rrc_rlc_config_req(ctxt_pP, SRB_FLAG_NO, @@ -7210,8 +7210,8 @@ rrc_eNB_decode_ccch( if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); - if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) || - (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) || + if ((RC.rrc[ctxt_pP->module_id]->node_type != ngran_eNB_CU) && + (RC.rrc[ctxt_pP->module_id]->node_type != ngran_ng_eNB_CU) && (RC.rrc[ctxt_pP->module_id]->node_type != ngran_gNB_CU) ) { rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); }