From b99fcdf28970ee833151ccb599bfd9dcfc8b5435 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 17 Apr 2025 10:55:18 +0200 Subject: [PATCH] fix IP address The following error was appearing when running LTE UE: inet_pton(): cannot convert -64.-74.0.2 to IPv4 network address The allocated address by the core actually is 192.182.0.2. On my host "char" is signed, leading to the above error (192 and 182 are seen as signed). Let's force "ip_addr" unsigned and everyone is happy. --- openair3/NAS/UE/ESM/esm_ebr_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c index 7a8de459e7..cec4c268bd 100644 --- a/openair3/NAS/UE/ESM/esm_ebr_context.c +++ b/openair3/NAS/UE/ESM/esm_ebr_context.c @@ -204,7 +204,7 @@ int esm_ebr_context_create( // etc case NET_PDN_TYPE_IPV4: { char ip[20]; - char *ip_addr = pdn->ip_addr; + unsigned char *ip_addr = (unsigned char *)pdn->ip_addr; snprintf(ip, sizeof(ip), "%d.%d.%d.%d", ip_addr[0], ip_addr[1], ip_addr[2], ip_addr[3]); const char *ifn = get_softmodem_params()->nsa ? "oaitun_nru" : "oaitun_ue"; char ifname[IFNAMSIZ];