From a5229a02d1a3ba0c43b4043d4a5c52c9881720cc Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 25 Mar 2021 19:26:42 +0000 Subject: [PATCH] Make sure RRC identity is set when NAS reads UE context from file. --- srsenb/src/stack/rrc/rrc_ue.cc | 1 + srsue/src/stack/rrc/rrc.cc | 2 -- srsue/src/stack/rrc/rrc_procedures.cc | 4 +++- srsue/src/stack/upper/nas.cc | 6 ++++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index 5ff2a0f79..20fd22a55 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -307,6 +307,7 @@ void rrc::ue::handle_rrc_con_req(rrc_conn_request_s* msg) parent->logger.info("RRC connection request: UE context already exists. M-TMSI=%d", m_tmsi); parent->rem_user_thread(ue_it->first); // Simply remove the old context. No need to notify the MME, it will // update the eNB/MME-UE S1AP Id pair. + break; } } } diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index a802ffd27..27dc2cf52 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -137,8 +137,6 @@ void rrc::init(phy_interface_rrc_lte* phy_, t311 = task_sched.get_unique_timer(); t304 = task_sched.get_unique_timer(); - ue_identity_configured = false; - transaction_id = 0; cell_clean_cnt = 0; diff --git a/srsue/src/stack/rrc/rrc_procedures.cc b/srsue/src/stack/rrc/rrc_procedures.cc index cf9af1557..5290256f4 100644 --- a/srsue/src/stack/rrc/rrc_procedures.cc +++ b/srsue/src/stack/rrc/rrc_procedures.cc @@ -822,7 +822,9 @@ proc_outcome_t rrc::connection_request_proc::step() if (state == state_t::cell_selection) { // NOTE: cell selection will signal back with an event trigger return proc_outcome_t::yield; - } else if (state == state_t::config_serving_cell) { + } + + if (state == state_t::config_serving_cell) { if (rrc_ptr->serv_cell_cfg.run()) { return proc_outcome_t::yield; } diff --git a/srsue/src/stack/upper/nas.cc b/srsue/src/stack/upper/nas.cc index 153aa6398..d231f7af6 100644 --- a/srsue/src/stack/upper/nas.cc +++ b/srsue/src/stack/upper/nas.cc @@ -1885,6 +1885,7 @@ void nas::send_attach_request() logger.error("Couldn't allocate PDU in %s().", __FUNCTION__); return; } + gen_attach_request(pdu); rrc->write_sdu(std::move(pdu)); } @@ -2522,6 +2523,11 @@ bool nas::read_ctxt_file(nas_sec_ctxt* ctxt_) have_ctxt = true; current_sec_hdr = LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY_AND_CIPHERED; + // Set UE identity in RRC + s_tmsi_t s_tmsi; + s_tmsi.mmec = ctxt.guti.mme_code; + s_tmsi.m_tmsi = ctxt.guti.m_tmsi; + rrc->set_ue_identity(s_tmsi); return true; } return false;