From 6e7d992552653b9104a0b9b71d34708ae9347f6e Mon Sep 17 00:00:00 2001 From: Francisco Date: Mon, 26 Apr 2021 16:39:48 +0100 Subject: [PATCH] remove UE on S1AP Release Request if MME S1AP UE ID hasn't been assigned yet --- srsenb/src/stack/rrc/rrc_ue.cc | 6 ++++-- srsenb/src/stack/upper/s1ap.cc | 7 ++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index 646229da2..78255d958 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -386,8 +386,10 @@ void rrc::ue::handle_rrc_con_req(rrc_conn_request_s* msg) for (auto& user : parent->users) { if (user.first != rnti && user.second->has_tmsi && user.second->mmec == mmec && user.second->m_tmsi == m_tmsi) { parent->logger.info("RRC connection request: UE context already exists. M-TMSI=%d", m_tmsi); - parent->s1ap->user_release(rnti, asn1::s1ap::cause_radio_network_opts::radio_conn_with_ue_lost); - parent->rem_user_thread(user.first); + if (parent->s1ap->user_release(rnti, asn1::s1ap::cause_radio_network_opts::radio_conn_with_ue_lost)) { + // Do not wait for MME response + parent->rem_user_thread(user.first); + } break; } } diff --git a/srsenb/src/stack/upper/s1ap.cc b/srsenb/src/stack/upper/s1ap.cc index 9bc1383d9..a9aef2116 100644 --- a/srsenb/src/stack/upper/s1ap.cc +++ b/srsenb/src/stack/upper/s1ap.cc @@ -418,7 +418,7 @@ bool s1ap::user_release(uint16_t rnti, asn1::s1ap::cause_radio_network_e cause_r return false; } - if (u->was_uectxtrelease_requested()) { + if (u->was_uectxtrelease_requested() or not u->ctxt.mme_ue_s1ap_id.has_value()) { logger.warning("UE context for RNTI:0x%x is in zombie state. Releasing...", rnti); users.erase(u); rrc->release_ue(rnti); @@ -428,10 +428,7 @@ bool s1ap::user_release(uint16_t rnti, asn1::s1ap::cause_radio_network_e cause_r cause_c cause; cause.set_radio_network().value = cause_radio.value; - if (u->ctxt.mme_ue_s1ap_id.has_value()) { - return u->send_uectxtreleaserequest(cause); - } - return true; + return u->send_uectxtreleaserequest(cause); } bool s1ap::user_exists(uint16_t rnti)