Commit 9f7e553e authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/fix-gtp-delete' into integration_2023_w34

parents 21f71282 cb5f3954
...@@ -3842,7 +3842,7 @@ void rrc_eNB_handover_ue_context_release( ...@@ -3842,7 +3842,7 @@ void rrc_eNB_handover_ue_context_release(
ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0;
} }
gtpv1u_delete_s1u_tunnel(ctxt_pP->module_id, &delete_tunnels); gtpv1u_delete_all_s1u_tunnel(ctxt_pP->module_id, delete_tunnels.rnti);
struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL;
rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, eNB_ue_s1ap_id); rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, eNB_ue_s1ap_id);
......
...@@ -432,7 +432,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { ...@@ -432,7 +432,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {
memset(&ue_context->ue_context.nsa_gtp_addrs[e_rab], 0, sizeof(ue_context->ue_context.nsa_gtp_addrs[e_rab])); memset(&ue_context->ue_context.nsa_gtp_addrs[e_rab], 0, sizeof(ue_context->ue_context.nsa_gtp_addrs[e_rab]));
ue_context->ue_context.nsa_gtp_ebi[e_rab] = 0; ue_context->ue_context.nsa_gtp_ebi[e_rab] = 0;
} }
gtpv1u_delete_s1u_tunnel(rrc->module_id, &tmp); gtpv1u_delete_all_s1u_tunnel(rrc->module_id, rnti);
/* remove context */ /* remove context */
rrc_gNB_remove_ue_context(rrc, ue_context); rrc_gNB_remove_ue_context(rrc, ue_context);
} }
...@@ -825,11 +825,47 @@ int newGtpuDeleteAllTunnels(instance_t instance, ue_id_t ue_id) { ...@@ -825,11 +825,47 @@ int newGtpuDeleteAllTunnels(instance_t instance, ue_id_t ue_id) {
return !GTPNOK; return !GTPNOK;
} }
// Legacy delete tunnel finish by deleting all the ue id
// so the list of bearer provided is only a design bug
int gtpv1u_delete_s1u_tunnel( const instance_t instance, int gtpv1u_delete_s1u_tunnel( const instance_t instance,
const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { const gtpv1u_enb_delete_tunnel_req_t *const req_pP) {
return newGtpuDeleteAllTunnels(instance, req_pP->rnti); LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", instance, req_pP->rnti);
pthread_mutex_lock(&globGtp.gtp_lock);
auto inst = &globGtp.instances[compatInst(instance)];
auto ptrRNTI = inst->ue2te_mapping.find(req_pP->rnti);
if (ptrRNTI == inst->ue2te_mapping.end()) {
LOG_W(GTPU, "[%ld] Delete Released GTP tunnels for rnti: %x, but no tunnel exits\n", instance, req_pP->rnti);
pthread_mutex_unlock(&globGtp.gtp_lock);
return -1;
}
int nb = 0;
for (int i = 0; i < req_pP->num_erab; i++) {
auto ptr2 = ptrRNTI->second.bearers.find(req_pP->eps_bearer_id[i]);
if (ptr2 == ptrRNTI->second.bearers.end()) {
LOG_E(GTPU,
"[%ld] GTP-U instance: delete of not existing tunnel RNTI:RAB: %x/%x\n",
instance,
req_pP->rnti,
req_pP->eps_bearer_id[i]);
} else {
globGtp.te2ue_mapping.erase(ptr2->second.teid_incoming);
nb++;
}
}
if (ptrRNTI->second.bearers.size() == 0)
// no tunnels on this rnti, erase the ue entry
inst->ue2te_mapping.erase(ptrRNTI);
pthread_mutex_unlock(&globGtp.gtp_lock);
LOG_I(GTPU, "[%ld] Deleted released tunnels for RNTI %x (%d tunnels deleted)\n", instance, req_pP->rnti, nb);
return !GTPNOK;
}
// Legacy delete tunnel finish by deleting all the ue id
int gtpv1u_delete_all_s1u_tunnel(const instance_t instance, const rnti_t rnti)
{
return newGtpuDeleteAllTunnels(instance, rnti);
} }
int newGtpuDeleteTunnels(instance_t instance, ue_id_t ue_id, int nbTunnels, pdusessionid_t *pdusession_id) { int newGtpuDeleteTunnels(instance_t instance, ue_id_t ue_id, int nbTunnels, pdusessionid_t *pdusession_id) {
......
...@@ -61,6 +61,7 @@ extern "C" { ...@@ -61,6 +61,7 @@ extern "C" {
); );
int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP);
int gtpv1u_delete_all_s1u_tunnel(const instance_t instance, const rnti_t rnti);
int gtpv1u_create_x2u_tunnel(const instance_t instanceP, int gtpv1u_create_x2u_tunnel(const instance_t instanceP,
const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP,
......
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