diff --git a/CHANGELOG b/CHANGELOG index 5a57af260..9bed0247c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ Change Log for Releases ============================== +## 18.03 + * Many bug-fixes and improved stability and performance in all parts + ## 17.12 * Added support for MIMO 2x2 in srsENB (i.e. TM3/TM4) * Added srsEPC, a light-weight core network implementation diff --git a/CMakeLists.txt b/CMakeLists.txt index 98023d7b5..290754ee3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,8 +41,6 @@ include(SRSLTEVersion) #sets version information include(SRSLTEPackage) #setup cpack include(CTest) -set(CTEST_MEMORYCHECK_COMMAND valgrind) -set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --leak-check=full" ) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in" @@ -171,7 +169,6 @@ if(ENABLE_SRSUE OR ENABLE_SRSENB OR ENABLE_SRSEPC) set(BOOST_REQUIRED_COMPONENTS program_options - system ) if(UNIX AND EXISTS "/usr/lib64") list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix @@ -229,7 +226,7 @@ macro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have) endmacro(ADD_CXX_COMPILER_FLAG_IF_AVAILABLE) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -std=c++03") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=${GCC_ARCH} -Wall -Wno-comment -Wno-reorder -Wno-unused-but-set-variable -Wno-unused-variable -Wformat -std=c++03") find_package(SSE) if (HAVE_AVX2) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 1c4aa5735..d8e316006 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -11,3 +11,4 @@ set(CTEST_DROP_METHOD "http") set(CTEST_DROP_SITE "my.cdash.org") set(CTEST_DROP_LOCATION "/submit.php?project=srsLTE") set(CTEST_DROP_SITE_CDASH TRUE) +set(VALGRIND_COMMAND_OPTIONS "--trace-children=yes --leak-check=full --show-reachable=yes --vex-guest-max-insns=25") \ No newline at end of file diff --git a/README.md b/README.md index 1567c7c71..a8f186a62 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ Build Instructions For example, on Ubuntu 17.04, one can install the required libraries with: ``` -sudo apt-get install cmake libfftw3-dev libmbedtls-dev libboost-program-options-dev libboost-thread-dev libconfig++-dev libsctp-dev +sudo apt-get install cmake libfftw3-dev libmbedtls-dev libboost-program-options-dev libconfig++-dev libsctp-dev ``` Note that depending on your flavor and version of Linux, the actual package names may be different. diff --git a/cmake/modules/SRSLTEVersion.cmake b/cmake/modules/SRSLTEVersion.cmake index fec6ab21f..30d2707b0 100644 --- a/cmake/modules/SRSLTEVersion.cmake +++ b/cmake/modules/SRSLTEVersion.cmake @@ -18,7 +18,7 @@ # and at http://www.gnu.org/licenses/. # -SET(SRSLTE_VERSION_MAJOR 17) -SET(SRSLTE_VERSION_MINOR 12) +SET(SRSLTE_VERSION_MAJOR 18) +SET(SRSLTE_VERSION_MINOR 3) SET(SRSLTE_VERSION_PATCH 0) SET(SRSLTE_VERSION_STRING "${SRSLTE_VERSION_MAJOR}.${SRSLTE_VERSION_MINOR}.${SRSLTE_VERSION_PATCH}") diff --git a/lib/include/srslte/common/log.h b/lib/include/srslte/common/log.h index 360482c47..45c359629 100644 --- a/lib/include/srslte/common/log.h +++ b/lib/include/srslte/common/log.h @@ -122,11 +122,11 @@ public: } // Pure virtual methods for logging - virtual void console(std::string message, ...) = 0; - virtual void error(std::string message, ...) = 0; - virtual void warning(std::string message, ...) = 0; - virtual void info(std::string message, ...) = 0; - virtual void debug(std::string message, ...) = 0; + virtual void console(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0; + virtual void error(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0; + virtual void warning(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0; + virtual void info(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0; + virtual void debug(const char * message, ...) __attribute__ ((format (printf, 2, 3))) = 0; // Same with hex dump virtual void error_hex(uint8_t *hex, int size, std::string message, ...){error("error_hex not implemented.\n");} diff --git a/lib/include/srslte/common/log_filter.h b/lib/include/srslte/common/log_filter.h index 7e4014190..430a59199 100644 --- a/lib/include/srslte/common/log_filter.h +++ b/lib/include/srslte/common/log_filter.h @@ -57,11 +57,11 @@ public: void init(std::string layer, logger *logger_, bool tti=false); - void console(std::string message, ...); - void error(std::string message, ...); - void warning(std::string message, ...); - void info(std::string message, ...); - void debug(std::string message, ...); + void console(const char * message, ...); + void error(const char * message, ...); + void warning(const char * message, ...); + void info(const char * message, ...); + void debug(const char * message, ...); void error_hex(uint8_t *hex, int size, std::string message, ...); void warning_hex(uint8_t *hex, int size, std::string message, ...); diff --git a/lib/src/common/log_filter.cc b/lib/src/common/log_filter.cc index 8b72a3c2b..b79e222e7 100644 --- a/lib/src/common/log_filter.cc +++ b/lib/src/common/log_filter.cc @@ -135,55 +135,55 @@ void log_filter::all_log(srslte::LOG_LEVEL_ENUM level, } } -void log_filter::console(std::string message, ...) { +void log_filter::console(const char * message, ...) { char *args_msg; va_list args; va_start(args, message); - if(vasprintf(&args_msg, message.c_str(), args) > 0) + if(vasprintf(&args_msg, message, args) > 0) printf("%s",args_msg); // Print directly to stdout va_end(args); free(args_msg); } -void log_filter::error(std::string message, ...) { +void log_filter::error(const char * message, ...) { if (level >= LOG_LEVEL_ERROR) { char *args_msg; va_list args; va_start(args, message); - if(vasprintf(&args_msg, message.c_str(), args) > 0) + if(vasprintf(&args_msg, message, args) > 0) all_log(LOG_LEVEL_ERROR, tti, args_msg); va_end(args); free(args_msg); } } -void log_filter::warning(std::string message, ...) { +void log_filter::warning(const char * message, ...) { if (level >= LOG_LEVEL_WARNING) { char *args_msg; va_list args; va_start(args, message); - if(vasprintf(&args_msg, message.c_str(), args) > 0) + if(vasprintf(&args_msg, message, args) > 0) all_log(LOG_LEVEL_WARNING, tti, args_msg); va_end(args); free(args_msg); } } -void log_filter::info(std::string message, ...) { +void log_filter::info(const char * message, ...) { if (level >= LOG_LEVEL_INFO) { char *args_msg; va_list args; va_start(args, message); - if(vasprintf(&args_msg, message.c_str(), args) > 0) + if(vasprintf(&args_msg, message, args) > 0) all_log(LOG_LEVEL_INFO, tti, args_msg); va_end(args); free(args_msg); } } -void log_filter::debug(std::string message, ...) { +void log_filter::debug(const char * message, ...) { if (level >= LOG_LEVEL_DEBUG) { char *args_msg; va_list args; va_start(args, message); - if(vasprintf(&args_msg, message.c_str(), args) > 0) + if(vasprintf(&args_msg, message, args) > 0) all_log(LOG_LEVEL_DEBUG, tti, args_msg); va_end(args); free(args_msg); diff --git a/lib/src/common/pdu.cc b/lib/src/common/pdu.cc index 80db7627d..95d9dde9b 100644 --- a/lib/src/common/pdu.cc +++ b/lib/src/common/pdu.cc @@ -124,7 +124,6 @@ uint8_t* sch_pdu::write_packet(srslte::log *log_h) if (nof_subheaders <= 0 && nof_subheaders < (int)max_subheaders) { log_h->error("Trying to write packet with invalid number of subheaders (nof_subheaders=%d).\n", nof_subheaders); - log_h->console("Trying to write packet with invalid number of subheaders (nof_subheaders=%d).\n", nof_subheaders); return NULL; } diff --git a/lib/src/phy/rf/rf_uhd_imp.c b/lib/src/phy/rf/rf_uhd_imp.c index b4b0cfcd6..1c09b7990 100644 --- a/lib/src/phy/rf/rf_uhd_imp.c +++ b/lib/src/phy/rf/rf_uhd_imp.c @@ -35,6 +35,8 @@ #include "srslte/phy/rf/rf.h" #include "uhd_c_api.h" +#define HAVE_ASYNC_THREAD 0 + typedef struct { char *devname; uhd_usrp_handle usrp; @@ -87,6 +89,7 @@ static void log_late(rf_uhd_handler_t *h, bool is_rx) { } } +#if HAVE_ASYNC_THREAD static void log_underflow(rf_uhd_handler_t *h) { if (h->uhd_error_handler) { srslte_rf_error_t error; @@ -95,6 +98,7 @@ static void log_underflow(rf_uhd_handler_t *h) { h->uhd_error_handler(error); } } +#endif static void log_rx_error(rf_uhd_handler_t *h) { if (h->uhd_error_handler) { @@ -109,6 +113,7 @@ static void log_rx_error(rf_uhd_handler_t *h) { } } +#if HAVE_ASYNC_THREAD static void* async_thread(void *h) { rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h; uhd_async_metadata_handle md; @@ -135,6 +140,7 @@ static void* async_thread(void *h) { uhd_async_metadata_free(&md); return NULL; } +#endif void rf_uhd_suppress_stdout(void *h) { rf_uhd_register_msg_handler_c(suppress_handler); @@ -570,13 +576,14 @@ int rf_uhd_open_multi(char *args, void **h, uint32_t nof_channels) rf_uhd_set_rx_gain(handler, max_gain*0.7); uhd_meta_range_free(&gain_range); +#if HAVE_ASYNC_THREAD // Start low priority thread to receive async commands - /* handler->async_thread_running = true; if (pthread_create(&handler->async_thread, NULL, async_thread, handler)) { perror("pthread_create"); return -1; - }*/ + } +#endif /* Restore priorities */ uhd_set_thread_priority(0, false); diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index 8c3e944bc..ea50fb7f6 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -342,7 +342,7 @@ int rlc_am::read_pdu(uint8_t *payload, uint32_t nof_bytes) pthread_mutex_lock(&mutex); log->debug("MAC opportunity - %d bytes\n", nof_bytes); - log->debug("tx_window size - %d PDUs\n", tx_window.size()); + log->debug("tx_window size - %zu PDUs\n", tx_window.size()); // Tx STATUS if requested if(do_status && !status_prohibited()) { @@ -698,7 +698,7 @@ int rlc_am::build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t r if(pdu_len > (int)nof_bytes) { log->error("%s Retx PDU segment length error. Available: %d, Used: %d\n", rrc->get_rb_name(lcid).c_str(), nof_bytes, pdu_len); - log->debug("%s Retx PDU segment length error. Header len: %d, Payload len: %d, N_li: %d\n", + log->debug("%s Retx PDU segment length error. Header len: %ld, Payload len: %d, N_li: %d\n", rrc->get_rb_name(lcid).c_str(), (ptr-payload), len, new_header.N_li); } return pdu_len; diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index 6e5e06669..2d3466522 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -25,7 +25,6 @@ */ #include -#include #include #include "enb.h" @@ -298,7 +297,7 @@ void enb::handle_rf_msg(srslte_rf_error_t error) str.erase(std::remove(str.begin(), str.end(), '\n'), str.end()); str.erase(std::remove(str.begin(), str.end(), '\r'), str.end()); str.push_back('\n'); - rf_log.info(str); + rf_log.info(str.c_str()); } } diff --git a/srsenb/src/phy/phch_worker.cc b/srsenb/src/phy/phch_worker.cc index 8013a7d5c..5524be442 100644 --- a/srsenb/src/phy/phch_worker.cc +++ b/srsenb/src/phy/phch_worker.cc @@ -227,7 +227,7 @@ void phch_worker::set_conf_dedicated_ack(uint16_t rnti, bool ack){ if (ue_db.count(rnti)) { ue_db[rnti].dedicated_ack = ack; } else { - Error("Setting dedicated ack: rnti=0x%x does not exist\n"); + Error("Setting dedicated ack: rnti=0x%x does not exist\n", rnti); } pthread_mutex_unlock(&mutex); } @@ -309,7 +309,7 @@ void phch_worker::set_config_dedicated(uint16_t rnti, ue_db[rnti].dedicated.pdsch_cnfg_ded = dedicated->pdsch_cnfg_ded; } } else { - Error("Setting config dedicated: rnti=0x%x does not exist\n"); + Error("Setting config dedicated: rnti=0x%x does not exist\n", rnti); } pthread_mutex_unlock(&mutex); } diff --git a/srsenb/src/phy/txrx.cc b/srsenb/src/phy/txrx.cc index fbc96ea72..32c8aea00 100644 --- a/srsenb/src/phy/txrx.cc +++ b/srsenb/src/phy/txrx.cc @@ -125,7 +125,7 @@ void txrx::run_thread() srslte_timestamp_copy(&tx_time, &rx_time); srslte_timestamp_add(&tx_time, 0, HARQ_DELAY_MS*1e-3); - Debug("Settting TTI=%d, tx_mutex=%d, tx_time=%d:%f to worker %d\n", + Debug("Settting TTI=%d, tx_mutex=%d, tx_time=%ld:%f to worker %d\n", tti, tx_mutex_cnt, tx_time.full_secs, tx_time.frac_secs, worker->get_id()); diff --git a/srsenb/src/upper/rrc.cc b/srsenb/src/upper/rrc.cc index f1ae51016..9fe1773f7 100644 --- a/srsenb/src/upper/rrc.cc +++ b/srsenb/src/upper/rrc.cc @@ -225,7 +225,7 @@ void rrc::add_user(uint16_t rnti) pdcp->add_user(rnti); rrc_log->info("Added new user rnti=0x%x\n", rnti); } else { - rrc_log->error("Adding user rnti=0x%x (already exists)\n"); + rrc_log->error("Adding user rnti=0x%x (already exists)\n", rnti); } pthread_mutex_unlock(&user_mutex); } @@ -584,7 +584,7 @@ void rrc::parse_ul_ccch(uint16_t rnti, byte_buffer_t *pdu) if (users[rnti].is_idle()) { old_rnti = ul_ccch_msg.msg.rrc_con_reest_req.ue_id.c_rnti; if (users.count(old_rnti)) { - rrc_log->error("Not supported: ConnectionReestablishment. Sending Connection Reject\n", old_rnti); + rrc_log->error("Not supported: ConnectionReestablishment for rnti=0x%x. Sending Connection Reject\n", old_rnti); users[rnti].send_connection_reest_rej(); rem_user_thread(old_rnti); } else { @@ -649,7 +649,7 @@ void rrc::run_thread() pthread_mutex_lock(&user_mutex); break; default: - rrc_log->error("Rx PDU with invalid bearer id: %s", p.lcid); + rrc_log->error("Rx PDU with invalid bearer id: %d", p.lcid); break; } } else { @@ -799,7 +799,7 @@ bool rrc::ue::is_timeout() int64_t deadline = deadline_s*1e6 + deadline_us; int64_t elapsed = t[0].tv_sec*1e6 + t[0].tv_usec; if (elapsed > deadline && elapsed > 0) { - parent->rrc_log->warning("User rnti=0x%x expired %s deadline: %d:%d>%d:%d us\n", + parent->rrc_log->warning("User rnti=0x%x expired %s deadline: %ld:%ld>%d:%d us\n", rnti, deadline_str, t[0].tv_sec, t[0].tv_usec, deadline_s, deadline_us); @@ -1069,6 +1069,9 @@ void rrc::ue::notify_s1ap_ue_ctxt_setup_complete() { LIBLTE_S1AP_MESSAGE_INITIALCONTEXTSETUPRESPONSE_STRUCT res; res.ext = false; + res.E_RABFailedToSetupListCtxtSURes_present = false; + res.CriticalityDiagnostics_present = false; + res.E_RABSetupListCtxtSURes.len = 0; res.E_RABFailedToSetupListCtxtSURes.len = 0; diff --git a/srsepc/hdr/mme/mme_gtpc.h b/srsepc/hdr/mme/mme_gtpc.h index 23e6acf0a..f41172cce 100644 --- a/srsepc/hdr/mme/mme_gtpc.h +++ b/srsepc/hdr/mme/mme_gtpc.h @@ -29,7 +29,6 @@ #include "srslte/common/log.h" #include "srslte/common/log_filter.h" #include "srslte/common/buffer_pool.h" -#include #include "srslte/asn1/gtpc.h" #include "mme/s1ap_common.h" namespace srsepc diff --git a/srsepc/hdr/mme/s1ap_nas_transport.h b/srsepc/hdr/mme/s1ap_nas_transport.h index 9f5b1b646..500f41565 100644 --- a/srsepc/hdr/mme/s1ap_nas_transport.h +++ b/srsepc/hdr/mme/s1ap_nas_transport.h @@ -81,6 +81,13 @@ public: bool* reply_flag, struct sctp_sndrcvinfo *enb_sri); + bool handle_nas_tracking_area_update_request( uint32_t m_tmsi, + uint32_t enb_ue_s1ap_id, + srslte::byte_buffer_t *nas_msg, + srslte::byte_buffer_t *reply_buffer, + bool* reply_flag, + struct sctp_sndrcvinfo *enb_sri); + bool handle_nas_authentication_response(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool* reply_flag); bool handle_nas_security_mode_complete(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool *reply_flag); bool handle_nas_attach_complete(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool *reply_flag); diff --git a/srsepc/src/hss/hss.cc b/srsepc/src/hss/hss.cc index a3bc797b4..703928270 100644 --- a/srsepc/src/hss/hss.cc +++ b/srsepc/src/hss/hss.cc @@ -28,7 +28,6 @@ #include #include #include -#include #include "hss/hss.h" #include "srslte/common/security.h" diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index 3fe34806c..0dce45c41 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -78,7 +78,7 @@ s1ap::init(s1ap_args_t s1ap_args, srslte::log_filter *s1ap_log, hss_interface_s1 m_s1ap_args = s1ap_args; srslte::s1ap_mccmnc_to_plmn(s1ap_args.mcc, s1ap_args.mnc, &m_plmn); - m_next_m_tmsi = 0xF000; + m_next_m_tmsi = rand(); //Init log m_s1ap_log = s1ap_log; @@ -542,8 +542,9 @@ s1ap::activate_eps_bearer(uint64_t imsi, uint8_t ebi) uint32_t s1ap::allocate_m_tmsi(uint64_t imsi) { - // uint32_t m_tmsi = m_next_m_tmsi++; uint32_t m_tmsi = m_next_m_tmsi; + m_next_m_tmsi = (m_next_m_tmsi + 1) % UINT32_MAX; + m_tmsi_to_imsi.insert(std::pair(m_tmsi,imsi)); m_s1ap_log->debug("Allocated M-TMSI 0x%x to IMSI %015lu,\n",m_tmsi,imsi); return m_tmsi; diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index 2d11384ae..183815fc6 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -25,6 +25,8 @@ */ #include +#include +#include // for printing uint64_t #include "mme/s1ap.h" #include "mme/s1ap_nas_transport.h" #include "srslte/common/security.h" @@ -128,8 +130,8 @@ s1ap_nas_transport::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSA m_s1ap_log->info("Received Initial UE message -- Detach Request\n"); if(!init_ue->S_TMSI_present) { - m_s1ap_log->error("Service request -- S-TMSI not present\n"); - m_s1ap_log->console("Service request -- S-TMSI not present\n" ); + m_s1ap_log->error("Detach request -- S-TMSI not present\n"); + m_s1ap_log->console("Detach request -- S-TMSI not present\n" ); return false; } uint32_t *m_tmsi = (uint32_t*) &init_ue->S_TMSI.m_TMSI.buffer; @@ -142,6 +144,26 @@ s1ap_nas_transport::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSA handle_nas_detach_request(ntohl(*m_tmsi), enb_ue_s1ap_id, nas_msg, reply_buffer,reply_flag, enb_sri); return true; } + else if(msg_type == LIBLTE_MME_MSG_TYPE_TRACKING_AREA_UPDATE_REQUEST) + { + m_s1ap_log->console("Received Initial UE message -- Tracking Area Update Request\n"); + m_s1ap_log->info("Received Initial UE message -- Tracking Area Update Request\n"); + if(!init_ue->S_TMSI_present) + { + m_s1ap_log->error("Tracking Area Update Request -- S-TMSI not present\n"); + m_s1ap_log->console("Tracking Area Update Request -- S-TMSI not present\n" ); + return false; + } + uint32_t *m_tmsi = (uint32_t*) &init_ue->S_TMSI.m_TMSI.buffer; + uint32_t enb_ue_s1ap_id = init_ue->eNB_UE_S1AP_ID.ENB_UE_S1AP_ID; + m_s1ap_log->info("Tracking Area Update Request -- S-TMSI 0x%x\n", ntohl(*m_tmsi)); + m_s1ap_log->console("Tracking Area Update Request -- S-TMSI 0x%x\n", ntohl(*m_tmsi) ); + m_s1ap_log->info("Tracking Area Update Request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); + m_s1ap_log->console("Tracking Area Update Request -- eNB UE S1AP Id %d\n", enb_ue_s1ap_id); + + handle_nas_tracking_area_update_request(ntohl(*m_tmsi), enb_ue_s1ap_id, nas_msg, reply_buffer,reply_flag, enb_sri); + return true; + } else { m_s1ap_log->info("Unhandled Initial UE Message 0x%x\n",msg_type); @@ -164,11 +186,11 @@ s1ap_nas_transport::handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRA ue_ctx_t *ue_ctx = m_s1ap->find_ue_ctx_from_mme_ue_s1ap_id(mme_ue_s1ap_id); if(ue_ctx == NULL) { - m_s1ap_log->warning("Received uplink NAS, but could not find UE ECM context. MME-UE S1AP id: %lu\n",mme_ue_s1ap_id); + m_s1ap_log->warning("Received uplink NAS, but could not find UE ECM context. MME-UE S1AP id: %d\n",mme_ue_s1ap_id); return false; } - m_s1ap_log->debug("Received uplink NAS and found UE ECM context. MME-UE S1AP id: %lu\n",mme_ue_s1ap_id); + m_s1ap_log->debug("Received uplink NAS and found UE ECM context. MME-UE S1AP id: %d\n",mme_ue_s1ap_id); ue_emm_ctx_t *emm_ctx = &ue_ctx->emm_ctx; ue_ecm_ctx_t *ecm_ctx = &ue_ctx->ecm_ctx; @@ -192,7 +214,7 @@ s1ap_nas_transport::handle_uplink_nas_transport(LIBLTE_S1AP_MESSAGE_UPLINKNASTRA //This can happen with integrity protected identity reponse messages if( !(msg_type == LIBLTE_MME_MSG_TYPE_IDENTITY_RESPONSE && sec_hdr_type == LIBLTE_MME_SECURITY_HDR_TYPE_INTEGRITY)) { - m_s1ap_log->warning("Uplink NAS: could not find security context for integrity protected message. MME-UE S1AP id: %lu\n",mme_ue_s1ap_id); + m_s1ap_log->warning("Uplink NAS: could not find security context for integrity protected message. MME-UE S1AP id: %d\n",mme_ue_s1ap_id); m_pool->deallocate(nas_msg); return false; } @@ -922,6 +944,31 @@ s1ap_nas_transport::handle_nas_detach_request(srslte::byte_buffer_t *nas_msg, ue return true; } +bool +s1ap_nas_transport::handle_nas_tracking_area_update_request(uint32_t m_tmsi, + uint32_t enb_ue_s1ap_id, + srslte::byte_buffer_t *nas_msg, + srslte::byte_buffer_t *reply_buffer, + bool* reply_flag, + struct sctp_sndrcvinfo *enb_sri) +{ + m_s1ap_log->console("Warning: Tracking area update requests are not handled yet.\n"); + m_s1ap_log->warning("Tracking area update requests are not handled yet.\n"); + + std::map::iterator it = m_s1ap->m_tmsi_to_imsi.find(m_tmsi); + if(it == m_s1ap->m_tmsi_to_imsi.end()) + { + m_s1ap_log->console("Could not find IMSI from M-TMSI. M-TMSI 0x%x\n", m_tmsi); + m_s1ap_log->error("Could not find IMSI from M-TMSI. M-TMSI 0x%x\n", m_tmsi); + return true; + } + ue_ctx_t *ue_ctx = m_s1ap->find_ue_ctx_from_imsi(it->second); + ue_emm_ctx_t *emm_ctx = &ue_ctx->emm_ctx; + ue_ecm_ctx_t *ecm_ctx = &ue_ctx->ecm_ctx; + + emm_ctx->security_ctxt.ul_nas_count++;//Increment the NAS count, not to break the security ctx + return true; +} bool s1ap_nas_transport::handle_nas_authentication_response(srslte::byte_buffer_t *nas_msg, ue_ctx_t *ue_ctx, srslte::byte_buffer_t *reply_buffer, bool* reply_flag) { @@ -1046,7 +1093,7 @@ s1ap_nas_transport::handle_nas_attach_complete(srslte::byte_buffer_t *nas_msg, u ue_emm_ctx_t *emm_ctx = &ue_ctx->emm_ctx; ue_ecm_ctx_t *ecm_ctx = &ue_ctx->ecm_ctx; - m_s1ap_log->console("Unpacked Attached Complete Message. IMSI %d\n", emm_ctx->imsi); + m_s1ap_log->console("Unpacked Attached Complete Message. IMSI %" PRIu64 "\n", emm_ctx->imsi); m_s1ap_log->console("Unpacked Activate Default EPS Bearer message. EPS Bearer id %d\n",act_bearer.eps_bearer_id); //ue_ctx->erabs_ctx[act_bearer->eps_bearer_id].enb_fteid; if(act_bearer.eps_bearer_id < 5 || act_bearer.eps_bearer_id > 15) @@ -1082,13 +1129,13 @@ s1ap_nas_transport::handle_esm_information_response(srslte::byte_buffer_t *nas_m m_s1ap_log->info("ESM Info: EPS bearer id %d\n",esm_info_resp.eps_bearer_id); if(esm_info_resp.apn_present) { - m_s1ap_log->info("ESM Info: APN %s\n",esm_info_resp.eps_bearer_id); - m_s1ap_log->console("ESM Info: APN %s\n",esm_info_resp.eps_bearer_id); + m_s1ap_log->info("ESM Info: APN %d\n",esm_info_resp.eps_bearer_id); + m_s1ap_log->console("ESM Info: APN %d\n",esm_info_resp.eps_bearer_id); } if(esm_info_resp.protocol_cnfg_opts_present) { - m_s1ap_log->info("ESM Info: %d Protocol Configuration Options %s\n",esm_info_resp.protocol_cnfg_opts.N_opts); - m_s1ap_log->console("ESM Info: %d Protocol Configuration Options %s\n",esm_info_resp.protocol_cnfg_opts.N_opts); + m_s1ap_log->info("ESM Info: %d Protocol Configuration Options\n",esm_info_resp.protocol_cnfg_opts.N_opts); + m_s1ap_log->console("ESM Info: %d Protocol Configuration Options\n",esm_info_resp.protocol_cnfg_opts.N_opts); } //FIXME The packging of GTP-C messages is not ready. diff --git a/srsepc/src/spgw/spgw.cc b/srsepc/src/spgw/spgw.cc index 191e131df..1ef33a8f0 100644 --- a/srsepc/src/spgw/spgw.cc +++ b/srsepc/src/spgw/spgw.cc @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/srsue/src/mac/proc_phr.cc b/srsue/src/mac/proc_phr.cc index 54c1ec1ce..3eb7c82f5 100644 --- a/srsue/src/mac/proc_phr.cc +++ b/srsue/src/mac/proc_phr.cc @@ -91,7 +91,7 @@ void phr_proc::timer_expired(uint32_t timer_id) { } else if (timer_id == timer_prohibit_id) { int pathloss_db = liblte_rrc_dl_pathloss_change_num[mac_cfg->main.phr_cnfg.dl_pathloss_change]; if (pathloss_changed()) { - Info("PHR: Triggered by pathloss difference. cur_pathloss_db=%f (timer expired)\n", last_pathloss_db); + Info("PHR: Triggered by pathloss difference. cur_pathloss_db=%d (timer expired)\n", last_pathloss_db); phr_is_triggered = true; } } else { @@ -132,7 +132,7 @@ void phr_proc::step(uint32_t tti) } if (pathloss_changed() && timers_db->get(timer_prohibit_id)->is_expired()) { - Info("PHR: Triggered by pathloss difference. cur_pathloss_db=%f\n", last_pathloss_db); + Info("PHR: Triggered by pathloss difference. cur_pathloss_db=%d\n", last_pathloss_db); phr_is_triggered = true; } } diff --git a/srsue/src/main.cc b/srsue/src/main.cc index 8753e7630..30a3e3b00 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -484,8 +484,7 @@ int main(int argc, char *argv[]) plot_started = true; } } - ue->print_pool(); - sleep(10); + sleep(1); } pthread_cancel(input); metricshub.stop(); diff --git a/srsue/src/phy/phch_recv.cc b/srsue/src/phy/phch_recv.cc index 0df792fd5..49b0af307 100644 --- a/srsue/src/phy/phch_recv.cc +++ b/srsue/src/phy/phch_recv.cc @@ -275,7 +275,7 @@ void phch_recv::cell_search_inc() phy_state = IDLE; rrc->earfcn_end(); } else { - Info("SYNC: Cell Search idx %d/%d\n", cur_earfcn_index, earfcn.size()); + Info("SYNC: Cell Search idx %d/%zu\n", cur_earfcn_index, earfcn.size()); if (current_earfcn != earfcn[cur_earfcn_index]) { current_earfcn = earfcn[cur_earfcn_index]; set_frequency(); @@ -297,7 +297,7 @@ void phch_recv::cell_search_start() { Warning("SYNC: Can't start cell search procedure while camping on cell\n"); } else { if (earfcn.size() > 0) { - Info("SYNC: Starting Cell Search procedure in %d EARFCNs...\n", earfcn.size()); + Info("SYNC: Starting Cell Search procedure in %zu EARFCNs...\n", earfcn.size()); cell_search_next(true); } else { Info("SYNC: Empty EARFCN list. Stopping cell search...\n"); @@ -1198,7 +1198,7 @@ phch_recv::measure::ret_code phch_recv::measure::run_subframe(uint32_t sf_idx) } cnt++; - log_h->debug("SYNC: Measuring RSRP %d/%d, sf_idx=%d, RSRP=%.1f dBm, corr-RSRP=%.1f dBm, SNR=%.1f dB\n", + log_h->debug("SYNC: Measuring RSRP %d/%d, sf_idx=%d, RSRP=%.1f dBm, SNR=%.1f dB\n", cnt, nof_subframes, sf_idx, rsrp, snr); if (cnt >= nof_subframes) { @@ -1502,7 +1502,7 @@ void phch_recv::intra_measure::rem_cell(int pci) { if (active_pci.size() == 0) { receive_enabled = false; } - Info("INTRA: Stopping intra-frequency measurement for pci=%d. Number of cells: %d\n", pci, active_pci.size()); + Info("INTRA: Stopping intra-frequency measurement for pci=%d. Number of cells: %zu\n", pci, active_pci.size()); } else { Warning("INTRA: Requested to stop non-existing intra-frequency measurement for PCI=%d\n", pci); } diff --git a/srsue/src/phy/prach.cc b/srsue/src/phy/prach.cc index fdf925642..a1bf96c85 100644 --- a/srsue/src/phy/prach.cc +++ b/srsue/src/phy/prach.cc @@ -201,7 +201,7 @@ void prach::send(srslte::radio *radio_handler, float cfo, float pathloss, srslte float scale = sqrtf(pow(10,tx_power/10)/digital_power); srslte_vec_sc_prod_cfc(signal_buffer, scale, signal_buffer, len); - log_h->console("PRACH: Pathloss=%.2f dB, Target power %.2f dBm, TX_power %.2f dBm, TX_gain %.1f dB\n", + log_h->console("PRACH: Pathloss=%.2f dB, Target power %.2f dBm, TX_power %.2f dBm, TX_gain %.1f dB, scale %.2f\n", pathloss, target_power_dbm, tx_power, radio_handler->get_tx_gain(), scale); } else { diff --git a/srsue/src/ue_base.cc b/srsue/src/ue_base.cc index a4264a099..71430fc9f 100644 --- a/srsue/src/ue_base.cc +++ b/srsue/src/ue_base.cc @@ -104,7 +104,7 @@ void ue_base::handle_rf_msg(srslte_rf_error_t error) str.erase(std::remove(str.begin(), str.end(), '\n'), str.end()); str.erase(std::remove(str.begin(), str.end(), '\r'), str.end()); str.push_back('\n'); - rf_log.info(str); + rf_log.info(str.c_str()); } } diff --git a/srsue/src/upper/nas.cc b/srsue/src/upper/nas.cc index 939db1686..5b7f40920 100644 --- a/srsue/src/upper/nas.cc +++ b/srsue/src/upper/nas.cc @@ -682,7 +682,7 @@ void nas::parse_identity_request(uint32_t lcid, byte_buffer_t *pdu) { usim->get_imei_vec(id_resp.mobile_id.imei, 15); break; default: - nas_log->error("Unhandled ID type: %d\n"); + nas_log->error("Unhandled ID type: %d\n", id_req.id_type); pool->deallocate(pdu); return; } diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index e419ea710..53e85fac8 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -30,6 +30,7 @@ #include #include #include +#include // for printing uint64_t #include #include "upper/rrc.h" #include "srslte/asn1/liblte_rrc.h" @@ -528,7 +529,7 @@ void rrc::set_serving_cell(uint32_t cell_idx) { // Set new serving cell serving_cell = new_serving_cell; - rrc_log->info("Setting serving cell idx=%d, earfcn=%d, PCI=%d, nof_neighbours=%d\n", + rrc_log->info("Setting serving cell idx=%d, earfcn=%d, PCI=%d, nof_neighbours=%zd\n", cell_idx, serving_cell->get_earfcn(), serving_cell->phy_cell.id, neighbour_cells.size()); } else { @@ -751,7 +752,7 @@ bool rrc::add_neighbour_cell(cell_t *new_cell) { if (ret) { neighbour_cells.push_back(new_cell); } - rrc_log->info("Added neighbour cell EARFCN=%d, PCI=%d, nof_neighbours=%d\n", + rrc_log->info("Added neighbour cell EARFCN=%d, PCI=%d, nof_neighbours=%zd\n", new_cell->get_earfcn(), new_cell->get_pci(), neighbour_cells.size()); sort_neighbour_cells(); return ret; @@ -1634,7 +1635,7 @@ void rrc::send_ul_ccch_msg() ue_cri_ptr[nbytes - i - 1] = pdu->msg[i]; } - rrc_log->debug("Setting UE contention resolution ID: %d\n", uecri); + rrc_log->debug("Setting UE contention resolution ID: %" PRIu64 "\n", uecri); mac->set_contention_id(uecri); rrc_log->info("Sending %s\n", liblte_rrc_ul_ccch_msg_type_text[ul_ccch_msg.msg_type]); @@ -1680,7 +1681,7 @@ void rrc::write_pdu(uint32_t lcid, byte_buffer_t *pdu) { parse_dl_dcch(lcid, pdu); break; default: - rrc_log->error("RX PDU with invalid bearer id: %s", lcid); + rrc_log->error("RX PDU with invalid bearer id: %d", lcid); break; } } @@ -2891,8 +2892,8 @@ void rrc::rrc_meas::parse_meas_config(LIBLTE_RRC_MEAS_CONFIG_STRUCT *cfg) log_h->info("MEAS: Added measObjectId=%d, earfcn=%d, q_offset=%f, pci=%d, offset_cell=%f\n", cfg->meas_obj_to_add_mod_list.meas_obj_list[i].meas_obj_id, dst_obj->earfcn, dst_obj->q_offset, - dst_obj->cells[src_obj->cells_to_add_mod_list[j].cell_idx].q_offset, - dst_obj->cells[src_obj->cells_to_add_mod_list[j].cell_idx].pci); + dst_obj->cells[src_obj->cells_to_add_mod_list[j].cell_idx].pci, + dst_obj->cells[src_obj->cells_to_add_mod_list[j].cell_idx].q_offset); } @@ -2973,7 +2974,7 @@ void rrc::rrc_meas::parse_meas_config(LIBLTE_RRC_MEAS_CONFIG_STRUCT *cfg) remove_meas_id(cfg->meas_id_to_remove_list[i]); } - log_h->info("nof active measId=%d\n", active.size()); + log_h->info("nof active measId=%zd\n", active.size()); // Measurement identity addition/modification 5.5.2.3 if (cfg->meas_id_to_add_mod_list_present) { @@ -2992,7 +2993,7 @@ void rrc::rrc_meas::parse_meas_config(LIBLTE_RRC_MEAS_CONFIG_STRUCT *cfg) } active[measId->meas_id].object_id = measId->meas_obj_id; active[measId->meas_id].report_id = measId->rep_cnfg_id; - log_h->info("MEAS: %s measId=%d, measObjectId=%d, reportConfigId=%d, timer_id=%d, nof_values=%d\n", + log_h->info("MEAS: %s measId=%d, measObjectId=%d, reportConfigId=%d, timer_id=%d, nof_values=%zd\n", is_new?"Added":"Updated", measId->meas_id, measId->meas_obj_id, measId->rep_cnfg_id, active[measId->meas_id].periodic_timer, active[measId->meas_id].cell_values.size()); } diff --git a/srsue/src/upper/usim.cc b/srsue/src/upper/usim.cc index b9f4fda0e..d344734ba 100644 --- a/srsue/src/upper/usim.cc +++ b/srsue/src/upper/usim.cc @@ -49,8 +49,8 @@ void usim::init(usim_args_t *args, srslte::log *usim_log_) if(32 == args->op.length()) { str_to_hex(args->op, op); } else { - usim_log->error("Invalid length for OP: %d should be %d", args->op.length(), 32); - usim_log->console("Invalid length for OP: %d should be %d", args->op.length(), 32); + usim_log->error("Invalid length for OP: %zu should be %d", args->op.length(), 32); + usim_log->console("Invalid length for OP: %zu should be %d", args->op.length(), 32); } if(15 == args->imsi.length()) { @@ -61,8 +61,8 @@ void usim::init(usim_args_t *args, srslte::log *usim_log_) imsi += imsi_c[i] - '0'; } } else { - usim_log->error("Invalid length for ISMI: %d should be %d", args->imsi.length(), 15); - usim_log->console("Invalid length for IMSI: %d should be %d", args->imsi.length(), 15); + usim_log->error("Invalid length for ISMI: %zu should be %d", args->imsi.length(), 15); + usim_log->console("Invalid length for IMSI: %zu should be %d", args->imsi.length(), 15); } if(15 == args->imei.length()) { @@ -73,15 +73,15 @@ void usim::init(usim_args_t *args, srslte::log *usim_log_) imei += imei_c[i] - '0'; } } else { - usim_log->error("Invalid length for IMEI: %d should be %d", args->imei.length(), 15); - usim_log->console("Invalid length for IMEI: %d should be %d", args->imei.length(), 15); + usim_log->error("Invalid length for IMEI: %zu should be %d", args->imei.length(), 15); + usim_log->console("Invalid length for IMEI: %zu should be %d", args->imei.length(), 15); } if(32 == args->k.length()) { str_to_hex(args->k, k); } else { - usim_log->error("Invalid length for K: %d should be %d", args->k.length(), 32); - usim_log->console("Invalid length for K: %d should be %d", args->k.length(), 32); + usim_log->error("Invalid length for K: %zu should be %d", args->k.length(), 32); + usim_log->console("Invalid length for K: %zu should be %d", args->k.length(), 32); } auth_algo = auth_algo_milenage;