Starting to add GUTI attach support.

master
Pedro Alvarez 7 years ago
parent 80cd15e38f
commit 45effcca08

@ -48,21 +48,21 @@ sgi_if_addr=172.16.0.1
# #
# Log levels can be set for individual layers. "all_level" sets log # Log levels can be set for individual layers. "all_level" sets log
# level for all layers unless otherwise configured. # 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. # 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 # "all_hex_limit" sets the hex limit for all layers unless otherwise
# configured. # 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 # Logging levels: debug, info, warning, error, none
# #
# filename: File path to use for log output. Can be set to stdout # filename: File path to use for log output. Can be set to stdout
# to print logs to standard output # to print logs to standard output
##################################################################### #####################################################################
[log] [log]
all_level = info all_level = debug
all_hex_limit = 32 all_hex_limit = 32
filename = /tmp/epc.log filename = /tmp/epc.log

@ -83,7 +83,7 @@ public:
void add_new_ue_ctx(const ue_ctx_t &ue_ctx); void add_new_ue_ctx(const ue_ctx_t &ue_ctx);
bool delete_ue_ctx(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; s1ap_args_t m_s1ap_args;
srslte::log_filter *m_s1ap_log; srslte::log_filter *m_s1ap_log;

@ -433,9 +433,11 @@ s1ap::activate_eps_bearer(uint32_t mme_s1ap_id, uint8_t ebi)
} }
uint32_t 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<uint32_t,uint32_t>(m_tmsi,mme_ue_s1ap_id));
return m_tmsi;
} }
void void

@ -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) if(ue_ctx->erabs_ctx[i].state != ERAB_DEACTIVATED)
{ {
active = true; active = true;
break; ue_ctx->erabs_ctx[i].state = ERAB_DEACTIVATED;
} }
} }
if(active == true) 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 //There are active E-RABs, send delete session request
m_mme_gtpc->send_delete_session_request(ue_ctx); 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 //Delete UE context
m_s1ap_log->info("Deleted UE Context.\n"); m_s1ap_log->info("Deleted UE S1-U Context.\n");
return true; return true;
} }

@ -106,7 +106,7 @@ s1ap_nas_transport::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSA
return false; return false;
} }
//Get Mobile ID
if(attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_IMSI) if(attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_IMSI)
{ {
//IMSI style attach //IMSI style attach
@ -114,21 +114,28 @@ s1ap_nas_transport::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSA
for(int i=0;i<=14;i++){ for(int i=0;i<=14;i++){
imsi += attach_req.eps_mobile_id.imsi[i]*std::pow(10,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) else if(attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_GUTI)
{ {
//GUTI style attach //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; uint32_t m_tmsi = attach_req.eps_mobile_id.guti.m_tmsi;
std::map<uint32_t,uint32_t>::iterator it = m_s1ap->m_tmsi_to_s1ap_id.find(m_tmsi); std::map<uint32_t,uint32_t>::iterator it = m_s1ap->m_tmsi_to_s1ap_id.find(m_tmsi);
if(it == m_s1ap->m_tmsi_to_s1ap_id.end()) if(it == m_s1ap->m_tmsi_to_s1ap_id.end())
{ {
//FIXME Send Id request //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; return false;
} }
m_s1ap_log->console("Found M-TMSI: %d\n",m_tmsi);
ue_ctx_t *tmp = m_s1ap->find_ue_ctx(it->second); ue_ctx_t *tmp = m_s1ap->find_ue_ctx(it->second);
if(tmp!=NULL)
{
m_s1ap_log->console("Found UE context. IMSI: %015lu\n",tmp->imsi);
imsi = tmp->imsi; imsi = tmp->imsi;
} }
}
m_s1ap_log->console("Attach request from IMSI: %015lu\n", imsi); m_s1ap_log->console("Attach request from IMSI: %015lu\n", imsi);
m_s1ap_log->info("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.mnc = m_s1ap->m_s1ap_args.mnc;
attach_accept.guti.guti.mme_group_id = 0x0001; attach_accept.guti.guti.mme_group_id = 0x0001;
attach_accept.guti.guti.mme_code = 0x1a; 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{ typedef struct{
uint32 m_tmsi; uint32 m_tmsi;

Loading…
Cancel
Save