diff --git a/srsenb/src/stack/upper/gtpu.cc b/srsenb/src/stack/upper/gtpu.cc index e6fe14b8b..3119e2778 100644 --- a/srsenb/src/stack/upper/gtpu.cc +++ b/srsenb/src/stack/upper/gtpu.cc @@ -12,6 +12,7 @@ #include "srslte/upper/gtpu.h" #include "srsenb/hdr/stack/upper/gtpu.h" #include "srslte/common/network_utils.h" +#include "srslte/common/string_helpers.h" #include "srslte/interfaces/enb_interfaces.h" #include "srslte/interfaces/enb_pdcp_interfaces.h" #include @@ -153,14 +154,14 @@ uint32_t gtpu::add_bearer(uint16_t rnti, uint32_t lcid, uint32_t addr, uint32_t ue_teidin_db[rnti][lcid].push_back(teid_in); - fmt::memory_buffer buffer; - srslte::gtpu_ntoa(buffer, htonl(addr)); + fmt::memory_buffer str_buffer; + srslte::gtpu_ntoa(str_buffer, htonl(addr)); logger.info("New tunnel teid_in=0x%x, teid_out=0x%x, rnti=0x%x, lcid=%d, addr=%s", teid_in, teid_out, rnti, lcid, - buffer.data()); + srslte::to_c_str(str_buffer)); if (props != nullptr) { if (props->flush_before_teidin_present) { @@ -534,14 +535,14 @@ void gtpu::log_message(tunnel& tun, bool is_rx, srslte::span pdu, int p srslte::gtpu_ntoa(addrbuf, htonl(tun.spgw_addr)); if (is_rx) { dir = "Rx"; - fmt::format_to(strbuf2, "{}:0x{:0x} > ", addrbuf.data(), tun.teid_in); + fmt::format_to(strbuf2, "{}:0x{:0x} > ", srslte::to_c_str(addrbuf), tun.teid_in); if (not tun.dl_enabled) { fmt::format_to(strbuf2, "DL (buffered), "); } else if (tun.fwd_teid_in_present) { tunnel& tx_tun = tunnels.at(tun.fwd_teid_in); addrbuf.clear(); srslte::gtpu_ntoa(addrbuf, htonl(tx_tun.spgw_addr)); - fmt::format_to(strbuf2, "{}:0x{:0x} (forwarded), ", addrbuf.data(), tx_tun.teid_in); + fmt::format_to(strbuf2, "{}:0x{:0x} (forwarded), ", srslte::to_c_str(addrbuf), tx_tun.teid_in); } else { fmt::format_to(strbuf2, "DL, "); } @@ -551,7 +552,7 @@ void gtpu::log_message(tunnel& tun, bool is_rx, srslte::span pdu, int p } else { fmt::format_to(strbuf2, "UL "); } - fmt::format_to(strbuf2, "> {}:0x{:0x}, ", addrbuf.data(), tun.teid_in); + fmt::format_to(strbuf2, "> {}:0x{:0x}, ", srslte::to_c_str(addrbuf), tun.teid_in); } fmt::format_to(strbuf, "{} S1-U SDU, {}rnti=0x{:0x}, lcid={}, n_bytes={}, IPv{}", @@ -566,12 +567,12 @@ void gtpu::log_message(tunnel& tun, bool is_rx, srslte::span pdu, int p strbuf2.clear(); srslte::gtpu_ntoa(addrbuf, ip_pkt->saddr); srslte::gtpu_ntoa(strbuf2, ip_pkt->daddr); - fmt::format_to(strbuf, " {} > {}", addrbuf.data(), strbuf2.data()); + fmt::format_to(strbuf, " {} > {}", srslte::to_c_str(addrbuf), srslte::to_c_str(strbuf2)); if (ntohs(ip_pkt->tot_len) != pdu.size()) { logger.error("IP Len and PDU N_bytes mismatch"); } } - logger.info(pdu.data(), pdu.size(), "%s", strbuf.data()); + logger.info(pdu.data(), pdu.size(), "%s", srslte::to_c_str(strbuf)); } /**************************************************************************** diff --git a/srsepc/src/spgw/gtpu.cc b/srsepc/src/spgw/gtpu.cc index 5a2366f5e..06772f44a 100644 --- a/srsepc/src/spgw/gtpu.cc +++ b/srsepc/src/spgw/gtpu.cc @@ -12,6 +12,7 @@ #include "srsepc/hdr/spgw/gtpu.h" #include "srsepc/hdr/mme/mme_gtpc.h" +#include "srslte/common/string_helpers.h" #include "srslte/upper/gtpu.h" #include #include @@ -208,10 +209,10 @@ void spgw::gtpu::handle_sgi_pdu(srslte::unique_byte_buffer_t msg) m_logger.debug("SGi PDU -- IP version %d, Total length %d", int(iph->version), ntohs(iph->tot_len)); fmt::memory_buffer buffer; srslte::gtpu_ntoa(buffer, iph->saddr); - m_logger.debug("SGi PDU -- IP src addr %s", buffer.data()); + m_logger.debug("SGi PDU -- IP src addr %s", srslte::to_c_str(buffer)); buffer.clear(); srslte::gtpu_ntoa(buffer, iph->daddr); - m_logger.debug("SGi PDU -- IP dst addr %s", buffer.data()); + m_logger.debug("SGi PDU -- IP dst addr %s", srslte::to_c_str(buffer)); // Find user and control tunnel gtpu_fteid_it = m_ip_to_usr_teid.find(iph->daddr); @@ -315,10 +316,10 @@ bool spgw::gtpu::modify_gtpu_tunnel(in_addr_t ue_ipv4, srslte::gtpc_f_teid_ie dw m_logger.info("Modifying GTP-U Tunnel."); fmt::memory_buffer buffer; srslte::gtpu_ntoa(buffer, ue_ipv4); - m_logger.info("UE IP %s", buffer.data()); + m_logger.info("UE IP %s", srslte::to_c_str(buffer)); buffer.clear(); srslte::gtpu_ntoa(buffer, dw_user_fteid.ipv4); - m_logger.info("Downlink eNB addr %s, U-TEID 0x%x", buffer.data(), dw_user_fteid.teid); + m_logger.info("Downlink eNB addr %s, U-TEID 0x%x", srslte::to_c_str(buffer), dw_user_fteid.teid); m_logger.info("Uplink C-TEID: 0x%x", up_ctrl_teid); m_ip_to_usr_teid[ue_ipv4] = dw_user_fteid; m_ip_to_ctr_teid[ue_ipv4] = up_ctrl_teid;