Commit 2d6270a7 authored by gauthier's avatar gauthier
Browse files

Better behaviour for NAS MME (NAS NON DELIVERY INDICATION)

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7660 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent f777e5c7
...@@ -1082,14 +1082,14 @@ void *gtpv1u_eNB_task(void *args) ...@@ -1082,14 +1082,14 @@ void *gtpv1u_eNB_task(void *args)
if (rc != NW_GTPV1U_OK) { if (rc != NW_GTPV1U_OK) {
LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc); LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc);
MSC_LOG_EVENT(MSC_GTPU_ENB,"Failed send G-PDU ltid %u rtid %u size %u", MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u",
enb_s1u_teid,sgw_s1u_teid,data_req_p->length); enb_s1u_teid,sgw_s1u_teid,data_req_p->length);
} else { } else {
rc = nwGtpv1uProcessUlpReq(gtpv1u_data_g.gtpv1u_stack, &stack_req); rc = nwGtpv1uProcessUlpReq(gtpv1u_data_g.gtpv1u_stack, &stack_req);
if (rc != NW_GTPV1U_OK) { if (rc != NW_GTPV1U_OK) {
LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc); LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc);
MSC_LOG_EVENT(MSC_GTPU_ENB,"Failed send G-PDU ltid %u rtid %u size %u", MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u",
enb_s1u_teid,sgw_s1u_teid,data_req_p->length); enb_s1u_teid,sgw_s1u_teid,data_req_p->length);
} else { } else {
MSC_LOG_TX_MESSAGE( MSC_LOG_TX_MESSAGE(
......
...@@ -170,8 +170,8 @@ int ...@@ -170,8 +170,8 @@ int
mme_app_handle_authentication_info_answer( mme_app_handle_authentication_info_answer(
const s6a_auth_info_ans_t * const s6a_auth_info_ans_pP) const s6a_auth_info_ans_t * const s6a_auth_info_ans_pP)
{ {
struct ue_context_s *ue_context; struct ue_context_s *ue_context = NULL;
uint64_t imsi; uint64_t imsi = 0;
DevAssert(s6a_auth_info_ans_pP != NULL); DevAssert(s6a_auth_info_ans_pP != NULL);
......
...@@ -275,6 +275,29 @@ int mme_insert_ue_context(mme_ue_context_t *mme_ue_context, struct ue_context_s ...@@ -275,6 +275,29 @@ int mme_insert_ue_context(mme_ue_context_t *mme_ue_context, struct ue_context_s
return 0; return 0;
} }
//------------------------------------------------------------------------------
void mme_remove_ue_context(mme_ue_context_t *mme_ue_context, struct ue_context_s *ue_context_p)
//------------------------------------------------------------------------------
{
struct ue_context_s *collision_p = NULL;
DevAssert(mme_ue_context != NULL);
DevAssert(ue_context_p != NULL);
/* Updating statistics */
mme_ue_context->nb_ue_managed++;
mme_ue_context->nb_ue_since_last_stat++;
collision_p = RB_REMOVE(ue_context_map, &mme_ue_context->ue_context_tree,
ue_context_p);
#warning "TODO mme_ue_context_free_content"
//TODO mme_ue_context_free_content(ue_context_p);
free(ue_context_p);
return 0;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void mme_app_dump_ue_contexts(mme_ue_context_t *mme_ue_context) void mme_app_dump_ue_contexts(mme_ue_context_t *mme_ue_context)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -451,13 +474,12 @@ void mme_app_dump_ue_contexts(mme_ue_context_t *mme_ue_context) ...@@ -451,13 +474,12 @@ void mme_app_dump_ue_contexts(mme_ue_context_t *mme_ue_context)
void mme_app_handle_s1ap_ue_context_release_req(const s1ap_ue_context_release_req_t const *s1ap_ue_context_release_req) void mme_app_handle_s1ap_ue_context_release_req(const s1ap_ue_context_release_req_t const *s1ap_ue_context_release_req)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
struct ue_context_s *ue_context_p = NULL; struct ue_context_s *ue_context_p = NULL;
MessageDef *message_p = NULL;
MME_APP_DEBUG("Received S1AP_UE_CONTEXT_RELEASE_REQ from S1AP\n"); MME_APP_DEBUG("Received S1AP_UE_CONTEXT_RELEASE_REQ from S1AP\n");
ue_context_p = mme_ue_context_exists_nas_ue_id(&mme_app_desc.mme_ue_contexts, s1ap_ue_context_release_req->mme_ue_s1ap_id); ue_context_p = mme_ue_context_exists_nas_ue_id(&mme_app_desc.mme_ue_contexts, s1ap_ue_context_release_req->mme_ue_s1ap_id);
if (ue_context_p == NULL) { if (ue_context_p == NULL) {
MSC_LOG_EVENT( MSC_LOG_EVENT(
MSC_MMEAPP_MME, MSC_MMEAPP_MME,
...@@ -467,7 +489,29 @@ void mme_app_handle_s1ap_ue_context_release_req(const s1ap_ue_context_release_re ...@@ -467,7 +489,29 @@ void mme_app_handle_s1ap_ue_context_release_req(const s1ap_ue_context_release_re
s1ap_ue_context_release_req->mme_ue_s1ap_id); s1ap_ue_context_release_req->mme_ue_s1ap_id);
return; return;
} }
mme_app_send_s11_release_access_bearers_req(ue_context_p); if ((ue_context_p->mme_s11_teid == 0) &&
(ue_context_p->sgw_s11_teid == 0)) {
// no session was created, no need for releasing bearers in SGW
message_p = itti_alloc_new_message(TASK_MME_APP, S1AP_UE_CONTEXT_RELEASE_COMMAND);
AssertFatal(message_p != NULL, "itti_alloc_new_message Failed");
memset((void*)&message_p->ittiMsg.s1ap_ue_context_release_command,
0,
sizeof(s1ap_ue_context_release_command_t));
S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id;
MSC_LOG_TX_MESSAGE(
MSC_MMEAPP_MME,
MSC_S1AP_MME,
NULL,0,
"0 S1AP_UE_CONTEXT_RELEASE_COMMAND mme_ue_s1ap_id %06"PRIX32" ",
S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).mme_ue_s1ap_id);
itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
} else {
mme_app_send_s11_release_access_bearers_req(ue_context_p);
}
} }
...@@ -506,4 +550,6 @@ void mme_app_handle_s1ap_ue_context_release_complete(const s1ap_ue_context_relea ...@@ -506,4 +550,6 @@ void mme_app_handle_s1ap_ue_context_release_complete(const s1ap_ue_context_relea
"0 S1AP_DEREGISTER_UE_REQ"); "0 S1AP_DEREGISTER_UE_REQ");
itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p);
mme_remove_ue_context(&mme_app_desc.mme_ue_contexts, ue_context_p);
} }
...@@ -241,6 +241,13 @@ ue_context_t *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context, ...@@ -241,6 +241,13 @@ ue_context_t *mme_ue_context_exists_guti(mme_ue_context_t *mme_ue_context,
int mme_insert_ue_context(mme_ue_context_t *mme_ue_context, int mme_insert_ue_context(mme_ue_context_t *mme_ue_context,
struct ue_context_s *ue_context_p); struct ue_context_s *ue_context_p);
/** \brief Remove a UE context of the tree of known UEs.
* \param ue_context_p The UE context to remove
**/
void mme_remove_ue_context(mme_ue_context_t *mme_ue_context,
struct ue_context_s *ue_context_p);
/** \brief Allocate memory for a new UE context /** \brief Allocate memory for a new UE context
* @returns Pointer to the new structure, NULL if allocation failed * @returns Pointer to the new structure, NULL if allocation failed
**/ **/
......
...@@ -91,8 +91,8 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length) ...@@ -91,8 +91,8 @@ int as_message_decode(const char* buffer, as_message_t* msg, int length)
Byte_t** data = NULL; Byte_t** data = NULL;
/* Get the message type */ /* Get the message type */
msg->msgID = *(UInt16_t*)(buffer); msg->msgID = *(uint16_t*)(buffer);
bytes = sizeof(UInt16_t); bytes = sizeof(uint16_t);
switch (msg->msgID) { switch (msg->msgID) {
case AS_NAS_ESTABLISH_REQ: case AS_NAS_ESTABLISH_REQ:
......
...@@ -204,13 +204,13 @@ typedef struct {} paging_ind_t; ...@@ -204,13 +204,13 @@ typedef struct {} paging_ind_t;
/* Structure of the SAE Temporary Mobile Subscriber Identity */ /* Structure of the SAE Temporary Mobile Subscriber Identity */
typedef struct { typedef struct {
UInt8_t MMEcode; /* MME code that allocated the GUTI */ uint8_t MMEcode; /* MME code that allocated the GUTI */
UInt32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */ uint32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */
} as_stmsi_t; } as_stmsi_t;
/* Structure of the dedicated NAS information */ /* Structure of the dedicated NAS information */
typedef struct { typedef struct {
UInt32_t length; /* Length of the NAS information data */ uint32_t length; /* Length of the NAS information data */
Byte_t* data; /* Dedicated NAS information data container */ Byte_t* data; /* Dedicated NAS information data container */
} as_nas_info_t; } as_nas_info_t;
...@@ -220,8 +220,8 @@ typedef struct { ...@@ -220,8 +220,8 @@ typedef struct {
* to transfer initial NAS message to the network while UE is in IDLE mode. * to transfer initial NAS message to the network while UE is in IDLE mode.
*/ */
typedef struct { typedef struct {
UInt8_t cause; /* Connection establishment cause */ uint8_t cause; /* Connection establishment cause */
UInt8_t type; /* Associated call type */ uint8_t type; /* Associated call type */
plmn_t plmnID; /* Identifier of the selected PLMN */ plmn_t plmnID; /* Identifier of the selected PLMN */
as_stmsi_t s_tmsi; /* SAE Temporary Mobile Subscriber Identity */ as_stmsi_t s_tmsi; /* SAE Temporary Mobile Subscriber Identity */
as_nas_info_t initialNasMsg;/* Initial NAS message to transfer */ as_nas_info_t initialNasMsg;/* Initial NAS message to transfer */
...@@ -274,7 +274,7 @@ typedef as_nas_info_t ul_info_transfer_t; ...@@ -274,7 +274,7 @@ typedef as_nas_info_t ul_info_transfer_t;
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
typedef struct { typedef struct {
UInt16_t msgID; uint16_t msgID;
union { union {
cell_info_req_t cell_info_req; cell_info_req_t cell_info_req;
cell_info_rsp_t cell_info_rsp; cell_info_rsp_t cell_info_rsp;
......
...@@ -97,9 +97,9 @@ static int _nas_message_protected_encode( ...@@ -97,9 +97,9 @@ static int _nas_message_protected_encode(
static int _nas_message_decrypt( static int _nas_message_decrypt(
char* dest, char* dest,
const char* src, const char* src,
UInt8_t type, uint8_t type,
UInt32_t code, uint32_t code,
UInt8_t seq, uint8_t seq,
int length, int length,
const emm_security_context_t * const emm_security_context); const emm_security_context_t * const emm_security_context);
...@@ -108,15 +108,15 @@ static int ...@@ -108,15 +108,15 @@ static int
_nas_message_encrypt( _nas_message_encrypt(
char *dest, char *dest,
const char *src, const char *src,
UInt8_t type, uint8_t type,
UInt32_t code, uint32_t code,
UInt8_t seq, uint8_t seq,
int const direction, int const direction,
int length, int length,
const emm_security_context_t * const emm_security_context); const emm_security_context_t * const emm_security_context);
/* Functions used for integrity protection of layer 3 NAS messages */ /* Functions used for integrity protection of layer 3 NAS messages */
static UInt32_t _nas_message_get_mac( static uint32_t _nas_message_get_mac(
const char * const buffer, const char * const buffer,
int const length, int const length,
int const direction, int const direction,
...@@ -180,9 +180,9 @@ nas_message_encrypt( ...@@ -180,9 +180,9 @@ nas_message_encrypt(
/* Integrity protected the NAS message */ /* Integrity protected the NAS message */
if (bytes > 0) { if (bytes > 0) {
/* Compute offset of the sequence number field */ /* Compute offset of the sequence number field */
int offset = size - sizeof(UInt8_t); int offset = size - sizeof(uint8_t);
/* Compute the NAS message authentication code */ /* Compute the NAS message authentication code */
UInt32_t mac = _nas_message_get_mac( uint32_t mac = _nas_message_get_mac(
outbuf + offset, outbuf + offset,
bytes + size - offset, bytes + size - offset,
#ifdef NAS_MME #ifdef NAS_MME
...@@ -192,7 +192,7 @@ nas_message_encrypt( ...@@ -192,7 +192,7 @@ nas_message_encrypt(
#endif #endif
emm_security_context); emm_security_context);
/* Set the message authentication code of the NAS message */ /* Set the message authentication code of the NAS message */
*(UInt32_t*)(outbuf + sizeof(UInt8_t)) = htonl(mac); *(uint32_t*)(outbuf + sizeof(uint8_t)) = htonl(mac);
} }
} else { } else {
/* The input buffer does not need to be encrypted */ /* The input buffer does not need to be encrypted */
...@@ -301,9 +301,9 @@ int nas_message_decrypt( ...@@ -301,9 +301,9 @@ int nas_message_decrypt(
} }
/* Compute offset of the sequence number field */ /* Compute offset of the sequence number field */
int offset = size - sizeof(UInt8_t); int offset = size - sizeof(uint8_t);
/* Compute the NAS message authentication code */ /* Compute the NAS message authentication code */
UInt32_t mac = _nas_message_get_mac( uint32_t mac = _nas_message_get_mac(
inbuf + offset, inbuf + offset,
length - offset, length - offset,
#ifdef NAS_MME #ifdef NAS_MME
...@@ -410,9 +410,9 @@ int nas_message_decode( ...@@ -410,9 +410,9 @@ int nas_message_decode(
} }
/* Compute offset of the sequence number field */ /* Compute offset of the sequence number field */
int offset = size - sizeof(UInt8_t); int offset = size - sizeof(uint8_t);
/* Compute the NAS message authentication code */ /* Compute the NAS message authentication code */
UInt32_t mac = _nas_message_get_mac( uint32_t mac = _nas_message_get_mac(
buffer + offset, buffer + offset,
length - offset, length - offset,
#ifdef NAS_MME #ifdef NAS_MME
...@@ -524,13 +524,13 @@ int nas_message_encode( ...@@ -524,13 +524,13 @@ int nas_message_encode(
/* Integrity protect the NAS message */ /* Integrity protect the NAS message */
if (bytes > 0) { if (bytes > 0) {
/* Compute offset of the sequence number field */ /* Compute offset of the sequence number field */
int offset = size - sizeof(UInt8_t); int offset = size - sizeof(uint8_t);
/* Compute the NAS message authentication code */ /* Compute the NAS message authentication code */
LOG_TRACE(DEBUG, LOG_TRACE(DEBUG,
"offset %d = %d - %d, hdr encode = %d, length = %d bytes = %d", "offset %d = %d - %d, hdr encode = %d, length = %d bytes = %d",
offset, size, sizeof(UInt8_t), offset, size, sizeof(uint8_t),
size, length, bytes); size, length, bytes);
UInt32_t mac = _nas_message_get_mac( uint32_t mac = _nas_message_get_mac(
buffer + offset, buffer + offset,
bytes + size - offset, bytes + size - offset,
#ifdef NAS_MME #ifdef NAS_MME
...@@ -540,7 +540,7 @@ int nas_message_encode( ...@@ -540,7 +540,7 @@ int nas_message_encode(
#endif #endif
emm_security_context); emm_security_context);
/* Set the message authentication code of the NAS message */ /* Set the message authentication code of the NAS message */
*(UInt32_t*)(buffer + sizeof(UInt8_t)) = htonl(mac); *(uint32_t*)(buffer + sizeof(uint8_t)) = htonl(mac);
if (emm_security_context) { if (emm_security_context) {
#ifdef NAS_MME #ifdef NAS_MME
...@@ -644,7 +644,7 @@ _nas_message_header_decode( ...@@ -644,7 +644,7 @@ _nas_message_header_decode(
/* Decode the first octet of the header (security header type or EPS bearer /* Decode the first octet of the header (security header type or EPS bearer
* identity, and protocol discriminator) */ * identity, and protocol discriminator) */
DECODE_U8(buffer, *(UInt8_t*)(header), size); DECODE_U8(buffer, *(uint8_t*)(header), size);
if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) {
if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
...@@ -798,7 +798,7 @@ static int _nas_message_header_encode( ...@@ -798,7 +798,7 @@ static int _nas_message_header_encode(
/* Encode the first octet of the header (security header type or EPS bearer /* Encode the first octet of the header (security header type or EPS bearer
* identity, and protocol discriminator) */ * identity, and protocol discriminator) */
ENCODE_U8(buffer, *(UInt8_t*)(header), size); ENCODE_U8(buffer, *(uint8_t*)(header), size);
if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) { if (header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE) {
if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
...@@ -956,9 +956,9 @@ static int _nas_message_protected_encode( ...@@ -956,9 +956,9 @@ static int _nas_message_protected_encode(
static int _nas_message_decrypt( static int _nas_message_decrypt(
char *dest, char *dest,
const char *src, const char *src,
UInt8_t security_header_type, uint8_t security_header_type,
UInt32_t code, uint32_t code,
UInt8_t seq, uint8_t seq,
int length, int length,
const emm_security_context_t * const emm_security_context) const emm_security_context_t * const emm_security_context)
{ {
...@@ -986,7 +986,7 @@ static int _nas_message_decrypt( ...@@ -986,7 +986,7 @@ static int _nas_message_decrypt(
"No decryption of message length %u according to security header type 0x%02x", "No decryption of message length %u according to security header type 0x%02x",
length, security_header_type); length, security_header_type);
memcpy(dest, src, length); memcpy(dest, src, length);
DECODE_U8(dest, *(UInt8_t*)(&header), size); DECODE_U8(dest, *(uint8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator); LOG_FUNC_RETURN (header.protocol_discriminator);
//LOG_FUNC_RETURN (length); //LOG_FUNC_RETURN (length);
break; break;
...@@ -1022,7 +1022,7 @@ static int _nas_message_decrypt( ...@@ -1022,7 +1022,7 @@ static int _nas_message_decrypt(
nas_stream_encrypt_eea1(&stream_cipher, dest); nas_stream_encrypt_eea1(&stream_cipher, dest);
/* Decode the first octet (security header type or EPS bearer identity, /* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */ * and protocol discriminator) */
DECODE_U8(dest, *(UInt8_t*)(&header), size); DECODE_U8(dest, *(uint8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator); LOG_FUNC_RETURN (header.protocol_discriminator);
...@@ -1056,7 +1056,7 @@ static int _nas_message_decrypt( ...@@ -1056,7 +1056,7 @@ static int _nas_message_decrypt(
nas_stream_encrypt_eea1(&stream_cipher, dest); nas_stream_encrypt_eea1(&stream_cipher, dest);
/* Decode the first octet (security header type or EPS bearer identity, /* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */ * and protocol discriminator) */
DECODE_U8(dest, *(UInt8_t*)(&header), size); DECODE_U8(dest, *(uint8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator); LOG_FUNC_RETURN (header.protocol_discriminator);
} }
...@@ -1071,7 +1071,7 @@ static int _nas_message_decrypt( ...@@ -1071,7 +1071,7 @@ static int _nas_message_decrypt(
memcpy(dest, src, length); memcpy(dest, src, length);
/* Decode the first octet (security header type or EPS bearer identity, /* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */ * and protocol discriminator) */
DECODE_U8(dest, *(UInt8_t*)(&header), size); DECODE_U8(dest, *(uint8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator); LOG_FUNC_RETURN (header.protocol_discriminator);
...@@ -1084,7 +1084,7 @@ static int _nas_message_decrypt( ...@@ -1084,7 +1084,7 @@ static int _nas_message_decrypt(
memcpy(dest, src, length); memcpy(dest, src, length);
/* Decode the first octet (security header type or EPS bearer identity, /* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */ * and protocol discriminator) */
DECODE_U8(dest, *(UInt8_t*)(&header), size); DECODE_U8(dest, *(uint8_t*)(&header), size);
LOG_FUNC_RETURN (header.protocol_discriminator); LOG_FUNC_RETURN (header.protocol_discriminator);
break; break;
...@@ -1124,9 +1124,9 @@ static int _nas_message_decrypt( ...@@ -1124,9 +1124,9 @@ static int _nas_message_decrypt(
static int _nas_message_encrypt( static int _nas_message_encrypt(
char *dest, char *dest,
const char *src, const char *src,
UInt8_t security_header_type, uint8_t security_header_type,
UInt32_t code, uint32_t code,
UInt8_t seq, uint8_t seq,
int const direction, int const direction,
int length, int length,
const emm_security_context_t * const emm_security_context) const emm_security_context_t * const emm_security_context)
...@@ -1274,7 +1274,7 @@ static int _nas_message_encrypt( ...@@ -1274,7 +1274,7 @@ static int _nas_message_encrypt(
** Others: None ** ** Others: None **
** ** ** **
***************************************************************************/ ***************************************************************************/
static UInt32_t _nas_message_get_mac( static uint32_t _nas_message_get_mac(
const char * const buffer, const char * const buffer,
int const length, int const length,
int const direction, int const direction,
...@@ -1296,10 +1296,10 @@ static UInt32_t _nas_message_get_mac( ...@@ -1296,10 +1296,10 @@ static UInt32_t _nas_message_get_mac(
switch (emm_security_context->selected_algorithms.integrity) { switch (emm_security_context->selected_algorithms.integrity) {
case NAS_SECURITY_ALGORITHMS_EIA1: { case NAS_SECURITY_ALGORITHMS_EIA1: {
UInt8_t mac[4]; uint8_t mac[4];
nas_stream_cipher_t stream_cipher; nas_stream_cipher_t stream_cipher;
UInt32_t count; uint32_t count;
UInt32_t *mac32; uint32_t *mac32;
int i,bytes = 0; int i,bytes = 0;
...@@ -1354,20 +1354,20 @@ static UInt32_t _nas_message_get_mac( ...@@ -1354,20 +1354,20 @@ static UInt32_t _nas_message_get_mac(
LOG_TRACE(DEBUG, LOG_TRACE(DEBUG,
"NAS_SECURITY_ALGORITHMS_EIA1 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d", "NAS_SECURITY_ALGORITHMS_EIA1 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d",
mac[0], mac[1], mac[2],mac[3], mac[0], mac[1], mac[2],mac[3],
*((UInt32_t*)&mac), *((uint32_t*)&mac),
length, length,
direction, direction,
count); count);
mac32 = (UInt32_t*)&mac; mac32 = (uint32_t*)&mac;
LOG_FUNC_RETURN (ntohl(*mac32)); LOG_FUNC_RETURN (ntohl(*mac32));
} }
break; break;
case NAS_SECURITY_ALGORITHMS_EIA2: { case NAS_SECURITY_ALGORITHMS_EIA2: {
UInt8_t mac[4]; uint8_t mac[4];
nas_stream_cipher_t stream_cipher; nas_stream_cipher_t stream_cipher;
UInt32_t count; uint32_t count;
UInt32_t *mac32; uint32_t *mac32;
if (direction == SECU_DIRECTION_UPLINK) { if (direction == SECU_DIRECTION_UPLINK) {
count = 0x00000000 || count = 0x00000000 ||
...@@ -1400,11 +1400,11 @@ static UInt32_t _nas_message_get_mac( ...@@ -1400,11 +1400,11 @@ static UInt32_t _nas_message_get_mac(
LOG_TRACE(DEBUG, LOG_TRACE(DEBUG,
"NAS_SECURITY_ALGORITHMS_EIA2 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d", "NAS_SECURITY_ALGORITHMS_EIA2 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d",
mac[0], mac[1], mac[2],mac[3], mac[0], mac[1], mac[2],mac[3],
*((UInt32_t*)&mac), *((uint32_t*)&mac),
length, length,
direction, direction,
count); count);
mac32 = (UInt32_t*)&mac; mac32 = (uint32_t*)&mac;
LOG_FUNC_RETURN (ntohl(*mac32)); LOG_FUNC_RETURN (ntohl(*mac32));
} }
break; break;
......
...@@ -68,14 +68,14 @@ Description Defines the layer 3 messages supported by the NAS sublayer ...@@ -68,14 +68,14 @@ Description Defines the layer 3 messages supported by the NAS sublayer
typedef struct {