diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b0d570871..eff1778c0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,7 +260,6 @@ endif() # Debug related options ######################################### -add_boolean_option(DEBUG_ASN1 False "Enable ASN1 debug logs" OFF) # asn1c skeletons have hardcoded this flag to make customized debug logs # OAI uses this feature to re-use OAI LOG_I(ASN1, ...) # see common/utils/config.h @@ -505,7 +504,7 @@ add_boolean_option(ENABLE_VCD_FIFO False "time measurements of proc cal ########################## # PHY options ########################## -add_integer_option(MAX_NUM_CCs 1 "????" ON) +add_integer_option(MAX_NUM_CCs 1 "Carrier component data arrays size (oai doesn't support carrier aggreagtion for now)" ON) add_boolean_option(SMBV False "Rohde&Schwarz SMBV100A vector signal generator" ON) add_boolean_option(DEBUG_PHY False "Enable PHY layer debugging options" ON) add_boolean_option(DEBUG_PHY_PROC False "Enable debugging of PHY layer procedures" ON) @@ -513,10 +512,7 @@ add_boolean_option(DEBUG_PHY_PROC False "Enable debugging of PHY layer ########################## # NAS LAYER OPTIONS ########################## -add_boolean_option(ENABLE_NAS_UE_LOGGING True "????" ON) add_boolean_option(NAS_BUILT_IN_UE True "UE NAS layer present in this executable" ON) -add_boolean_option(NAS_UE True "NAS UE INSTANCE (<> NAS_MME)" ON) - ########################## # RRC LAYER OPTIONS diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt index 146b63028c..c912bf9602 100755 --- a/cmake_targets/at_commands/CMakeLists.txt +++ b/cmake_targets/at_commands/CMakeLists.txt @@ -105,11 +105,7 @@ add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"") ########################## # NAS LAYER OPTIONS ########################## -add_boolean_option(ENABLE_NAS_UE_LOGGING True "????") -add_boolean_option(NAS_BUILT_IN_EPC False "MME NAS layer not present in this executable") add_boolean_option(NAS_BUILT_IN_UE False "UE NAS layer present in this executable") -add_boolean_option(NAS_UE True "NAS UE INSTANCE (<> NAS_MME)") -add_boolean_option(NAS_MME False "NAS_UE and NAS_MME are incompatible options") ################################################################################ # SECU LIB diff --git a/executables/lte-ue.c b/executables/lte-ue.c index 41ce61f384..e941690f26 100644 --- a/executables/lte-ue.c +++ b/executables/lte-ue.c @@ -1726,7 +1726,8 @@ void *UE_thread(void *arg) { pthread_mutex_unlock(&sync_mutex); */ wait_sync("UE thread"); -#ifdef NAS_UE + +#ifdef NAS_BUILT_IN_UE MessageDef *message_p; message_p = itti_alloc_new_message(TASK_NAS_UE, 0, INITIALIZE_MESSAGE); itti_send_msg_to_task (TASK_NAS_UE, UE->Mod_id + NB_eNB_INST, message_p); @@ -2089,7 +2090,7 @@ void init_UE_single_thread_stub(int nb_inst) { AssertFatal(PHY_vars_UE_g[i][0]!=NULL,"PHY_vars_UE_g[inst][0] is NULL\n"); if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) { -#ifdef NAS_UE +#ifdef NAS_BUILT_IN_UE MessageDef *message_p; message_p = itti_alloc_new_message(TASK_NAS_UE, 0, INITIALIZE_MESSAGE); itti_send_msg_to_task (TASK_NAS_UE, i + NB_eNB_INST, message_p); diff --git a/openair3/NAS/COMMON/API/NETWORK/nas_message.c b/openair3/NAS/COMMON/API/NETWORK/nas_message.c index 80551c5b5c..a3bb781f92 100644 --- a/openair3/NAS/COMMON/API/NETWORK/nas_message.c +++ b/openair3/NAS/COMMON/API/NETWORK/nas_message.c @@ -47,7 +47,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer #include // malloc, free #include // memcpy -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) +#if defined(NAS_BUILT_IN_UE) # include "nas_itti_messaging.h" #endif #include "secu_defs.h" @@ -158,15 +158,12 @@ nas_message_encrypt( LOG_FUNC_RETURN (TLV_ENCODE_BUFFER_TOO_SHORT); } else if (size > 1) { /* Encrypt the plain NAS message */ - bytes = _nas_message_encrypt(outbuf + size, inbuf, + bytes = _nas_message_encrypt(outbuf + size, + inbuf, header->security_header_type, header->message_authentication_code, header->sequence_number, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else SECU_DIRECTION_UPLINK, -#endif length - size, emm_security_context); @@ -175,15 +172,7 @@ nas_message_encrypt( /* Compute offset of the sequence number field */ int offset = size - sizeof(uint8_t); /* Compute the NAS message authentication code */ - uint32_t mac = _nas_message_get_mac( - outbuf + offset, - bytes + size - offset, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else - SECU_DIRECTION_UPLINK, -#endif - emm_security_context); + uint32_t mac = _nas_message_get_mac(outbuf + offset, bytes + size - offset, SECU_DIRECTION_UPLINK, emm_security_context); /* Set the message authentication code of the NAS message */ *(uint32_t*)(outbuf + sizeof(uint8_t)) = htonl(mac); } @@ -191,29 +180,6 @@ nas_message_encrypt( /* The input buffer does not need to be encrypted */ memcpy(outbuf, inbuf, length); } - -#ifdef NAS_MME - /* TS 124.301, section 4.4.3.1 - * The NAS sequence number part of the NAS COUNT shall be - * exchanged between the UE and the MME as part of the - * NAS signalling. After each new or retransmitted outbound - * security protected NAS message, the sender shall increase - * the NAS COUNT number by one. Specifically, on the sender - * side, the NAS sequence number shall be increased by one, - * and if the result is zero (due to wrap around), the NAS - * overflow counter shall also be incremented by one (see - * subclause 4.4.3.5). - */ - emm_security_context->dl_count.seq_num += 1; - - if ( ! emm_security_context->dl_count.seq_num) { - emm_security_context->dl_count.overflow += 1; - } - - LOG_TRACE(DEBUG, - "Incremented emm_security_context.dl_count.seq_num -> %u", - emm_security_context->dl_count.seq_num); -#else emm_security_context->ul_count.seq_num += 1; if ( ! emm_security_context->ul_count.seq_num) { @@ -223,8 +189,6 @@ nas_message_encrypt( LOG_TRACE(DEBUG, "Incremented emm_security_context.ul_count.seq_num -> %u", emm_security_context->ul_count.seq_num); -#endif - if (bytes < 0) { LOG_FUNC_RETURN (bytes); } @@ -276,48 +240,30 @@ int nas_message_decrypt( LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT); } else if (size > 1) { if (security) { - emm_security_context = (emm_security_context_t*)security; -#if defined(NAS_MME) - - if (emm_security_context->ul_count.seq_num > header->sequence_number) { - emm_security_context->ul_count.overflow += 1; - } - - emm_security_context->ul_count.seq_num = header->sequence_number; -#else + emm_security_context = (emm_security_context_t *)security; if (emm_security_context->dl_count.seq_num > header->sequence_number) { emm_security_context->dl_count.overflow += 1; } emm_security_context->dl_count.seq_num = header->sequence_number; -#endif } /* Compute offset of the sequence number field */ int offset = size - sizeof(uint8_t); /* Compute the NAS message authentication code */ - uint32_t mac = _nas_message_get_mac( - inbuf + offset, - length - offset, -#ifdef NAS_MME - SECU_DIRECTION_UPLINK, -#else - SECU_DIRECTION_DOWNLINK, -#endif - emm_security_context); + uint32_t mac = _nas_message_get_mac(inbuf + offset, length - offset, SECU_DIRECTION_DOWNLINK, emm_security_context); /* Check NAS message integrity */ if (mac != header->message_authentication_code) { - LOG_TRACE(DEBUG, "MAC Failure MSG:%08X(%u) <> INT ALGO:%08X(%u) Type of security context %u", - header->message_authentication_code,header->message_authentication_code, - mac,mac, (emm_security_context!=NULL)?emm_security_context->type:88); -#if defined(NAS_MME) - LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH); -#else -//#warning "added test on integrity algorithm because of SECURITY_MODE_COMMAND not correctly handled in UE (check integrity)" + header->message_authentication_code, + header->message_authentication_code, + mac, + mac, + (emm_security_context != NULL) ? emm_security_context->type : 88); + // #warning "added test on integrity algorithm because of SECURITY_MODE_COMMAND not correctly handled in UE (check integrity)" if (emm_security_context->selected_algorithms.integrity != NAS_SECURITY_ALGORITHMS_EIA0) { @@ -326,8 +272,6 @@ int nas_message_decrypt( LOG_TRACE(WARNING, "MAC failure but continue due to EIA0 selected"); } - -#endif } else { LOG_TRACE(DEBUG, "Integrity: MAC Success"); } @@ -385,38 +329,19 @@ int nas_message_decode( LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT); } else if (size > 1) { if (security) { - emm_security_context = (emm_security_context_t*)security; -#if defined(NAS_MME) - - if (emm_security_context->ul_count.seq_num > msg->header.sequence_number) { - emm_security_context->ul_count.overflow += 1; - } - - emm_security_context->ul_count.seq_num = msg->header.sequence_number; - -#else + emm_security_context = (emm_security_context_t *)security; if (emm_security_context->dl_count.seq_num > msg->header.sequence_number) { emm_security_context->dl_count.overflow += 1; } emm_security_context->dl_count.seq_num = msg->header.sequence_number; -#endif } /* Compute offset of the sequence number field */ int offset = size - sizeof(uint8_t); /* Compute the NAS message authentication code */ - uint32_t mac = _nas_message_get_mac( - buffer + offset, - length - offset, -#ifdef NAS_MME - SECU_DIRECTION_UPLINK, -#else - SECU_DIRECTION_DOWNLINK, -#endif - emm_security_context - ); + uint32_t mac = _nas_message_get_mac(buffer + offset, length - offset, SECU_DIRECTION_DOWNLINK, emm_security_context); #define NAS_CODE_TO_BE_MODIFIED 1 #ifdef NAS_CODE_TO_BE_MODIFIED @@ -445,10 +370,6 @@ int nas_message_decode( LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH); } -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - /* Log message header */ -#endif - /* Decode security protected NAS message */ bytes = _nas_message_protected_decode(buffer + size, &msg->header, @@ -525,62 +446,24 @@ int nas_message_encode( "offset %d = %d - %d, hdr encode = %d, length = %d bytes = %d", offset, size, (int)sizeof(uint8_t), size, length, bytes); - uint32_t mac = _nas_message_get_mac( - buffer + offset, - bytes + size - offset, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else - SECU_DIRECTION_UPLINK, -#endif - emm_security_context); + uint32_t mac = _nas_message_get_mac(buffer + offset, bytes + size - offset, SECU_DIRECTION_UPLINK, emm_security_context); /* Set the message authentication code of the NAS message */ uint32_t mac_nl = htonl(mac); memcpy(buffer + sizeof(uint8_t), &mac_nl, sizeof(mac_nl)); if (emm_security_context) { -#ifdef NAS_MME - /* TS 124.301, section 4.4.3.1 - * The NAS sequence number part of the NAS COUNT shall be - * exchanged between the UE and the MME as part of the - * NAS signalling. After each new or retransmitted outbound - * security protected NAS message, the sender shall increase - * the NAS COUNT number by one. Specifically, on the sender - * side, the NAS sequence number shall be increased by one, - * and if the result is zero (due to wrap around), the NAS - * overflow counter shall also be incremented by one (see - * subclause 4.4.3.5). - */ - - emm_security_context->dl_count.seq_num += 1; - - if ( ! emm_security_context->dl_count.seq_num) { - emm_security_context->dl_count.overflow += 1; - } - - LOG_TRACE(DEBUG, - "Incremented emm_security_context.dl_count.seq_num -> %u", - emm_security_context->dl_count.seq_num); -#else emm_security_context->ul_count.seq_num += 1; if ( ! emm_security_context->ul_count.seq_num) { emm_security_context->ul_count.overflow += 1; } - LOG_TRACE(DEBUG, - "Incremented emm_security_context.ul_count.seq_num -> %u", - emm_security_context->ul_count.seq_num); -#endif + LOG_TRACE(DEBUG, "Incremented emm_security_context.ul_count.seq_num -> %u", emm_security_context->ul_count.seq_num); } else { LOG_TRACE(DEBUG, "Did not increment emm_security_context.dl_count.seq_num because no security context"); } } - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - /* Log message header */ -#endif } else { /* Encode plain NAS message */ bytes = _nas_message_plain_encode(buffer, &msg->header, @@ -907,11 +790,7 @@ static int _nas_message_protected_encode( msg->header.security_header_type, msg->header.message_authentication_code, msg->header.sequence_number, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else SECU_DIRECTION_UPLINK, -#endif size, emm_security_context); //seq, size); @@ -967,11 +846,7 @@ static int _nas_message_decrypt( int size = 0; nas_message_security_header_t header; -#ifdef NAS_MME - direction = SECU_DIRECTION_UPLINK; -#else direction = SECU_DIRECTION_DOWNLINK; -#endif if (emm_security_context == NULL) LOG_FUNC_RETURN (0); @@ -1287,7 +1162,7 @@ static uint32_t _nas_message_get_mac( if (!emm_security_context) { LOG_TRACE(DEBUG, "No security context set for integrity protection algorithm"); -#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE) +#if defined(NAS_BUILT_IN_UE) LOG_FUNC_RETURN (0); #else LOG_FUNC_RETURN (0xabababab); @@ -1415,7 +1290,7 @@ static uint32_t _nas_message_get_mac( (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num ); -#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE) +#if defined(NAS_BUILT_IN_UE) LOG_FUNC_RETURN (0); #else LOG_FUNC_RETURN (0xabababab); diff --git a/openair3/NAS/COMMON/API/NETWORK/nas_message.h b/openair3/NAS/COMMON/API/NETWORK/nas_message.h index 8fde6eb97d..19dbf38fe6 100644 --- a/openair3/NAS/COMMON/API/NETWORK/nas_message.h +++ b/openair3/NAS/COMMON/API/NETWORK/nas_message.h @@ -42,11 +42,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer #include "commonDef.h" #include "emm_msg.h" -#if defined(NAS_BUILT_IN_EPC) -#include "emmData.h" -#endif #include "esm_msg.h" - /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ /****************************************************************************/ diff --git a/openair3/NAS/COMMON/API/NETWORK/network_api.c b/openair3/NAS/COMMON/API/NETWORK/network_api.c index a2ef101e92..0d99c8c570 100644 --- a/openair3/NAS/COMMON/API/NETWORK/network_api.c +++ b/openair3/NAS/COMMON/API/NETWORK/network_api.c @@ -129,13 +129,7 @@ int network_api_initialize(const char* host, const char* port) _network_api_id.send = socket_send; _network_api_id.close = socket_close; /* Initialize UDP communication channel with the network layer */ -#ifdef NAS_UE _network_api_id.endpoint = NETWORK_API_OPEN(SOCKET_CLIENT, host, port); -#endif -#ifdef NAS_MME - _network_api_id.endpoint = NETWORK_API_OPEN(SOCKET_SERVER, NULL, port); -#endif - if (_network_api_id.endpoint == NULL) { LOG_TRACE(ERROR, "NET-API - Failed to open connection endpoint, %s", ((errno < 0) ? gai_strerror(errno) : strerror(errno))); diff --git a/openair3/NAS/COMMON/EMM/MSG/emm_msg.c b/openair3/NAS/COMMON/EMM/MSG/emm_msg.c index cd55a3fffb..8ce145deec 100644 --- a/openair3/NAS/COMMON/EMM/MSG/emm_msg.c +++ b/openair3/NAS/COMMON/EMM/MSG/emm_msg.c @@ -86,14 +86,6 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len) { LOG_FUNC_IN; int header_result; int decode_result; - uint8_t *buffer_log = buffer; - uint32_t len_log = len; - int down_link; -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 0; -# else - down_link = 1; -# endif /* First decode the EMM message header */ header_result = _emm_msg_decode_header(&msg->header, buffer, len); @@ -247,14 +239,13 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len) { if (decode_result < 0) { LOG_TRACE(ERROR, "EMM-MSG - Failed to decode L3 EMM message 0x%x " "(%d)", msg->header.message_type, decode_result); - LOG_FUNC_RETURN (decode_result); + LOG_FUNC_RETURN(decode_result); } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) /* Message has been decoded and security header removed, handle it has a plain message */ - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, len_log, down_link); +#if defined(NAS_BUILT_IN_EPC) + nas_itti_plain_msg((char *)buffer_log, (nas_message_t *)msg, len_log, 0); #endif } - LOG_FUNC_RETURN (header_result + decode_result); } @@ -279,13 +270,6 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len) { LOG_FUNC_IN; int header_result; int encode_result; - uint8_t *buffer_log = buffer; - int down_link; -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 1; -# else - down_link = 0; -# endif /* First encode the EMM message header */ header_result = _emm_msg_encode_header(&msg->header, buffer, len); @@ -443,8 +427,8 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len) { LOG_TRACE(ERROR, "EMM-MSG - Failed to encode L3 EMM message 0x%x " "(%d)", msg->header.message_type, encode_result); } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, header_result + encode_result, down_link); +#if defined(NAS_BUILT_IN_EPC) + nas_itti_plain_msg((char *)buffer_log, (nas_message_t *)msg, header_result + encode_result, 1); #endif } diff --git a/openair3/NAS/COMMON/ESM/MSG/esm_msg.c b/openair3/NAS/COMMON/ESM/MSG/esm_msg.c index f4d3dd94dd..599120355e 100644 --- a/openair3/NAS/COMMON/ESM/MSG/esm_msg.c +++ b/openair3/NAS/COMMON/ESM/MSG/esm_msg.c @@ -43,10 +43,6 @@ Description Defines EPS Session Management messages #include "TLVDecoder.h" #include "TLVEncoder.h" -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) -# include "nas_itti_messaging.h" -#endif - /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ /****************************************************************************/ @@ -84,19 +80,6 @@ int esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len) { int header_result; int decode_result; - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - uint8_t *buffer_log = buffer; - uint32_t len_log = len; - int down_link; - -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 0; -# else - down_link = 1; -# endif -#endif - LOG_FUNC_IN; /* First decode the ESM message header */ @@ -210,14 +193,12 @@ int esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len) if (decode_result < 0) { LOG_TRACE(ERROR, "ESM-MSG - Failed to decode L3 ESM message 0x%x " "(%u)", msg->header.message_type, decode_result); - LOG_FUNC_RETURN (decode_result); + LOG_FUNC_RETURN(decode_result); } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - /* Message has been decoded and security header removed, handle it has a plain message */ - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, len_log, down_link); +#if defined(NAS_BUILT_IN_EPC) + nas_itti_plain_msg((char *)buffer_log, (nas_message_t *)msg, len_log, 0); #endif } - LOG_FUNC_RETURN (header_result + decode_result); } @@ -245,17 +226,6 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len) int header_result; int encode_result; -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - uint8_t *buffer_log = buffer; - int down_link; - -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 1; -# else - down_link = 0; -# endif -#endif - /* First encode the ESM message header */ header_result = _esm_msg_encode_header(&msg->header, buffer, len); @@ -371,11 +341,10 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len) LOG_TRACE(ERROR, "ESM-MSG - Failed to encode L3 ESM message 0x%x " "(%d)", msg->header.message_type, encode_result); } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, header_result + encode_result, down_link); +#if defined(NAS_BUILT_IN_EPC) + nas_itti_plain_msg((char *)buffer_log, (nas_message_t *)msg, header_result + encode_result, 1); #endif } - LOG_FUNC_RETURN (header_result + encode_result); } diff --git a/openair3/NAS/COMMON/UTIL/nas_log.h b/openair3/NAS/COMMON/UTIL/nas_log.h index d1531fa6db..710c165440 100644 --- a/openair3/NAS/COMMON/UTIL/nas_log.h +++ b/openair3/NAS/COMMON/UTIL/nas_log.h @@ -38,7 +38,7 @@ Description Usefull logging functions #ifndef __NAS_LOG_H__ #define __NAS_LOG_H__ -#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE) +#if defined(NAS_BUILT_IN_UE) # include "common/utils/LOG/log.h" # undef LOG_TRACE #endif diff --git a/openair3/NAS/COMMON/UTIL/nas_timer.c b/openair3/NAS/COMMON/UTIL/nas_timer.c index b67a3bc232..0a521ceeb4 100644 --- a/openair3/NAS/COMMON/UTIL/nas_timer.c +++ b/openair3/NAS/COMMON/UTIL/nas_timer.c @@ -216,11 +216,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args) /* Insert the new entry into the timer queue */ _nas_timer_db_insert_entry(id, te); -# if defined(NAS_MME) - ret = timer_setup(sec, 0, TASK_NAS_MME, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id); -# else ret = timer_setup(sec, 0, TASK_NAS_UE, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id); -# endif if (ret == -1) { return NAS_TIMER_INACTIVE_ID; @@ -295,39 +291,6 @@ int nas_timer_restart(int id) return (NAS_TIMER_INACTIVE_ID); } -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _nas_timer_handler() ** - ** ** - ** Description: The timer handler is executed whenever the system deli- ** - ** vers signal SIGALARM. It starts execution of the callback ** - ** function of the first entry within the queue of active ** - ** timer entries. The entry is not removed from the queue of ** - ** active timer entries and shall be explicitly removed when ** - ** the timer expires. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _nas_timer_db ** - ** ** - ***************************************************************************/ - -void nas_timer_handle_signal_expiry(long timer_id, void *arg_p) -{ - /* Get the timer entry for which the system timer expired */ - nas_timer_entry_t *te = _nas_timer_db.head->entry; - - te->cb(te->args); -} - - /* * ----------------------------------------------------------------------------- * Functions used to manage the timer database diff --git a/openair3/NAS/COMMON/UTIL/nas_timer.h b/openair3/NAS/COMMON/UTIL/nas_timer.h index b1149f21c0..2af27f63dd 100644 --- a/openair3/NAS/COMMON/UTIL/nas_timer.h +++ b/openair3/NAS/COMMON/UTIL/nas_timer.h @@ -74,8 +74,4 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args); int nas_timer_stop(int id); int nas_timer_restart(int id); -#if defined(NAS_BUILT_IN_EPC) -void nas_timer_handle_signal_expiry(long timer_id, void *arg_p); -#endif - #endif /* __NAS_TIMER_H__ */ diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c index e7707a8ccd..6f64413b70 100644 --- a/openair3/NAS/UE/nas_itti_messaging.c +++ b/openair3/NAS/UE/nas_itti_messaging.c @@ -27,8 +27,7 @@ # define TASK_ORIGIN TASK_NAS_UE - -#if (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) ) +#if defined(NAS_BUILT_IN_UE) __attribute__ ((unused)) static const uint8_t emm_message_ids[] = { ATTACH_REQUEST, ATTACH_ACCEPT, diff --git a/openair3/NAS/UE/nas_itti_messaging.h b/openair3/NAS/UE/nas_itti_messaging.h index 79b70394f0..7fdda32960 100644 --- a/openair3/NAS/UE/nas_itti_messaging.h +++ b/openair3/NAS/UE/nas_itti_messaging.h @@ -30,22 +30,13 @@ #ifndef NAS_ITTI_MESSAGING_H_ #define NAS_ITTI_MESSAGING_H_ -# if (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE)) int nas_itti_plain_msg( const char *buffer, const nas_message_t *msg, const int lengthP, const int instance); -int nas_itti_protected_msg( - const char *buffer, - const nas_message_t *msg, - const int lengthP, - const int instance); -# endif - - -# if defined(NAS_BUILT_IN_UE) +int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const int lengthP, const int instance); int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id); @@ -56,5 +47,4 @@ int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t int nas_itti_ul_data_req(const uint32_t ue_idP, void *const data_pP, const uint32_t lengthP, int user_id); int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID, const nas_error_code_t errCode, int user_id); -# endif #endif /* NAS_ITTI_MESSAGING_H_ */ diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index dfb4a98d4f..473ca46834 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -34,8 +34,6 @@ #include "nas_user.h" #include "common/ran_context.h" -// FIXME make command line option for NAS_UE_AUTOSTART -# define NAS_UE_AUTOSTART 1 // FIXME review these externs extern uint16_t NB_UE_INST; @@ -203,15 +201,12 @@ void *nas_ue_task(void *args_p) switch (ITTI_MSG_ID(msg_p)) { case INITIALIZE_MESSAGE: - LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, ITTI_MSG_NAME (msg_p)); -#if (NAS_UE_AUTOSTART != 0) + LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, ITTI_MSG_NAME(msg_p)); { /* Send an activate modem command to NAS like UserProcess should do it */ char *user_data = "at+cfun=1\r"; - nas_user_receive_and_process (user, user_data); } -#endif break; case TERMINATE_MESSAGE: diff --git a/openair3/SECU/key_nas_deriver.c b/openair3/SECU/key_nas_deriver.c index 8a7b32ee2f..20aba64e1e 100644 --- a/openair3/SECU/key_nas_deriver.c +++ b/openair3/SECU/key_nas_deriver.c @@ -139,7 +139,6 @@ void nr_derive_key(algorithm_type_dist_t alg_type, uint8_t alg_id, const uint8_t * NOTE: knas is dynamically allocated by the KDF function */ -#ifndef NAS_UE void derive_keNB(const uint8_t kasme[32], const uint32_t nas_count, uint8_t *keNB) { uint8_t s[7] = {0}; @@ -159,7 +158,6 @@ void derive_keNB(const uint8_t kasme[32], const uint32_t nas_count, uint8_t *keN byte_array_t data = {.buf = s, .len = 7}; kdf(kasme, data, 32, keNB); } -#endif void derive_keNB_star(const uint8_t *kenb_32, const uint16_t pci,