From ca1805faaf3cb2ce3a7d8c3991a4378c9aa90594 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 3 Sep 2021 10:13:59 -0700 Subject: [PATCH] IP ping traffic is working correctly In this commit we have updated the NRUE to properly get the RadioBearer info from the gNB. Because NSA and SA mode both use this information, we have updated the SA function previously in place by changing the name to allow both NSA and SA mode to use. This commit also updated the NR/LTE UEs configuration files to with the correct proxy IP address. --- ci-scripts/conf_files/nr-ue.nfapi.conf | 4 +- ci-scripts/conf_files/ue.nfapi.conf | 4 +- executables/nr-ue.c | 2 - openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 19 ++-------- openair2/RRC/NR_UE/rrc_UE.c | 46 ++++++++++++++--------- 5 files changed, 35 insertions(+), 40 deletions(-) diff --git a/ci-scripts/conf_files/nr-ue.nfapi.conf b/ci-scripts/conf_files/nr-ue.nfapi.conf index 6ae6e160ae..c4f30a7418 100644 --- a/ci-scripts/conf_files/nr-ue.nfapi.conf +++ b/ci-scripts/conf_files/nr-ue.nfapi.conf @@ -21,8 +21,8 @@ L1s = ( num_cc = 1; tr_n_preference = "nfapi"; local_n_if_name = "ens3"; - remote_n_address = "CI_ENB_IP_ADDR"; - local_n_address = "CI_UE_IP_ADDR"; + remote_n_address = "127.0.0.1"; + local_n_address = "127.0.0.1"; local_n_portc = 50600; remote_n_portc = 50601; local_n_portd = 50610; diff --git a/ci-scripts/conf_files/ue.nfapi.conf b/ci-scripts/conf_files/ue.nfapi.conf index 2b602cbcf2..1ea8edff2d 100644 --- a/ci-scripts/conf_files/ue.nfapi.conf +++ b/ci-scripts/conf_files/ue.nfapi.conf @@ -21,8 +21,8 @@ L1s = ( num_cc = 1; tr_n_preference = "nfapi"; local_n_if_name = "ens3"; - remote_n_address = "CI_ENB_IP_ADDR"; - local_n_address = "CI_UE_IP_ADDR"; + remote_n_address = "127.0.0.1"; + local_n_address = "127.0.0.1"; local_n_portc = 50000; remote_n_portc = 50001; local_n_portd = 50010; diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 9d41913a75..90ad27abc8 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -340,8 +340,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) else if (nr_prach == 2) { LOG_I(NR_PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id); - if (!IS_SOFTMODEM_NOS1) - nr_DRB_preconfiguration(mac->crnti); } else if(nr_prach == 3) { diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index ef8df8dfce..6729aa6eeb 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -454,22 +454,9 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, if (IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN) { LOG_D(PDCP, "IP packet received, to be sent to TUN interface"); - /* In 5G there is a new layer called SDAP which adds one byte - to the PDU data. TUN interfaces care about the actual data - we are sending. If we do not remove the instance ID from - the buffer, it will start with 00, and the write will fail - with errno = 22 (EINVAL) */ - char *data_buffer = buf; - int size_to_write = size; - if (buf[0] == 0) { - data_buffer = buf + 1; - size_to_write = size - 1; - } - - - len = write(nas_sock_fd[0], data_buffer, size_to_write); + len = write(nas_sock_fd[0], buf, size); LOG_D(PDCP, "len = %d bytes to tunnel interface %d\n", len, nas_sock_fd[0]); - if (len != size_to_write) { + if (len != size) { LOG_E(PDCP, "%s:%d:%s: fatal error %d: %s\n", __FILE__, __LINE__, __FUNCTION__, errno, strerror(errno)); } } @@ -856,7 +843,7 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id,pdusession_id,has_sdap, has_sdapULheader,has_sdapDLheader, deliver_sdu_drb, ue, deliver_pdu_drb, ue, - 12, t_reordering, discard_timer, + sn_size_dl, t_reordering, discard_timer, ciphering_algorithm, integrity_algorithm, ciphering_key, integrity_key); nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index f1c059aaae..e95cb9e952 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -107,7 +107,7 @@ nr_rrc_ue_process_ueCapabilityEnquiry( ); void -nr_sa_rrc_ue_process_radioBearerConfig( +nr_rrc_ue_process_RadioBearerConfig( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, NR_RadioBearerConfig_t *const radioBearerConfig @@ -247,15 +247,6 @@ int8_t nr_rrc_ue_decode_secondary_cellgroup_config( return 0; } -int8_t nr_rrc_ue_process_RadioBearerConfig(NR_RadioBearerConfig_t *RadioBearerConfig){ - - - xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)RadioBearerConfig); - // Configure PDCP - - return 0; -} - // from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (decoded) // RRCReconfiguration int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCReconfiguration_t *rrcReconfiguration){ @@ -266,7 +257,17 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR if(NR_UE_rrc_inst[module_id].radio_bearer_config == NULL){ NR_UE_rrc_inst[module_id].radio_bearer_config = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig; }else{ - nr_rrc_ue_process_RadioBearerConfig(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig); + protocol_ctxt_t ctxt; + NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_id, ENB_FLAG_YES, mac->crnti, 0, 0, 0); + struct NR_RadioBearerConfig *RadioBearerConfig = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig; + xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)RadioBearerConfig); + LOG_D(NR_RRC, "Calling fill_default_rbconfig_ue at %d with: e_rab_id = %ld, drbID = %ld, cipher_algo = %ld, key = %ld \n", + __LINE__, RadioBearerConfig->drb_ToAddModList->list.array[0]->cnAssociation->choice.eps_BearerIdentity, + RadioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity, + RadioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm, + *RadioBearerConfig->securityConfig->keyToUse); + nr_rrc_ue_process_RadioBearerConfig(&ctxt, 0, RadioBearerConfig); } } if(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup != NULL){ @@ -404,7 +405,17 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, SEQUENCE_free( &asn_DEF_NR_RadioBearerConfig, RadioBearerConfig, 1 ); return; } - nr_rrc_ue_process_RadioBearerConfig(RadioBearerConfig); + protocol_ctxt_t ctxt; + NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_id, ENB_FLAG_YES, mac->crnti, 0, 0, 0); + xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)RadioBearerConfig); + LOG_D(NR_RRC, "Calling fill_default_rbconfig_ue at %d with: e_rab_id = %ld, drbID = %ld, cipher_algo = %ld, key = %ld \n", + __LINE__, RadioBearerConfig->drb_ToAddModList->list.array[0]->cnAssociation->choice.eps_BearerIdentity, + RadioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity, + RadioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm, + *RadioBearerConfig->securityConfig->keyToUse); + nr_rrc_ue_process_RadioBearerConfig(&ctxt, 0, RadioBearerConfig); + } break; @@ -1466,10 +1477,9 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ctxt_pP, gNB_index, &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup); - nr_sa_rrc_ue_process_radioBearerConfig( - ctxt_pP, - gNB_index, - &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig); + nr_rrc_ue_process_RadioBearerConfig(ctxt_pP, + gNB_index, + &dl_ccch_msg->message.choice.c1->choice.rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig); nr_rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED); nr_rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED); NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].rnti = ctxt_pP->rnti; @@ -2032,7 +2042,7 @@ nr_rrc_ue_establish_srb2( //----------------------------------------------------------------------------- void - nr_sa_rrc_ue_process_radioBearerConfig( + nr_rrc_ue_process_RadioBearerConfig( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index, NR_RadioBearerConfig_t *const radioBearerConfig @@ -2221,7 +2231,7 @@ nr_rrc_ue_establish_srb2( if (ie->radioBearerConfig != NULL) { LOG_I(NR_RRC, "radio Bearer Configuration is present\n"); - nr_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig); + nr_rrc_ue_process_RadioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig); } /* Check if there is dedicated NAS information to forward to NAS */