Changed dettach request to use downlink nas transport.

This commit is contained in:
Pedro Alvarez 2018-08-21 14:11:28 +01:00
parent 749e84315a
commit 3073ab6822
3 changed files with 25 additions and 24 deletions

View File

@ -192,7 +192,7 @@ public:
bool handle_identity_response( srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
bool handle_tracking_area_update_request( srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
bool handle_authentication_failure( srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
bool handle_nas_detach_request( srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *reply_buffer, bool *reply_flag);
bool handle_nas_detach_request( srslte::byte_buffer_t *nas_msg);
/* Downlink NAS messages packing */
bool pack_authentication_request (srslte::byte_buffer_t *reply_msg);

View File

@ -482,27 +482,6 @@ nas::handle_guti_attach_request_unknown_ue( uint32_t enb_ue_s1ap_id,
* Handle Uplink NAS Transport message
*
*/
bool
nas::handle_nas_detach_request(srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *reply_msg, bool *reply_flag)
{
m_nas_log->console("Detach request -- IMSI %015lu\n", m_emm_ctx.imsi);
m_nas_log->info("Detach request -- IMSI %015lu\n", m_emm_ctx.imsi);
LIBLTE_MME_DETACH_REQUEST_MSG_STRUCT detach_req;
LIBLTE_ERROR_ENUM err = liblte_mme_unpack_detach_request_msg((LIBLTE_BYTE_MSG_STRUCT*) nas_msg, &detach_req);
if(err !=LIBLTE_SUCCESS) {
m_nas_log->error("Could not unpack detach request\n");
return false;
}
m_gtpc->send_delete_session_request(m_emm_ctx.imsi);
m_emm_ctx.state = EMM_STATE_DEREGISTERED;
if (m_ecm_ctx.mme_ue_s1ap_id!=0) {
m_s1ap->send_ue_context_release_command(m_ecm_ctx.mme_ue_s1ap_id);
}
return true;
}
bool
nas::handle_nas_authentication_response(srslte::byte_buffer_t *nas_msg, srslte::byte_buffer_t *reply_buffer, bool* reply_flag)
@ -830,6 +809,28 @@ nas::handle_authentication_failure(srslte::byte_buffer_t *nas_msg, srslte::byte_
return true;
}
bool
nas::handle_nas_detach_request(srslte::byte_buffer_t *nas_msg)
{
m_nas_log->console("Detach request -- IMSI %015lu\n", m_emm_ctx.imsi);
m_nas_log->info("Detach request -- IMSI %015lu\n", m_emm_ctx.imsi);
LIBLTE_MME_DETACH_REQUEST_MSG_STRUCT detach_req;
LIBLTE_ERROR_ENUM err = liblte_mme_unpack_detach_request_msg((LIBLTE_BYTE_MSG_STRUCT*) nas_msg, &detach_req);
if(err !=LIBLTE_SUCCESS) {
m_nas_log->error("Could not unpack detach request\n");
return false;
}
m_gtpc->send_delete_session_request(m_emm_ctx.imsi);
m_emm_ctx.state = EMM_STATE_DEREGISTERED;
if (m_ecm_ctx.mme_ue_s1ap_id!=0) {
m_s1ap->send_ue_context_release_command(m_ecm_ctx.mme_ue_s1ap_id);
}
return true;
}
/*Packing/Unpacking helper functions*/
bool
nas::pack_authentication_request(srslte::byte_buffer_t *reply_msg)

View File

@ -235,7 +235,7 @@ s1ap_nas_transport::handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRA
case LIBLTE_MME_MSG_TYPE_DETACH_REQUEST:
m_s1ap_log->info("Plain Protected UL NAS: Detach Request\n");
m_s1ap_log->console("Plain Protected UL NAS: Detach Request\n");
nas_ctx->handle_nas_detach_request(nas_msg, reply_buffer, reply_flag);
nas_ctx->handle_nas_detach_request(nas_msg);
break;
default:
m_s1ap_log->warning("Unhandled Plain NAS message 0x%x\n", msg_type );
@ -302,7 +302,7 @@ s1ap_nas_transport::handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRA
case LIBLTE_MME_MSG_TYPE_DETACH_REQUEST:
m_s1ap_log->info("Integrity Protected UL NAS: Detach Request\n");
m_s1ap_log->console("Integrity Protected UL NAS: Detach Request\n");
nas_ctx->handle_nas_detach_request(nas_msg, reply_buffer, reply_flag);
nas_ctx->handle_nas_detach_request(nas_msg);
break;
default:
m_s1ap_log->warning("Unhandled NAS integrity protected message %s\n", liblte_nas_msg_type_to_string(msg_type));