From 3073ab6822587166fc1dcaa04f3d61e3e89c37cc Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 21 Aug 2018 14:11:28 +0100 Subject: [PATCH] Changed dettach request to use downlink nas transport. --- srsepc/hdr/mme/nas.h | 2 +- srsepc/src/mme/nas.cc | 43 ++++++++++++++-------------- srsepc/src/mme/s1ap_nas_transport.cc | 4 +-- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/srsepc/hdr/mme/nas.h b/srsepc/hdr/mme/nas.h index ff118a859..7fc4dfb73 100644 --- a/srsepc/hdr/mme/nas.h +++ b/srsepc/hdr/mme/nas.h @@ -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); diff --git a/srsepc/src/mme/nas.cc b/srsepc/src/mme/nas.cc index 032912f95..f6efa819e 100644 --- a/srsepc/src/mme/nas.cc +++ b/srsepc/src/mme/nas.cc @@ -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) diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index 9a1a130a6..2b9776b58 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -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));