Making sure M-TMSI is in host order in other small bug fixes.

This commit is contained in:
Pedro Alvarez 2018-08-28 17:28:31 +01:00
parent 3337f21ffa
commit 4313fb1e72
5 changed files with 15 additions and 17 deletions

View File

@ -614,7 +614,7 @@ hss::increment_ue_sqn(uint64_t imsi)
}
increment_sqn(ue_ctx->sqn,ue_ctx->sqn);
m_hss_log->debug("Incremented SQN (IMSI: %" PRIu64 ")" PRIu64 "\n", imsi);
m_hss_log->debug("Incremented SQN -- IMSI: %" PRIu64 "\n", imsi);
m_hss_log->debug_hex(ue_ctx->sqn, 6, "SQN: ");
}

View File

@ -257,6 +257,9 @@ parse_args(all_args_t *args, int argc, char* argv[]) {
if(!vm.count("log.hss_hex_limit")) {
args->log_args.hss_hex_limit = args->log_args.all_hex_limit;
}
if(!vm.count("log.nas_hex_limit")) {
args->log_args.nas_hex_limit = args->log_args.all_hex_limit;
}
}
// Check user database

View File

@ -145,30 +145,20 @@ nas::handle_attach_request( uint32_t enb_ue_s1ap_id,
{
//Get attach type from attach request
if (attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_IMSI) {
nas_log->console("Attach Request -- IMSI-style attach request\n");
nas_log->info("Attach Request -- IMSI-style attach request\n");
nas::handle_imsi_attach_request_unknown_ue(enb_ue_s1ap_id, enb_sri, attach_req, pdn_con_req, args, s1ap, gtpc, hss, nas_log);
} else if (attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_GUTI) {
nas_log->console("Attach Request -- GUTI-style attach request\n");
nas_log->info("Attach Request -- GUTI-style attach request\n");
nas::handle_guti_attach_request_unknown_ue(enb_ue_s1ap_id, enb_sri, attach_req, pdn_con_req, args, s1ap, gtpc, hss, nas_log);
} else {
nas_log->error("Unhandled Mobile Id type in attach request\n");
return false;
}
} else {
nas_log->info("Attach Request -- Found previously attached UE.\n");
nas_log->console("Attach Request -- Found previously attach UE.\n");
if (attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_IMSI) {
nas_log->console("Attach Request -- IMSI-style attach request\n");
nas_log->info("Attach Request -- IMSI-style attach request\n");
nas::handle_imsi_attach_request_known_ue(nas_ctx, enb_ue_s1ap_id, enb_sri, attach_req, pdn_con_req, nas_rx, args, s1ap, gtpc, hss, nas_log);
} else if (attach_req.eps_mobile_id.type_of_id == LIBLTE_MME_EPS_MOBILE_ID_TYPE_GUTI) {
nas_log->console("Attach Request -- GUTI-style attach request\n");
nas_log->info("Attach Request -- GUTI-style attach request\n");
nas::handle_guti_attach_request_known_ue(nas_ctx, enb_ue_s1ap_id, enb_sri, attach_req, pdn_con_req, nas_rx, args, s1ap, gtpc, hss, nas_log);
} else {
nas_log->error("Unhandled Mobile Id type in attach request\n");
return false;
}
}
@ -201,9 +191,10 @@ nas::handle_imsi_attach_request_unknown_ue( uint32_t enb_ue_s1ap_id,
nas_ctx = new nas;
nas_ctx->init(args,s1ap,gtpc,hss,nas_log);
//Save IMSI, MME UE S1AP Id and make sure UE is EMM_DEREGISTERED
//Save IMSI, eNB UE S1AP Id, MME UE S1AP Id and make sure UE is EMM_DEREGISTERED
nas_ctx->m_emm_ctx.imsi = imsi;
nas_ctx->m_emm_ctx.state = EMM_STATE_DEREGISTERED;
nas_ctx->m_ecm_ctx.enb_ue_s1ap_id = enb_ue_s1ap_id;
nas_ctx->m_ecm_ctx.mme_ue_s1ap_id = s1ap->get_next_mme_ue_s1ap_id();
//Save UE network capabilities
@ -221,7 +212,6 @@ nas::handle_imsi_attach_request_unknown_ue( uint32_t enb_ue_s1ap_id,
nas_ctx->m_sec_ctx.dl_nas_count = 0;
//Set eNB information
nas_ctx->m_ecm_ctx.enb_ue_s1ap_id = enb_ue_s1ap_id;
memcpy(&nas_ctx->m_ecm_ctx.enb_sri, enb_sri, sizeof(struct sctp_sndrcvinfo));
//Save whether secure ESM information transfer is necessary
@ -654,7 +644,7 @@ nas::handle_attach_complete(srslte::byte_buffer_t *nas_rx)
m_s1ap->send_downlink_nas_transport(m_ecm_ctx.enb_ue_s1ap_id, m_ecm_ctx.mme_ue_s1ap_id, nas_tx, m_ecm_ctx.enb_sri);
m_pool->deallocate(nas_tx);
m_nas_log->console("Sending EMM Information");
m_nas_log->console("Sending EMM Information\n");
m_nas_log->info("Sending EMM Information\n");
}
m_emm_ctx.state = EMM_STATE_REGISTERED;
@ -1100,8 +1090,9 @@ nas::pack_attach_accept(srslte::byte_buffer_t *nas_buffer)
);
memcpy(&nas_buffer->msg[1],mac,4);
m_nas_log->info("Packed Attach Accept\n");
//Log attach accept info
m_nas_log->info("Packed Attach Accept\n");
return true;
}

View File

@ -587,10 +587,10 @@ s1ap::find_imsi_from_m_tmsi(uint32_t m_tmsi)
{
std::map<uint32_t,uint64_t>::iterator it = m_tmsi_to_imsi.find(m_tmsi);
if (it != m_tmsi_to_imsi.end()) {
m_s1ap_log->debug("Found IMSI %015lu from M-TMSI 0x%x", it->second, m_tmsi);
m_s1ap_log->debug("Found IMSI %015lu from M-TMSI 0x%x\n", it->second, m_tmsi);
return it->second;
} else {
m_s1ap_log->debug("Could not find IMSI from M-TMSI 0x%x", m_tmsi);
m_s1ap_log->debug("Could not find IMSI from M-TMSI 0x%x\n", m_tmsi);
return 0;
}
}

View File

@ -105,6 +105,10 @@ s1ap_nas_transport::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSA
nas_init.apn = m_s1ap->m_s1ap_args.mme_apn;
nas_init.dns = m_s1ap->m_s1ap_args.dns_addr;
if(init_ue->S_TMSI_present){
m_tmsi = ntohl(*((uint32_t*) &init_ue->S_TMSI.m_TMSI.buffer));
}
switch (msg_type)
{
case LIBLTE_MME_MSG_TYPE_ATTACH_REQUEST: