@@ -2650,9 +2650,37 @@ extern void uITRON4_free(void *p) ;
26502650 void * z_realloc (void * ptr , size_t size );
26512651 #define realloc z_realloc
26522652
2653+ #if KERNEL_VERSION_NUMBER >= 0x40100
2654+ /* Zephyr >= 4.1 removed CONFIG_NET_SOCKETS_POSIX_NAMES and the
2655+ * corresponding macro block in <zephyr/net/socket.h>.
2656+ * Define our own compile-time remapping to zsock_* so that wolfSSL
2657+ * always calls Zephyr's network stack directly, avoiding host-libc
2658+ * symbol conflicts on native_sim. */
2659+ #define socket zsock_socket
2660+ #define bind zsock_bind
2661+ #define connect zsock_connect
2662+ #define listen zsock_listen
2663+ #define accept zsock_accept
2664+ #define send zsock_send
2665+ #define recv zsock_recv
2666+ #define sendto zsock_sendto
2667+ #define recvfrom zsock_recvfrom
2668+ #define setsockopt zsock_setsockopt
2669+ #define getsockopt zsock_getsockopt
2670+ #define shutdown zsock_shutdown
2671+ #define close zsock_close
2672+ #define poll zsock_poll
2673+ #define getpeername zsock_getpeername
2674+ #define getsockname zsock_getsockname
2675+ #define inet_pton zsock_inet_pton
2676+ #define inet_ntop zsock_inet_ntop
2677+ #else
2678+ /* Zephyr < 4.1: define CONFIG_NET_SOCKETS_POSIX_NAMES so that
2679+ * <net/socket.h> provides the POSIX name remapping macros. */
26532680 #if !defined(CONFIG_NET_SOCKETS_POSIX_NAMES ) && !defined(CONFIG_POSIX_API )
26542681 #define CONFIG_NET_SOCKETS_POSIX_NAMES
26552682 #endif
2683+ #endif
26562684#endif /* WOLFSSL_ZEPHYR */
26572685
26582686#ifdef WOLFSSL_IMX6
0 commit comments