From 3fdec57a47f3ee7bbdce30cb41c7ccb92aaba498 Mon Sep 17 00:00:00 2001 From: "Ali_UBUNTU18.04" Date: Sun, 12 Dec 2021 10:17:20 +0330 Subject: [PATCH] liblte_mme: Added sec_hdr_type check in liblte_mme_pack_deactivate_eps_bearer_context_request_msg --- lib/include/srsran/asn1/liblte_mme.h | 2 ++ lib/src/asn1/liblte_mme.cc | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/include/srsran/asn1/liblte_mme.h b/lib/include/srsran/asn1/liblte_mme.h index f8ba5b5e1..33d1d6115 100644 --- a/lib/include/srsran/asn1/liblte_mme.h +++ b/lib/include/srsran/asn1/liblte_mme.h @@ -3649,6 +3649,8 @@ typedef struct { // Functions LIBLTE_ERROR_ENUM liblte_mme_pack_deactivate_eps_bearer_context_request_msg( LIBLTE_MME_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT* deact_eps_bearer_context_req, + uint8 sec_hdr_type, + uint32 count, LIBLTE_BYTE_MSG_STRUCT* msg); LIBLTE_ERROR_ENUM liblte_mme_unpack_deactivate_eps_bearer_context_request_msg( LIBLTE_BYTE_MSG_STRUCT* msg, diff --git a/lib/src/asn1/liblte_mme.cc b/lib/src/asn1/liblte_mme.cc index 90bb3ee31..2d32f310e 100644 --- a/lib/src/asn1/liblte_mme.cc +++ b/lib/src/asn1/liblte_mme.cc @@ -9018,12 +9018,27 @@ LIBLTE_ERROR_ENUM liblte_mme_unpack_deactivate_eps_bearer_context_accept_msg( *********************************************************************/ LIBLTE_ERROR_ENUM liblte_mme_pack_deactivate_eps_bearer_context_request_msg( LIBLTE_MME_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_MSG_STRUCT* deact_eps_bearer_context_req, + uint8 sec_hdr_type, + uint32 count, LIBLTE_BYTE_MSG_STRUCT* msg) { LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS; uint8* msg_ptr = msg->msg; if (deact_eps_bearer_context_req != NULL && msg != NULL) { + if (LIBLTE_MME_SECURITY_HDR_TYPE_PLAIN_NAS != sec_hdr_type) { + // Protocol Discriminator and Security Header Type + *msg_ptr = (sec_hdr_type << 4) | (LIBLTE_MME_PD_EPS_MOBILITY_MANAGEMENT); + msg_ptr++; + + // MAC will be filled in later + msg_ptr += 4; + + // Sequence Number + *msg_ptr = count & 0xFF; + msg_ptr++; + } + // Protocol Discriminator and EPS Bearer ID *msg_ptr = (deact_eps_bearer_context_req->eps_bearer_id << 4) | (LIBLTE_MME_PD_EPS_SESSION_MANAGEMENT); msg_ptr++;