adding tmp emm storage for when the UE uses an unknown guti and id request has to be sent.

This commit is contained in:
Pedro Alvarez 2018-02-07 14:11:42 +00:00
parent 22e0313c53
commit 95bc4f8b08
3 changed files with 39 additions and 17 deletions

View File

@ -91,6 +91,9 @@ public:
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(uint32_t mme_ue_s1ap_id);
s1ap_args_t m_s1ap_args;
@ -119,6 +122,7 @@ private:
std::map<uint64_t, ue_emm_ctx_t*> m_imsi_to_ue_emm_ctx;
std::map<uint32_t, ue_ecm_ctx_t*> m_mme_ue_s1ap_id_to_ue_ecm_ctx;
std::map<int32_t,ue_emm_ctx_t*> m_mme_ue_s1ap_id_to_tmp_ue_emm_ctx;
uint32_t m_next_mme_ue_s1ap_id;
uint32_t m_next_m_tmsi;

View File

@ -346,6 +346,31 @@ s1ap::add_new_ue_emm_ctx(const ue_emm_ctx_t &ue_emm_ctx)
m_imsi_to_ue_emm_ctx.insert(std::pair<uint64_t,ue_emm_ctx_t*>(ue_ptr->imsi,ue_ptr));
}
void
s1ap::store_tmp_ue_emm_ctx(const ue_emm_ctx_t &tmp_ue_emm_ctx)
{
ue_emm_ctx_t *ue_ptr = new ue_emm_ctx_t;
memcpy(ue_ptr,&tmp_ue_emm_ctx,sizeof(tmp_ue_emm_ctx));
//This map will store UE's ECM context.
m_mme_ue_s1ap_id_to_tmp_ue_emm_ctx.insert(std::pair<uint32_t,ue_emm_ctx_t*>(ue_ptr->mme_ue_s1ap_id,ue_ptr));
}
bool
s1ap::get_tmp_ue_emm_ctx(uint32_t mme_ue_s1ap_id, ue_emm_ctx_t* ue_emm_ptr)
{
std::map<int32_t,ue_emm_ctx_t*>::iterator it = m_mme_ue_s1ap_id_to_tmp_ue_emm_ctx.find(mme_ue_s1ap_id);
if(it == m_mme_ue_s1ap_id_to_tmp_ue_emm_ctx.end() )
{
return false;
}
memcpy(ue_emm_ptr, it->second,sizeof(ue_emm_ctx_t));
delete it->second;
m_mme_ue_s1ap_id_to_tmp_ue_emm_ctx.erase(it);
return true;
}
void
s1ap::add_new_ue_ecm_ctx(const ue_ecm_ctx_t &ue_ecm_ctx)
{

View File

@ -385,31 +385,24 @@ s1ap_nas_transport::handle_nas_guti_attach_request(uint32_t enb_ue_s1ap_id,
m_s1ap_log->info("Attach request -- IMSI: %015lu\n", ue_ecm_ctx.imsi);
m_s1ap_log->console("Attach request -- eNB-UE S1AP Id: %d, MME-UE S1AP Id: %d\n", ue_ecm_ctx.enb_ue_s1ap_id, ue_ecm_ctx.mme_ue_s1ap_id);
m_s1ap_log->console("Attach Request -- UE Network Capabilities EEA: %d%d%d%d%d%d%d%d\n",
attach_req.ue_network_cap.eea[0],
attach_req.ue_network_cap.eea[1],
attach_req.ue_network_cap.eea[2],
attach_req.ue_network_cap.eea[3],
attach_req.ue_network_cap.eea[4],
attach_req.ue_network_cap.eea[5],
attach_req.ue_network_cap.eea[6],
attach_req.ue_network_cap.eea[7]);
attach_req.ue_network_cap.eea[0], attach_req.ue_network_cap.eea[1], attach_req.ue_network_cap.eea[2], attach_req.ue_network_cap.eea[3],
attach_req.ue_network_cap.eea[4], attach_req.ue_network_cap.eea[5], attach_req.ue_network_cap.eea[6], attach_req.ue_network_cap.eea[7]);
m_s1ap_log->console("Attach Request -- UE Network Capabilities EIA: %d%d%d%d%d%d%d%d\n",
attach_req.ue_network_cap.eia[0],
attach_req.ue_network_cap.eia[1],
attach_req.ue_network_cap.eia[2],
attach_req.ue_network_cap.eia[3],
attach_req.ue_network_cap.eia[4],
attach_req.ue_network_cap.eia[5],
attach_req.ue_network_cap.eia[6],
attach_req.ue_network_cap.eia[7]);
attach_req.ue_network_cap.eia[0], attach_req.ue_network_cap.eia[1], attach_req.ue_network_cap.eia[2], attach_req.ue_network_cap.eia[3],
attach_req.ue_network_cap.eia[4], attach_req.ue_network_cap.eia[5], attach_req.ue_network_cap.eia[6], attach_req.ue_network_cap.eia[7]);
m_s1ap_log->console("Attach Request -- MS Network Capabilities Present: %s\n", attach_req.ms_network_cap_present ? "true" : "false");
m_s1ap_log->console("PDN Connectivity Request -- EPS Bearer Identity requested: %d\n", pdn_con_req.eps_bearer_id);
m_s1ap_log->console("PDN Connectivity Request -- Procedure Transaction Id: %d\n", pdn_con_req.proc_transaction_id);
m_s1ap_log->console("PDN Connectivity Request -- ESM Information Transfer requested: %s\n", pdn_con_req.esm_info_transfer_flag_present ? "true" : "false");
m_s1ap_log->console("Could not find M-TMSI=0x%x. Sending ID request\n",m_tmsi);
m_s1ap_log->info("Could not find M-TMSI=0x%d. Sending Id Request\n", m_tmsi);
m_s1ap_log->info("Could not find M-TMSI=0x%x. Sending Id Request\n", m_tmsi);
m_s1ap->add_new_ue_ecm_ctx(ue_ecm_ctx);
//We do not know the IMSI of the UE yet
//This will be removed when the Identity request is received
m_s1ap->store_tmp_ue_emm_ctx(tmp_ue_emm_ctx);
pack_identity_request(reply_buffer, ue_ecm_ctx.enb_ue_s1ap_id, ue_ecm_ctx.mme_ue_s1ap_id);
*reply_flag = true;
return true;