From b1c5bf7185990c6a7a058a9fdbfab44c22d106b3 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Thu, 16 Jan 2020 12:56:49 +0100 Subject: [PATCH] reverse addrv4 packing in s1ap --- srsenb/src/stack/upper/s1ap.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/srsenb/src/stack/upper/s1ap.cc b/srsenb/src/stack/upper/s1ap.cc index 315355df9..631863eca 100644 --- a/srsenb/src/stack/upper/s1ap.cc +++ b/srsenb/src/stack/upper/s1ap.cc @@ -993,7 +993,10 @@ bool s1ap::send_initial_ctxt_setup_response(uint16_t rnti, const asn1::s1ap::ini item.transport_layer_address.resize(32); uint8_t addr[4]; inet_pton(AF_INET, args.gtp_bind_addr.c_str(), addr); - memcpy(item.transport_layer_address.data(), addr, 4); + for (uint32_t j = 0; j < 4; ++j) { + item.transport_layer_address.data()[j] = addr[3 - j]; + } + // memcpy(item.transport_layer_address.data(), addr, 4); } return sctp_send_s1ap_pdu(tx_pdu, rnti, "InitialContextSetupResponse"); @@ -1018,7 +1021,10 @@ bool s1ap::send_erab_setup_response(uint16_t rnti, const e_rab_setup_resp_s& res item.transport_layer_address.resize(32); uint8_t addr[4]; inet_pton(AF_INET, args.gtp_bind_addr.c_str(), addr); - memcpy(item.transport_layer_address.data(), addr, 4); + for (uint32_t j = 0; j < 4; ++j) { + item.transport_layer_address.data()[j] = addr[3 - j]; + } + // memcpy(item.transport_layer_address.data(), addr, 4); } }