io.c: use the zsock names on Zephyr 4.1 and newer

Zephyr 4.1 dropped CONFIG_NET_SOCKETS_POSIX_NAMES, and from 4.4 the
POSIX aliases in <zephyr/net/socket.h> need a compat mode wolfSSH does
not set, so wsEmbedSend() and wsEmbedRecv() no longer found send() and
recv(). Call zsock_send() and zsock_recv(), which Zephyr declares in
every configuration, and include <zephyr/version.h> for the test.
pull/1268/head
John Safranek 2026-09-18 13:46:35 -07:00 committed by philljj
parent 45e0007349
commit edbe117c92
1 changed files with 10 additions and 0 deletions

View File

@ -142,6 +142,7 @@ void* wolfSSH_GetIOWriteCtx(WOLFSSH* ssh)
#include <errno.h>
#elif defined(WOLFSSH_ZEPHYR)
#include <zephyr/net/socket.h>
#include <zephyr/version.h>
#else
#include <sys/types.h>
#include <errno.h>
@ -258,6 +259,15 @@ void* wolfSSH_GetIOWriteCtx(WOLFSSH* ssh)
#elif defined(WOLFSSL_NUCLEUS)
#define SEND_FUNCTION NU_Send
#define RECV_FUNCTION NU_Recv
#elif defined(WOLFSSH_ZEPHYR)
#if KERNEL_VERSION_NUMBER >= 0x40100
/* Zephyr 4.1 dropped the POSIX socket names; zsock_ is always there. */
#define SEND_FUNCTION zsock_send
#define RECV_FUNCTION zsock_recv
#else
#define SEND_FUNCTION send
#define RECV_FUNCTION recv
#endif
#else
#define SEND_FUNCTION send
#define RECV_FUNCTION recv