From 7a2f88040fecccfb455445e9f0ebff285d445315 Mon Sep 17 00:00:00 2001 From: matzakos Date: Tue, 31 Aug 2021 15:39:51 +0200 Subject: [PATCH 1/2] Correction to parse the IP address for F1-U tunnels creation however the address in the NGAP message is still wrong --- openair2/RRC/NR/rrc_gNB.c | 11 +++++------ openair3/ocp-gtpu/gtp_itf.cpp | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index f9613f1573..a3707aa352 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1350,7 +1350,6 @@ rrc_gNB_process_RRCReconfigurationComplete( if(DRB_configList!=NULL){ gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; - teid_t incoming_teid; MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); @@ -1362,15 +1361,15 @@ rrc_gNB_process_RRCReconfigurationComplete( //create_tunnel_req.outgoing_teid[i] = 0xFFFF; create_tunnel_req.outgoing_teid[i] = 0xFFFF; create_tunnel_req.rnti = ue_context_pP->ue_context.rnti; - memcpy(create_tunnel_req.dst_addr[i].buffer,rrc->eth_params_s.remote_addr,4); + LOG_I(NR_RRC,"The DU remote IP address is: %s \n", rrc->eth_params_s.remote_addr); + create_tunnel_req.dst_addr[i].buffer[0] = inet_addr(rrc->eth_params_s.remote_addr); //create_tunnel_req.dst_addr[i].length = 32; create_tunnel_req.dst_addr[i].length = 32; create_tunnel_req.incoming_rb_id[i] = DRB_configList->list.array[i]->drb_Identity; - //create_tunnel_req.outgoing_rb_id[i] = DRB_configList->list.array[i]->drb_Identity; /* Here the callback function used as input is not the right one. Need to create a new one probably for F1-U, not sure * if the kind of input parameters to the callback function are convenient though for gtp-u over F1-U.*/ - incoming_teid=newGtpuCreateTunnel(0, create_tunnel_req.rnti, + ue_context_pP->ue_context.incoming_teid[i] = newGtpuCreateTunnel(0, create_tunnel_req.rnti, create_tunnel_req.incoming_rb_id[i], create_tunnel_req.incoming_rb_id[i], create_tunnel_req.outgoing_teid[i], @@ -1379,8 +1378,8 @@ rrc_gNB_process_RRCReconfigurationComplete( F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity; F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].gtp_teid = incoming_teid; - memcpy(&F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].tl_address,rrc->eth_params_s.my_addr,4); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].gtp_teid = ue_context_pP->ue_context.incoming_teid[i]; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl_length = 1; } F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 7d039e15a9..e3dbfe0f25 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -404,7 +404,6 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer LOG_W(GTPU, "generated a random Teid that exists, re-generating (%x)\n",incoming_teid); incoming_teid=gtpv1uNewTeid(); }; - LOG_I (GTPU, "Allocated incoming teid: %d \n", incoming_teid); inst->te2ue_mapping[incoming_teid].rnti=rnti; @@ -443,7 +442,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; - LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %d, teid for UL %d to remote IPv4: %s, IPv6 %s\n", + LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %u, teid for UL %u to remote IPv4: %s, IPv6 %s\n", rnti, tmp->teid_incoming, tmp->teid_outgoing, From 2616ef6bdf9df565ce752916ece9f203d789ecb7 Mon Sep 17 00:00:00 2001 From: matzakos Date: Tue, 31 Aug 2021 17:04:48 +0200 Subject: [PATCH 2/2] Correct the placement of memory initialization for F1-U create_tunnel_req --- openair2/RRC/NR/rrc_gNB.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a3707aa352..957c3b7a66 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1343,20 +1343,15 @@ rrc_gNB_process_RRCReconfigurationComplete( get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL); } else { - /*gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; - gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp; - memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); - create_tunnel_req.outgoing_teid[0] = 1;*/ if(DRB_configList!=NULL){ - gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; + memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length = DRB_configList->list.count; LOG_I(RRC, "Length of DRB list:%d, %d \n", DRB_configList->list.count, F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length); for (int i = 0; i < DRB_configList->list.count; i++){ - memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); //Use a dummy teid for the outgoing GTP-U tunnel (DU) which will be updated once we get the UE context setup response from the DU //create_tunnel_req.outgoing_teid[i] = 0xFFFF; create_tunnel_req.outgoing_teid[i] = 0xFFFF;