From 18f864d21d5dcc67d9e9e3fadff660e12c4c6c45 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 20 Dec 2017 11:58:54 +0000 Subject: [PATCH] Fixed small bug --- srsepc/src/mme/s1ap.cc | 7 +++++++ srsepc/src/mme/s1ap_mngmt_proc.cc | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index a75c8ebd5..ac65e1ede 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -261,6 +261,7 @@ s1ap::handle_initiating_message(LIBLTE_S1AP_INITIATINGMESSAGE_STRUCT *msg, stru case LIBLTE_S1AP_INITIATINGMESSAGE_CHOICE_S1SETUPREQUEST: m_s1ap_log->info("Received S1 Setup Request.\n"); m_s1ap_mngmt_proc->handle_s1_setup_request(&msg->choice.S1SetupRequest, enb_sri, reply_buffer, &reply_flag); + break; case LIBLTE_S1AP_INITIATINGMESSAGE_CHOICE_INITIALUEMESSAGE: m_s1ap_log->info("Received Initial UE Message.\n"); return handle_initial_ue_message(&msg->choice.InitialUEMessage, enb_sri); @@ -446,6 +447,11 @@ s1ap::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *ini std::map::iterator it_enb = m_sctp_to_enb_id.find(enb_sri->sinfo_assoc_id); uint16_t enb_id = it_enb->second; std::map >::iterator it_ue_id = m_enb_id_to_ue_ids.find(enb_id); + if(it_ue_id==m_enb_id_to_ue_ids.end()) + { + m_s1ap_log->error("Could not find eNB's UEs\n"); + return false; + } it_ue_id->second.insert(ue_ptr->mme_ue_s1ap_id); //Pack NAS Authentication Request in Downlink NAS Transport msg @@ -1038,6 +1044,7 @@ s1ap::find_enb_ctx(uint16_t enb_id) void s1ap::add_enb_ctx(const enb_ctx_t &enb_ctx, const struct sctp_sndrcvinfo *enb_sri) { + m_s1ap_log->info("Adding new eNB context. eNB ID %d\n", enb_ctx.enb_id); std::set ue_set; enb_ctx_t *enb_ptr = new enb_ctx_t; memcpy(enb_ptr,&enb_ctx,sizeof(enb_ctx_t)); diff --git a/srsepc/src/mme/s1ap_mngmt_proc.cc b/srsepc/src/mme/s1ap_mngmt_proc.cc index 296952d7b..2b55f1f52 100644 --- a/srsepc/src/mme/s1ap_mngmt_proc.cc +++ b/srsepc/src/mme/s1ap_mngmt_proc.cc @@ -98,7 +98,7 @@ s1ap_mngmt_proc::handle_s1_setup_request(LIBLTE_S1AP_MESSAGE_S1SETUPREQUEST_STRU } else{ enb_ctx_t *enb_ptr = m_s1ap->find_enb_ctx(enb_ctx.enb_id); - if(enb_ptr == NULL) + if(enb_ptr != NULL) { //eNB already registered //TODO replace enb_ctx