diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index b1805aea9ce6528e79e04cc0a31ecb30ff6facc6..63d7934aab701e75dd58d4d354a223651d76a3fd 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -459,7 +459,8 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, int rb_id; int i; - if(IS_SOFTMODEM_NOS1){ + if(UE_NAS_USE_TUN){ + LOG_D(PDCP, "IP packet received, to be sent to UE TUN interface"); len = write(nas_sock_fd[0], buf, size); if (len != size) { LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 6c693e08c2b8673a43e1e1780ec3380fe450677e..bfd8d8faa41648af0b5348973d8fe309062b0e68 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1265,6 +1265,9 @@ nr_rrc_ue_process_masterCellGroup( //TODO (resume all suspended radio bearers and resume SCG transmission for all radio bearers, if suspended) // NSA procedures } + if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config == NULL){ + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = malloc(sizeof(NR_CellGroupConfig_t)); + } if( cellGroupConfig->rlc_BearerToReleaseList != NULL){ @@ -1273,10 +1276,24 @@ nr_rrc_ue_process_masterCellGroup( if( cellGroupConfig->rlc_BearerToAddModList != NULL){ //TODO (perform the RLC bearer addition/modification as specified in 5.3.5.5.4) + if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList != NULL){ + free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); + } + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList = calloc(1, sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); + memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList,cellGroupConfig->rlc_BearerToAddModList, + sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); } if( cellGroupConfig->mac_CellGroupConfig != NULL){ //TODO (configure the MAC entity of this cell group as specified in 5.3.5.5.5) + LOG_I(RRC, "Received mac_CellGroupConfig from gNB\n"); + if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig != NULL){ + LOG_E(RRC, "UE RRC instance already contains mac CellGroupConfig which will be overwritten\n"); + free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig); + } + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig = malloc(sizeof(struct NR_MAC_CellGroupConfig)); + memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig,cellGroupConfig->mac_CellGroupConfig, + sizeof(struct NR_MAC_CellGroupConfig)); } if( cellGroupConfig->sCellToReleaseList != NULL){ @@ -2132,28 +2149,28 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4)); // Refresh DRBs - // nr_rrc_pdcp_config_asn1_req(ctxt_pP, - // NULL, - // radioBearerConfig->drb_ToAddModList, - // NULL, - // NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | - // (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), - // NULL, - // NULL, - // kUPenc, - // NULL, - // NULL, - // NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB, - // NULL); + nr_rrc_pdcp_config_asn1_req(ctxt_pP, + NULL, + radioBearerConfig->drb_ToAddModList, + NULL, + NR_UE_rrc_inst[ctxt_pP->module_id].cipheringAlgorithm | + (NR_UE_rrc_inst[ctxt_pP->module_id].integrityProtAlgorithm << 4), + NULL, + NULL, + kUPenc, + NULL, + NULL, + NR_UE_rrc_inst[ctxt_pP->module_id].defaultDRB, + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); // Refresh DRBs - // nr_rrc_rlc_config_asn1_req(ctxt_pP, - // NULL, - // radioBearerConfig->drb_ToAddModList, - // NULL, - // NULL, - // NULL - // ); - } // drb_ToAddModList + nr_rrc_rlc_config_asn1_req(ctxt_pP, + NULL, + radioBearerConfig->drb_ToAddModList, + NULL, + NULL, + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList + ); + } // drb_ToAddModList // if (radioBearerConfig->drb_ToReleaseList != NULL) { for (i = 0; i < radioBearerConfig->drb_ToReleaseList->list.count; i++) { @@ -2188,9 +2205,17 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB // nr_rrc_ue_process_measConfig(ctxt_pP, gNB_index, ie->measConfig); } + if(ie->nonCriticalExtension->masterCellGroup!=NULL) { + nr_rrc_ue_process_masterCellGroup( + ctxt_pP, + gNB_index, + ie->nonCriticalExtension->masterCellGroup); + } + + 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_sa_rrc_ue_process_radioBearerConfig(ctxt_pP, gNB_index, ie->radioBearerConfig); } /* Check if there is dedicated NAS information to forward to NAS */ diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index d86209177681e60e3e49ff5cee978063b02d7b1c..dce5d45c691b69a635d0a6b59b027e940316b651 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -38,7 +38,8 @@ #include "aka_functions.h" #include "secu_defs.h" #include "PduSessionEstablishRequest.h" -# include "intertask_interface.h" +#include "intertask_interface.h" +#include "openair2/RRC/NAS/nas_config.h" /*char netName[] = "5G:mnc093.mcc208.3gppnetwork.org"; char imsi[] = "2089300007487"; @@ -57,6 +58,7 @@ const uint8_t opc[16] = {0xc4, 0x24, 0x49, 0x36, 0x3b, 0xba, 0xd0, 0x2b, 0x66, 0 uint8_t *registration_request_buf; uint32_t registration_request_len; +extern char *baseNetAddress; static int nas_protected_security_header_encode( char *buffer, @@ -816,6 +818,16 @@ void *nas_nrue_task(void *args_p) LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message(PduSessionEstablishRequest)\n"); } } + else if((pdu_buffer + 16) != NULL){ + msg_type = *(pdu_buffer + 16); + if(msg_type == FGS_PDU_SESSION_ESTABLISHMENT_ACC){ + sprintf(baseNetAddress, "%d.%d", *(pdu_buffer + 39),*(pdu_buffer + 40)); + int third_octet = *(pdu_buffer + 41); + int fourth_octet = *(pdu_buffer + 42); + LOG_I(NAS, "Received PDU Session Establishment Accept\n"); + nas_config(1,third_octet,fourth_octet,"ue"); + } + } break; } diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.h b/openair3/NAS/NR_UE/nr_nas_msg_sim.h index 2f123a6f04822605d18b5d721947c164c9c80460..f80f8df61b2d6f8b3bdc0c28365b073339c819e2 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.h +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.h @@ -59,6 +59,7 @@ // message type for 5GS session management #define FGS_PDU_SESSION_ESTABLISHMENT_REQ 0b11000001 /* 193= 0xc1 */ +#define FGS_PDU_SESSION_ESTABLISHMENT_ACC 0b11000010 /* 194= 0xc2 */ #define INITIAL_REGISTRATION 0b001 diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 2862a4d9067165f241fce4e258256b1939c2bb3c..b371c5c0d6a94c41508521bb3eba413c6f4ef6c7 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -703,7 +703,7 @@ static int Gtpv1uHandleGpdu(int h, int offset=8; if( msgHdr->E || msgHdr->S ||msgHdr->PN) - offset+=4; + offset+=8; // This context is not good for gtp // frame, ... has no meaning