From 3f61d5f720deec9a8cc6d06119252f574f0fddc1 Mon Sep 17 00:00:00 2001
From: frtabu <francois.taburet@nokia-bell-labs.com>
Date: Sat, 16 Feb 2019 22:01:49 +0100
Subject: [PATCH] fix compilation warning

---
 cmake_targets/CMakeLists.txt          |  2 +-
 cmake_targets/build_oai               |  2 +-
 openair3/NAS/COMMON/EMM/MSG/emm_msg.c | 13 +++++--------
 openair3/NAS/UE/ESM/esm_ebr_context.c | 20 ++++++++------------
 openair3/NAS/UE/nas_itti_messaging.c  |  5 +++--
 targets/RT/USER/lte-uesoftmodem.c     |  9 +++------
 6 files changed, 21 insertions(+), 30 deletions(-)

diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index c2ac403f32..fcaaa9dacb 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -250,7 +250,7 @@ add_boolean_option(UE_DEBUG_TRACE      False "Activate UE debug trace")
 add_boolean_option(UE_TIMING_TRACE     False "Activate UE timing trace")
 add_boolean_option(DISABLE_LOG_X       False "Deactivate all LOG_* macros")
 add_boolean_option(USRP_REC_PLAY       False "Enable USRP record playback mode")
-add_boolean_option(UE_NAS_USE_TUN      False "Enable UE NAS TUN device instead of ue_ip.ko")
+#add_boolean_option(UE_NAS_USE_TUN      False "Enable UE NAS TUN device instead of ue_ip.ko")
 add_boolean_option(BASIC_SIMULATOR     False "Has to be True when building the basic simulator, False otherwise")
 
 add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 5f2c7e9cc4..d14bd3ec6e 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -936,7 +936,7 @@ fi
     echo "set (LINUX True )"                          >>  $cmake_file
     echo "set (PDCP_USE_NETLINK True )"               >>  $cmake_file
     echo "set (BASIC_SIMULATOR \"True\" )"            >>  $cmake_file
-    echo "set (UE_NAS_USE_TUN \"True\" )"             >>  $cmake_file
+#    echo "set (UE_NAS_USE_TUN \"True\" )"             >>  $cmake_file
     echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../../CMakeLists.txt)' >> $cmake_file
 
     echo_info "Build UE"
diff --git a/openair3/NAS/COMMON/EMM/MSG/emm_msg.c b/openair3/NAS/COMMON/EMM/MSG/emm_msg.c
index b9c9b93a9c..e4b5e31800 100644
--- a/openair3/NAS/COMMON/EMM/MSG/emm_msg.c
+++ b/openair3/NAS/COMMON/EMM/MSG/emm_msg.c
@@ -44,9 +44,8 @@ Description Defines EPS Mobility 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
+
+#include "nas_itti_messaging.h"
 
 /****************************************************************************/
 /****************  E X T E R N A L    D E F I N I T I O N S  ****************/
@@ -89,8 +88,6 @@ int emm_msg_decode(EMM_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;
@@ -100,7 +97,7 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
 # else
   down_link = 1;
 # endif
-#endif
+
 
   /* First decode the EMM message header */
   header_result = _emm_msg_decode_header(&msg->header, buffer, len);
@@ -291,7 +288,7 @@ int emm_msg_encode(EMM_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;
 
@@ -300,7 +297,7 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
 # else
   down_link = 0;
 # endif
-#endif
+
 
   /* First encode the EMM message header */
   header_result = _emm_msg_encode_header(&msg->header, buffer, len);
diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c
index 7404cd8b8a..c0827ed9db 100644
--- a/openair3/NAS/UE/ESM/esm_ebr_context.c
+++ b/openair3/NAS/UE/ESM/esm_ebr_context.c
@@ -48,21 +48,17 @@ Description Defines functions used to handle EPS bearer contexts.
 
 #include "emm_sap.h"
 #include "system.h"
-
-#if defined(ENABLE_ITTI)
-# include "assertions.h"
-#endif
+#include "assertions.h"
+#include "pdcp.h"
 
 
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#ifdef PDCP_USE_NETLINK
 #ifdef UESIM_EXPANSION
   #include "openairinterface5g_limits.h"
   extern uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX];
 #endif
-#endif
 extern uint8_t  nfapi_mode;
 
 /****************************************************************************/
@@ -282,10 +278,10 @@ int esm_ebr_context_create(
                 // this is for L2 FAPI simulator.
                 // change for multiple UE's like 256UEs.
                 // if it's made too many tables , OS may crush so we use one table.
-#ifdef PDCP_USE_NETLINK
+                if(PDCP_USE_NETLINK) {
 #ifdef UESIM_EXPANSION
-                uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 2;
-                res = sprintf(command_line,
+                  uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 2;
+                  res = sprintf(command_line,
                            "ifconfig oip%d %s netmask %s broadcast %s up && "
                            "ip rule add from %s/24 table %d && "
                            "ip rule add to %s/24 table %d && "
@@ -295,9 +291,9 @@ int esm_ebr_context_create(
                            ipv4_addr, 201,
                            inst_nic + 1, 201);
 
-               inst_pdcp_list[inst_nic] = ueid;
+                 inst_pdcp_list[inst_nic] = ueid;
 #else
-               res = sprintf(command_line,
+                 res = sprintf(command_line,
                           "ifconfig oip%d %s netmask %s broadcast %s up && "
                           "ip rule add from %s/32 table %d && "
                           "ip rule add to %s/32 table %d && "
@@ -307,7 +303,7 @@ int esm_ebr_context_create(
                           ipv4_addr, ueid + 201,
                           ueid + 1, ueid + 201);
 #endif
-#endif
+               } // PDCP_USE_NETLINK
              } else {
                res = sprintf(command_line,
                            "ifconfig oip%d %s netmask %s broadcast %s up && "
diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c
index 0c5a2fec1f..55566700d7 100644
--- a/openair3/NAS/UE/nas_itti_messaging.c
+++ b/openair3/NAS/UE/nas_itti_messaging.c
@@ -27,8 +27,9 @@
 
 #   define TASK_ORIGIN  TASK_NAS_UE
 
+
 #if (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) )
-static const uint8_t emm_message_ids[] = {
+__attribute__ ((unused)) static const uint8_t emm_message_ids[] = {
   ATTACH_REQUEST,
   ATTACH_ACCEPT,
   ATTACH_COMPLETE,
@@ -60,7 +61,7 @@ static const uint8_t emm_message_ids[] = {
   CS_SERVICE_NOTIFICATION,
 };
 
-static const uint8_t esm_message_ids[] = {
+__attribute__ ((unused)) static const uint8_t esm_message_ids[] = {
   ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST,
   ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT,
   ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT,
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index cf46098b57..40cbcf917d 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -110,11 +110,9 @@ pthread_mutex_t nfapi_sync_mutex;
 int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
 
 uint8_t nfapi_mode = 0;
-#ifdef PDCP_USE_NETLINK
 #ifdef UESIM_EXPANSION
 uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX];
 #endif
-#endif
 uint16_t sf_ahead=2;
 int tddflag;
 char *emul_iface;
@@ -685,11 +683,10 @@ int main( int argc, char **argv ) {
 #endif
   int CC_id;
   uint8_t  abstraction_flag=0;
-#ifdef PDCP_USE_NETLINK
-#ifdef UESIM_EXPANSION
-  memset(inst_pdcp_list, 0, sizeof(inst_pdcp_list));
-#endif
+#ifdef UESIM_EXPANSION  
+    memset(inst_pdcp_list, 0, sizeof(inst_pdcp_list));
 #endif
+
   // Default value for the number of UEs. It will hold,
   // if not changed from the command line option --num-ues
   NB_UE_INST=1;
-- 
GitLab