From 7764c01400951ef3a7fa71d1a431594abca86cf4 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Sat, 13 Apr 2024 17:25:55 +0200 Subject: [PATCH 1/2] [nrf noup] zephyr: struct net_if_addr_ipv4: fix address access unicast is now a struct net_if_addr_ipv4, not net_if_addr. See 1b0f9e865e35a6b3e1ca8aad7a67f7cfbfc2e666. Signed-off-by: Gerard Marull-Paretas --- src/l2_packet/l2_packet_zephyr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/l2_packet/l2_packet_zephyr.c b/src/l2_packet/l2_packet_zephyr.c index dd253a9a9..d6ef1bd16 100644 --- a/src/l2_packet/l2_packet_zephyr.c +++ b/src/l2_packet/l2_packet_zephyr.c @@ -220,7 +220,7 @@ int l2_packet_get_ip_addr(struct l2_packet_data *l2, char *buf, size_t len) #ifdef CONFIG_NET_IPV4 char addr_buf[NET_IPV4_ADDR_LEN]; os_strlcpy(buf, net_addr_ntop(AF_INET, - &l2->iface->config.ip.ipv4->unicast[0].address.in_addr.s_addr, + &l2->iface->config.ip.ipv4->unicast[0].ipv4.address.in_addr.s_addr, addr_buf, sizeof(addr_buf)), len); return 0; #else From b6494baaae5ef02a30230786bb1e7eb415073848 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Tue, 16 Apr 2024 10:38:52 +0200 Subject: [PATCH 2/2] [nrf noup] utils: common: inet_ntoa is now provided by Zephyr So there's no need to provide an implementation. See 4edb9017c229c34d111ec77d3c9105f8e77448f5. Signed-off-by: Gerard Marull-Paretas --- src/utils/common.c | 10 ---------- src/utils/common.h | 4 +--- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/utils/common.c b/src/utils/common.c index 9db7ce32e..2c1275193 100644 --- a/src/utils/common.c +++ b/src/utils/common.c @@ -1302,13 +1302,3 @@ void forced_memzero(void *ptr, size_t len) if (len) forced_memzero_val = ((u8 *) ptr)[0]; } - -#ifdef CONFIG_ZEPHYR -#include -extern char *inet_ntoa(struct in_addr in) -{ - char addr[NET_IPV4_ADDR_LEN]; - - return net_addr_ntop(AF_INET, (const void *)&in, addr, NET_IPV4_ADDR_LEN); -} -#endif diff --git a/src/utils/common.h b/src/utils/common.h index 5cb80129c..40644ab60 100644 --- a/src/utils/common.h +++ b/src/utils/common.h @@ -557,9 +557,7 @@ void int_array_concat(int **res, const int *a); void int_array_sort_unique(int *a); void int_array_add_unique(int **res, int a); -#ifdef CONFIG_ZEPHYR -char *inet_ntoa(struct in_addr in); -#else +#ifndef CONFIG_ZEPHYR #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #endif