diff --git a/srsepc/hdr/mme/s1ap_common.h b/srsepc/hdr/mme/s1ap_common.h index 15f4e3c6d..4cda8376f 100644 --- a/srsepc/hdr/mme/s1ap_common.h +++ b/srsepc/hdr/mme/s1ap_common.h @@ -146,7 +146,7 @@ typedef struct{ uint32_t enb_ue_s1ap_id; uint32_t mme_ue_s1ap_id; struct sctp_sndrcvinfo enb_sri; - ecm_state_t ecm_state; + ecm_state_t state; srslte::gtpc_f_teid_ie sgw_ctrl_fteid; erab_ctx_t erabs_ctx[MAX_ERABS_PER_UE]; bool eit; diff --git a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc index dd211cb04..672332868 100644 --- a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc +++ b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc @@ -262,38 +262,34 @@ s1ap_ctx_mngmt_proc::handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECON m_s1ap_log->info("Received UE Context Release Request. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); m_s1ap_log->console("Received UE Context Release Request. MME-UE S1AP Id %d\n", mme_ue_s1ap_id); - ue_ecm_ctx_t *ue_ecm_ctx = m_s1ap->find_ue_ecm_ctx_from_mme_ue_s1ap_id(mme_ue_s1ap_id); - if(ue_ecm_ctx == NULL) + ue_ecm_ctx_t *ecm_ctx = m_s1ap->find_ue_ecm_ctx_from_mme_ue_s1ap_id(mme_ue_s1ap_id); + if(ecm_ctx == NULL) { - m_s1ap_log->info("UE not found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); + m_s1ap_log->info("No UE ECM context to release found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); + m_s1ap_log->console("No UE ECM context to release found. MME-UE S1AP Id: %d\n", mme_ue_s1ap_id); return false; } - //Delete any context at the SPGW - bool active = false; - for(int i=0;istate == ECM_STATE_CONNECTED) { - if(ue_ecm_ctx->erabs_ctx[i].state != ERAB_DEACTIVATED) //FIXME use ECM state - { - active = true; - //ue_ctx->erabs_ctx[i].state = ERAB_DEACTIVATED; - break; - } + //There are active E-RABs, send release access mearers request + m_mme_gtpc->send_release_access_bearers_request(ecm_ctx->imsi); } - if(active == true) + else { - //There are active E-RABs, send delete session request - m_mme_gtpc->send_delete_session_request(ue_ecm_ctx->imsi); + //No ECM Context to release + m_s1ap_log->info("UE is not ECM connected. No need to release S1-U. MME UE S1AP Id %d\n", mme_ue_s1ap_id); + m_s1ap_log->console("UE is not ECM connected. No need to release S1-U. MME UE S1AP Id %d\n", mme_ue_s1ap_id); } //m_s1ap->delete_ue_ctx(ue_ctx); for(int i=0;ierabs_ctx[i].state = ERAB_DEACTIVATED; + ecm_ctx->erabs_ctx[i].state = ERAB_DEACTIVATED; } //Delete UE context - m_s1ap->delete_ue_ecm_ctx(ue_ecm_ctx->mme_ue_s1ap_id); - - m_s1ap_log->info("Deleted UE Context.\n"); + m_s1ap->delete_ue_ecm_ctx(ecm_ctx->mme_ue_s1ap_id); + m_s1ap_log->info("Deleted UE ECM Context.\n"); return true; }