From 7cdc012bb27564a35ca9f16ec7b89a224474b673 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Fri, 12 Apr 2019 17:33:26 +0000 Subject: [PATCH] Printing fixes in the EPC for ARM --- srsepc/src/mme/mme_gtpc.cc | 6 +++--- srsepc/src/mme/s1ap_paging.cc | 3 ++- srsepc/src/spgw/gtpc.cc | 22 +++++++++++----------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/srsepc/src/mme/mme_gtpc.cc b/srsepc/src/mme/mme_gtpc.cc index bf83d30fa..c80d89645 100644 --- a/srsepc/src/mme/mme_gtpc.cc +++ b/srsepc/src/mme/mme_gtpc.cc @@ -292,7 +292,7 @@ bool mme_gtpc::handle_create_session_response(srslte::gtpc_pdu* cs_resp_pdu) // Save create session response info to E-RAB context nas* nas_ctx = m_s1ap->find_nas_ctx_from_imsi(imsi); if (nas_ctx == NULL) { - m_mme_gtpc_log->error("Could not find UE context. IMSI %015lu\n", imsi); + m_mme_gtpc_log->error("Could not find UE context. IMSI %015" PRIu64 "\n", imsi); return false; } emm_ctx_t* emm_ctx = &nas_ctx->m_emm_ctx; @@ -300,7 +300,7 @@ bool mme_gtpc::handle_create_session_response(srslte::gtpc_pdu* cs_resp_pdu) // Save UE IP to nas ctxt emm_ctx->ue_ip.s_addr = cs_resp->paa.ipv4; - m_mme_gtpc_log->console("SPGW Allocated IP %s to IMSI %015lu\n", inet_ntoa(emm_ctx->ue_ip), emm_ctx->imsi); + m_mme_gtpc_log->console("SPGW Allocated IP %s to IMSI %015" PRIu64 "\n", inet_ntoa(emm_ctx->ue_ip), emm_ctx->imsi); // Save SGW ctrl F-TEID in GTP-C context std::map::iterator it_g = m_imsi_to_gtpc_ctx.find(imsi); @@ -454,7 +454,7 @@ bool mme_gtpc::handle_downlink_data_notification(srslte::gtpc_pdu* dl_not_pdu) return false; } uint8_t ebi = dl_not->eps_bearer_id; - m_mme_gtpc_log->debug("Downlink Data Notification -- IMSI: %lu, EBI %d\n", imsi_it->second, ebi); + m_mme_gtpc_log->debug("Downlink Data Notification -- IMSI: %015" PRIu64 ", EBI %d\n", imsi_it->second, ebi); m_s1ap->send_paging(imsi_it->second, ebi); return true; diff --git a/srsepc/src/mme/s1ap_paging.cc b/srsepc/src/mme/s1ap_paging.cc index a8687171e..a26dc0be6 100644 --- a/srsepc/src/mme/s1ap_paging.cc +++ b/srsepc/src/mme/s1ap_paging.cc @@ -28,6 +28,7 @@ #include "srsepc/hdr/mme/s1ap.h" #include "srslte/common/bcd_helpers.h" #include "srslte/common/int_helpers.h" +#include // for printing uint64_t namespace srsepc { @@ -75,7 +76,7 @@ void s1ap_paging::init(void) bool s1ap_paging::send_paging(uint64_t imsi, uint16_t erab_to_setup) { - m_s1ap_log->info("Preparing to Page UE -- IMSI %lu\n", imsi); + m_s1ap_log->info("Preparing to Page UE -- IMSI %015" PRIu64 "\n", imsi); // Prepare reply PDU LIBLTE_S1AP_S1AP_PDU_STRUCT pdu; diff --git a/srsepc/src/spgw/gtpc.cc b/srsepc/src/spgw/gtpc.cc index ba3a06cfc..bf86faef6 100644 --- a/srsepc/src/spgw/gtpc.cc +++ b/srsepc/src/spgw/gtpc.cc @@ -96,8 +96,8 @@ void spgw::gtpc::stop() { std::map::iterator it = m_teid_to_tunnel_ctx.begin(); while (it != m_teid_to_tunnel_ctx.end()) { - m_gtpc_log->info("Deleting SP-GW GTP-C Tunnel. IMSI: %lu\n", it->second->imsi); - m_gtpc_log->console("Deleting SP-GW GTP-C Tunnel. IMSI: %lu\n", it->second->imsi); + m_gtpc_log->info("Deleting SP-GW GTP-C Tunnel. IMSI: %015" PRIu64 "\n", it->second->imsi); + m_gtpc_log->console("Deleting SP-GW GTP-C Tunnel. IMSI: %015" PRIu64 "\n", it->second->imsi); delete it->second; m_teid_to_tunnel_ctx.erase(it++); } @@ -142,7 +142,7 @@ srslte::error_t spgw::gtpc::init_s11(spgw_args_t* args) bool spgw::gtpc::send_s11_pdu(const srslte::gtpc_pdu& pdu) { - m_gtpc_log->debug("SPGW Sending S11 PDU! N_Bytes: %lu\n", sizeof(pdu)); + m_gtpc_log->debug("SPGW Sending S11 PDU! N_Bytes: %zd\n", sizeof(pdu)); // FIXME add serialization code here // Send S11 message to MME @@ -196,7 +196,7 @@ void spgw::gtpc::handle_create_session_request(const struct srslte::gtpc_create_ // Check if IMSI has active GTP-C and/or GTP-U bool gtpc_present = m_imsi_to_ctr_teid.count(cs_req.imsi); if (gtpc_present) { - m_gtpc_log->console("SPGW: GTP-C context for IMSI %015lu already exists.\n", cs_req.imsi); + m_gtpc_log->console("SPGW: GTP-C context for IMSI %015" PRIu64 " already exists.\n", cs_req.imsi); delete_gtpc_ctx(m_imsi_to_ctr_teid[cs_req.imsi]); m_gtpc_log->console("SPGW: Deleted previous context.\n"); } @@ -262,7 +262,7 @@ void spgw::gtpc::handle_modify_bearer_request(const struct srslte::gtpc_header& m_gtpc_log->info("Setting Up GTP-U tunnel. Tunnel info: \n"); struct in_addr addr; addr.s_addr = tunnel_ctx->ue_ipv4; - m_gtpc_log->info("IMSI: %lu, UE IP: %s \n", tunnel_ctx->imsi, inet_ntoa(addr)); + m_gtpc_log->info("IMSI: %015" PRIu64 ", UE IP: %s \n", tunnel_ctx->imsi, inet_ntoa(addr)); m_gtpc_log->info("S-GW Rx Ctrl TEID 0x%x, MME Rx Ctrl TEID 0x%x\n", tunnel_ctx->up_ctrl_fteid.teid, tunnel_ctx->dw_ctrl_fteid.teid); m_gtpc_log->info("S-GW Rx Ctrl IP (NA), MME Rx Ctrl IP (NA)\n"); @@ -366,7 +366,7 @@ bool spgw::gtpc::send_downlink_data_notification(uint32_t spgw_ctr_teid) tunnel_ctx->paging_pending = true; m_gtpc_log->console("Found UE for Downlink Notification \n"); - m_gtpc_log->console("MME Ctr TEID 0x%x, IMSI: %lu\n", tunnel_ctx->dw_ctrl_fteid.teid, tunnel_ctx->imsi); + m_gtpc_log->console("MME Ctr TEID 0x%x, IMSI: %015" PRIu64 "\n", tunnel_ctx->dw_ctrl_fteid.teid, tunnel_ctx->imsi); // Setup GTP-C header header->piggyback = false; @@ -514,10 +514,10 @@ bool spgw::gtpc::queue_downlink_packet(uint32_t ctrl_teid, srslte::byte_buffer_t if (tunnel_ctx->paging_queue.size() < m_max_paging_queue) { tunnel_ctx->paging_queue.push(msg); - m_gtpc_log->debug("Queued packet. IMSI %" PRIu64 ", Packets in Queue %lu\n", tunnel_ctx->imsi, + m_gtpc_log->debug("Queued packet. IMSI %" PRIu64 ", Packets in Queue %zd\n", tunnel_ctx->imsi, tunnel_ctx->paging_queue.size()); } else { - m_gtpc_log->warning("Paging queue full. IMSI %" PRIu64 ", Packets in Queue %lu\n", tunnel_ctx->imsi, + m_gtpc_log->warning("Paging queue full. IMSI %" PRIu64 ", Packets in Queue %zd\n", tunnel_ctx->imsi, tunnel_ctx->paging_queue.size()); m_pool->deallocate(msg); } @@ -545,7 +545,7 @@ srslte::error_t spgw::gtpc::init_ue_ip(spgw_args_t* args, const std::maperror("SPGW: static ip addr %s for imsi %lu, is reserved for the epc tun interface\n", + m_gtpc_log->error("SPGW: static ip addr %s for imsi %015" PRIu64 ", is reserved for the epc tun interface\n", iter->first.c_str(), iter->second); return srslte::ERROR_OUT_OF_BOUNDS; } @@ -555,7 +555,7 @@ srslte::error_t spgw::gtpc::init_ue_ip(spgw_args_t* args, const std::mapfirst.c_str()); if (!m_imsi_to_ip.insert(std::make_pair(iter->second, in_addr)).second) { - m_gtpc_log->error("SPGW: duplicate imsi %lu for static ip address %s.\n", iter->second, iter->first.c_str()); + m_gtpc_log->error("SPGW: duplicate imsi %015" PRIu64 " for static ip address %s.\n", iter->second, iter->first.c_str()); return srslte::ERROR_OUT_OF_BOUNDS; } } @@ -568,7 +568,7 @@ srslte::error_t spgw::gtpc::init_ue_ip(spgw_args_t* args, const std::map::const_iterator iter = ip_to_imsi.find(inet_ntoa(ue_addr)); if (iter != ip_to_imsi.end()) { - m_gtpc_log->debug("SPGW: init_ue_ip ue ip addr %s is reserved for imsi %lu, not adding to pool\n", + m_gtpc_log->debug("SPGW: init_ue_ip ue ip addr %s is reserved for imsi %015" PRIu64 ", not adding to pool\n", iter->first.c_str(), iter->second); } else { m_ue_ip_addr_pool.insert(ue_addr.s_addr);