diff --git a/srsepc/epc.conf.example b/srsepc/epc.conf.example index 65f51981a..bce4085ac 100644 --- a/srsepc/epc.conf.example +++ b/srsepc/epc.conf.example @@ -48,21 +48,21 @@ sgi_if_addr=172.16.0.1 # # Log levels can be set for individual layers. "all_level" sets log # level for all layers unless otherwise configured. -# Format: e.g. phy_level = info +# Format: e.g. s1ap_level = info # # In the same way, packet hex dumps can be limited for each level. # "all_hex_limit" sets the hex limit for all layers unless otherwise # configured. -# Format: e.g. phy_hex_limit = 32 +# Format: e.g. s1ap_hex_limit = 32 # -# Logging layers: phy, mac, rlc, pdcp, rrc, nas, gtpu, usim, all +# Logging layers: s1ap, gtpc, spgw, hss, all # Logging levels: debug, info, warning, error, none # # filename: File path to use for log output. Can be set to stdout # to print logs to standard output ##################################################################### [log] -all_level = info +all_level = debug all_hex_limit = 32 filename = /tmp/epc.log diff --git a/srsepc/hdr/mme/s1ap.h b/srsepc/hdr/mme/s1ap.h index 509a887ee..fc4dd3d49 100644 --- a/srsepc/hdr/mme/s1ap.h +++ b/srsepc/hdr/mme/s1ap.h @@ -83,7 +83,7 @@ public: void add_new_ue_ctx(const ue_ctx_t &ue_ctx); bool delete_ue_ctx(ue_ctx_t *ue_ctx); - uint32_t allocate_m_tmsi(); + uint32_t allocate_m_tmsi(uint32_t mme_ue_s1ap_id); s1ap_args_t m_s1ap_args; srslte::log_filter *m_s1ap_log; diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index 03eaadd35..b9e303674 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -433,9 +433,11 @@ s1ap::activate_eps_bearer(uint32_t mme_s1ap_id, uint8_t ebi) } uint32_t -s1ap::allocate_m_tmsi() +s1ap::allocate_m_tmsi(uint32_t mme_ue_s1ap_id) { - return m_next_m_tmsi++; + uint32_t m_tmsi = m_next_m_tmsi++; + m_tmsi_to_s1ap_id.insert(std::pair(m_tmsi,mme_ue_s1ap_id)); + return m_tmsi; } void diff --git a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc index 48efaee9f..70d3e7380 100644 --- a/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc +++ b/srsepc/src/mme/s1ap_ctx_mngmt_proc.cc @@ -280,7 +280,7 @@ s1ap_ctx_mngmt_proc::handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECON if(ue_ctx->erabs_ctx[i].state != ERAB_DEACTIVATED) { active = true; - break; + ue_ctx->erabs_ctx[i].state = ERAB_DEACTIVATED; } } if(active == true) @@ -288,10 +288,10 @@ s1ap_ctx_mngmt_proc::handle_ue_context_release_request(LIBLTE_S1AP_MESSAGE_UECON //There are active E-RABs, send delete session request m_mme_gtpc->send_delete_session_request(ue_ctx); } - m_s1ap->delete_ue_ctx(ue_ctx); + //m_s1ap->delete_ue_ctx(ue_ctx); //Delete UE context - m_s1ap_log->info("Deleted UE Context.\n"); + m_s1ap_log->info("Deleted UE S1-U Context.\n"); return true; } diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index 6746b7e00..990ee83d0 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -106,7 +106,7 @@ s1ap_nas_transport::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSA return false; } - //Get Mobile ID + if(attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_IMSI) { //IMSI style attach @@ -114,20 +114,27 @@ s1ap_nas_transport::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSA for(int i=0;i<=14;i++){ imsi += attach_req.eps_mobile_id.imsi[i]*std::pow(10,14-i); } + } else if(attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_GUTI) { //GUTI style attach + m_s1ap_log->console("Received GUTI-style attach request\n"); uint32_t m_tmsi = attach_req.eps_mobile_id.guti.m_tmsi; std::map::iterator it = m_s1ap->m_tmsi_to_s1ap_id.find(m_tmsi); if(it == m_s1ap->m_tmsi_to_s1ap_id.end()) { //FIXME Send Id request - m_s1ap_log->info("Could not find M-TMSI in attach request\n"); + m_s1ap_log->console("Could not find M-TMSI in attach request\n"); return false; } + m_s1ap_log->console("Found M-TMSI: %d\n",m_tmsi); ue_ctx_t *tmp = m_s1ap->find_ue_ctx(it->second); - imsi = tmp->imsi; + if(tmp!=NULL) + { + m_s1ap_log->console("Found UE context. IMSI: %015lu\n",tmp->imsi); + imsi = tmp->imsi; + } } m_s1ap_log->console("Attach request from IMSI: %015lu\n", imsi); m_s1ap_log->info("Attach request from IMSI: %015lu\n", imsi); @@ -774,7 +781,8 @@ s1ap_nas_transport::pack_attach_accept(ue_ctx_t *ue_ctx, LIBLTE_S1AP_E_RABTOBESE attach_accept.guti.guti.mnc = m_s1ap->m_s1ap_args.mnc; attach_accept.guti.guti.mme_group_id = 0x0001; attach_accept.guti.guti.mme_code = 0x1a; - attach_accept.guti.guti.m_tmsi = m_s1ap->allocate_m_tmsi(); + attach_accept.guti.guti.m_tmsi = m_s1ap->allocate_m_tmsi(ue_ctx->mme_ue_s1ap_id); + /* typedef struct{ uint32 m_tmsi;