From 300b9e7757c360f4ec39a9191dd009debfc0da9c Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 16 Apr 2018 14:54:55 +0100 Subject: [PATCH] Starting to add UEs to the eNB context again. --- srsepc/hdr/mme/s1ap.h | 20 +------------------- srsepc/src/mme/s1ap_nas_transport.cc | 5 ++++- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/srsepc/hdr/mme/s1ap.h b/srsepc/hdr/mme/s1ap.h index 39d3bb9ce..7b05a7a1e 100644 --- a/srsepc/hdr/mme/s1ap.h +++ b/srsepc/hdr/mme/s1ap.h @@ -78,6 +78,7 @@ public: uint32_t get_next_mme_ue_s1ap_id(); enb_ctx_t* find_enb_ctx(uint16_t enb_id); void add_new_enb_ctx(const enb_ctx_t &enb_ctx, const struct sctp_sndrcvinfo* enb_sri); + void get_enb_ctx(uint16_t sctp_stream); bool add_ue_ctx_to_imsi_map(ue_ctx_t *ue_ctx); bool add_ue_ctx_to_mme_ue_s1ap_id_map(ue_ctx_t *ue_ctx); @@ -90,20 +91,6 @@ public: void release_ues_ecm_ctx_in_enb(uint16_t enb_id); bool delete_ue_ctx(uint64_t imsi); - //ue_ctx_t* find_ue_ctx(uint32_t mme_ue_s1ap_id); - //void add_new_ue_ctx(const ue_ctx_t &ue_ctx); - - //void add_new_ue_emm_ctx(const ue_emm_ctx_t &ue_emm_ctx); - //void add_new_ue_ecm_ctx(const ue_ecm_ctx_t &ue_ecm_ctx); - //ue_emm_ctx_t* find_ue_emm_ctx_from_imsi(uint64_t imsi); - //ue_ecm_ctx_t* find_ue_ecm_ctx_from_mme_ue_s1ap_id(uint32_t mme_ue_s1ap_id); - //bool delete_ue_emm_ctx(uint64_t imsi); - //bool delete_ue_ecm_ctx(uint32_t mme_ue_s1ap_id); - //void delete_ues_ecm_ctx_in_enb(uint16_t enb_id); - - //void store_tmp_ue_emm_ctx(const ue_emm_ctx_t &ue_ecm_ctx); - //bool get_tmp_ue_emm_ctx(uint32_t mme_ue_s1ap_id, ue_emm_ctx_t* ue_emm_ptr); - uint32_t allocate_m_tmsi(uint64_t imsi); s1ap_args_t m_s1ap_args; @@ -130,14 +117,9 @@ private: std::map m_sctp_to_enb_id; std::map > m_enb_id_to_ue_ids; - std::map m_imsi_to_ue_ctx; std::map m_mme_ue_s1ap_id_to_ue_ctx; - //std::map m_imsi_to_ue_emm_ctx; - //std::map m_mme_ue_s1ap_id_to_ue_ecm_ctx; - //std::map m_mme_ue_s1ap_id_to_tmp_ue_emm_ctx; - uint32_t m_next_mme_ue_s1ap_id; uint32_t m_next_m_tmsi; diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index 687ced63b..85c833a8b 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -498,6 +498,7 @@ s1ap_nas_transport::handle_nas_imsi_attach_request(uint32_t enb_ue_s1ap_id, memcpy(new_ctx,&ue_ctx,sizeof(ue_ctx_t)); m_s1ap->add_ue_ctx_to_imsi_map(new_ctx); m_s1ap->add_ue_ctx_to_mme_ue_s1ap_id_map(new_ctx); + m_s1ap->add_ue_to_enb_set(enb_id,mme_ue_s1ap_id); //Pack NAS Authentication Request in Downlink NAS Transport msg pack_authentication_request(reply_buffer, ecm_ctx->enb_ue_s1ap_id, ecm_ctx->mme_ue_s1ap_id, autn, rand); @@ -611,6 +612,7 @@ s1ap_nas_transport::handle_nas_guti_attach_request( uint32_t enb_ue_s1ap_id, ue_ctx_t *new_ctx = new ue_ctx_t; memcpy(new_ctx,&ue_ctx,sizeof(ue_ctx_t)); m_s1ap->add_ue_ctx_to_mme_ue_s1ap_id_map(new_ctx); + m_s1ap->add_ue_to_enb_set(enb_id,mme_ue_s1ap_id); pack_identity_request(reply_buffer, ecm_ctx->enb_ue_s1ap_id, ecm_ctx->mme_ue_s1ap_id); *reply_flag = true; @@ -660,7 +662,8 @@ s1ap_nas_transport::handle_nas_guti_attach_request( uint32_t enb_ue_s1ap_id, //Store context based on MME UE S1AP id m_s1ap->add_ue_ctx_to_mme_ue_s1ap_id_map(ue_ctx); - + m_s1ap->add_ue_to_enb_set(enb_id,mme_ue_s1ap_id); + //Re-generate K_eNB liblte_security_generate_k_enb(emm_ctx->security_ctxt.k_asme, emm_ctx->security_ctxt.ul_nas_count, emm_ctx->security_ctxt.k_enb); m_s1ap_log->info("Generating KeNB with UL NAS COUNT: %d\n",emm_ctx->security_ctxt.ul_nas_count);