net: sockets: Remove socket offloading interface
Instead of using a custom offloading interface, users can use `NET_SOCKET_REGISTER` macro to register custom socket API provider. This solution removes a limitation, that only one offloaded interface can be registered and that it cannot be used together with native IP stack. The only exception remainig are DNS releated operations - `getaddrinfo`/`freeaddrinfo`, which, when offloaded, have to be registered specifically. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
561973060e
commit
bea1093e62
8 changed files with 80 additions and 289 deletions
|
@ -39,9 +39,3 @@ networking devices, can easily integrate it with Zephyr.
|
||||||
|
|
||||||
See :zephyr_file:`drivers/wifi/simplelink/simplelink_sockets.c` for a sample
|
See :zephyr_file:`drivers/wifi/simplelink/simplelink_sockets.c` for a sample
|
||||||
implementation on how to integrate network offloading at socket level.
|
implementation on how to integrate network offloading at socket level.
|
||||||
|
|
||||||
API Reference
|
|
||||||
*************
|
|
||||||
|
|
||||||
.. doxygengroup:: socket_offload
|
|
||||||
:project: Zephyr
|
|
||||||
|
|
|
@ -507,10 +507,7 @@ int zsock_getaddrinfo(const char *host, const char *service,
|
||||||
* if :option:`CONFIG_NET_SOCKETS_POSIX_NAMES` is defined.
|
* if :option:`CONFIG_NET_SOCKETS_POSIX_NAMES` is defined.
|
||||||
* @endrst
|
* @endrst
|
||||||
*/
|
*/
|
||||||
static inline void zsock_freeaddrinfo(struct zsock_addrinfo *ai)
|
void zsock_freeaddrinfo(struct zsock_addrinfo *ai);
|
||||||
{
|
|
||||||
free(ai);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Convert zsock_getaddrinfo() error code to textual message
|
* @brief Convert zsock_getaddrinfo() error code to textual message
|
||||||
|
@ -564,7 +561,6 @@ int zsock_getnameinfo(const struct sockaddr *addr, socklen_t addrlen,
|
||||||
|
|
||||||
#define pollfd zsock_pollfd
|
#define pollfd zsock_pollfd
|
||||||
|
|
||||||
#if !defined(CONFIG_NET_SOCKETS_OFFLOAD)
|
|
||||||
static inline int socket(int family, int type, int proto)
|
static inline int socket(int family, int type, int proto)
|
||||||
{
|
{
|
||||||
return zsock_socket(family, type, proto);
|
return zsock_socket(family, type, proto);
|
||||||
|
@ -693,42 +689,12 @@ static inline int inet_pton(sa_family_t family, const char *src, void *dst)
|
||||||
return zsock_inet_pton(family, src, dst);
|
return zsock_inet_pton(family, src, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
static inline char *inet_ntop(sa_family_t family, const void *src, char *dst,
|
||||||
|
size_t size)
|
||||||
struct addrinfo {
|
|
||||||
int ai_flags;
|
|
||||||
int ai_family;
|
|
||||||
int ai_socktype;
|
|
||||||
int ai_protocol;
|
|
||||||
socklen_t ai_addrlen;
|
|
||||||
struct sockaddr *ai_addr;
|
|
||||||
char *ai_canonname;
|
|
||||||
struct addrinfo *ai_next;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Legacy case: retain containing extern "C" with C++
|
|
||||||
*
|
|
||||||
* This header requires aliases defined within this file, and can't
|
|
||||||
* easily be moved to the top.
|
|
||||||
*/
|
|
||||||
#include <net/socket_offload.h>
|
|
||||||
|
|
||||||
static inline int inet_pton(sa_family_t family, const char *src, void *dst)
|
|
||||||
{
|
{
|
||||||
if ((family != AF_INET) && (family != AF_INET6)) {
|
return zsock_inet_ntop(family, src, dst, size);
|
||||||
errno = EAFNOSUPPORT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (net_addr_pton(family, src, dst) == 0) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !defined(CONFIG_NET_SOCKETS_OFFLOAD) */
|
|
||||||
|
|
||||||
#define POLLIN ZSOCK_POLLIN
|
#define POLLIN ZSOCK_POLLIN
|
||||||
#define POLLOUT ZSOCK_POLLOUT
|
#define POLLOUT ZSOCK_POLLOUT
|
||||||
#define POLLERR ZSOCK_POLLERR
|
#define POLLERR ZSOCK_POLLERR
|
||||||
|
@ -742,12 +708,6 @@ static inline int inet_pton(sa_family_t family, const char *src, void *dst)
|
||||||
#define SHUT_WR ZSOCK_SHUT_WR
|
#define SHUT_WR ZSOCK_SHUT_WR
|
||||||
#define SHUT_RDWR ZSOCK_SHUT_RDWR
|
#define SHUT_RDWR ZSOCK_SHUT_RDWR
|
||||||
|
|
||||||
static inline char *inet_ntop(sa_family_t family, const void *src, char *dst,
|
|
||||||
size_t size)
|
|
||||||
{
|
|
||||||
return zsock_inet_ntop(family, src, dst, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define EAI_BADFLAGS DNS_EAI_BADFLAGS
|
#define EAI_BADFLAGS DNS_EAI_BADFLAGS
|
||||||
#define EAI_NONAME DNS_EAI_NONAME
|
#define EAI_NONAME DNS_EAI_NONAME
|
||||||
#define EAI_AGAIN DNS_EAI_AGAIN
|
#define EAI_AGAIN DNS_EAI_AGAIN
|
||||||
|
|
|
@ -12,153 +12,38 @@
|
||||||
#ifndef ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_
|
#ifndef ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_
|
||||||
#define ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_
|
#define ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_H_
|
||||||
|
|
||||||
#include <net/socket_offload_ops.h>
|
#include <net/net_ip.h>
|
||||||
|
#include <net/socket.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const struct socket_offload *socket_ops;
|
/**
|
||||||
|
* @brief An offloaded Socket DNS API interface
|
||||||
|
*
|
||||||
|
* It is assumed that these offload functions follow the
|
||||||
|
* POSIX socket API standard for arguments, return values and setting of errno.
|
||||||
|
*/
|
||||||
|
struct socket_dns_offload {
|
||||||
|
int (*getaddrinfo)(const char *node, const char *service,
|
||||||
|
const struct zsock_addrinfo *hints,
|
||||||
|
struct zsock_addrinfo **res);
|
||||||
|
void (*freeaddrinfo)(struct zsock_addrinfo *res);
|
||||||
|
};
|
||||||
|
|
||||||
static inline int socket(int family, int type, int proto)
|
/**
|
||||||
{
|
* @brief Register an offloaded socket DNS API interface.
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
*
|
||||||
__ASSERT_NO_MSG(socket_ops->socket);
|
* @param ops A pointer to the offloaded socket DNS API interface.
|
||||||
|
*/
|
||||||
|
void socket_offload_dns_register(const struct socket_dns_offload *ops);
|
||||||
|
|
||||||
return socket_ops->socket(family, type, proto);
|
int socket_offload_getaddrinfo(const char *node, const char *service,
|
||||||
}
|
const struct zsock_addrinfo *hints,
|
||||||
|
struct zsock_addrinfo **res);
|
||||||
|
|
||||||
static inline int close(int sock)
|
void socket_offload_freeaddrinfo(struct zsock_addrinfo *res);
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->close);
|
|
||||||
|
|
||||||
return socket_ops->close(sock);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int accept(int sock, struct sockaddr *addr,
|
|
||||||
socklen_t *addrlen)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->accept);
|
|
||||||
|
|
||||||
return socket_ops->accept(sock, addr, addrlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static inline int bind(int sock, const struct sockaddr *addr,
|
|
||||||
socklen_t addrlen)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->bind);
|
|
||||||
|
|
||||||
return socket_ops->bind(sock, addr, addrlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int listen(int sock, int backlog)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->listen);
|
|
||||||
|
|
||||||
return socket_ops->listen(sock, backlog);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int connect(int sock, const struct sockaddr *addr,
|
|
||||||
socklen_t addrlen)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->connect);
|
|
||||||
|
|
||||||
return socket_ops->connect(sock, addr, addrlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int poll(struct pollfd *fds, int nfds, int timeout)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->poll);
|
|
||||||
|
|
||||||
return socket_ops->poll(fds, nfds, timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int setsockopt(int sock, int level, int optname,
|
|
||||||
const void *optval,
|
|
||||||
socklen_t optlen)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->setsockopt);
|
|
||||||
|
|
||||||
return socket_ops->setsockopt(sock, level, optname, optval, optlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int getsockopt(int sock, int level, int optname,
|
|
||||||
void *optval, socklen_t *optlen)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->getsockopt);
|
|
||||||
|
|
||||||
return socket_ops->getsockopt(sock, level, optname, optval, optlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline ssize_t recv(int sock, void *buf, size_t max_len,
|
|
||||||
int flags)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->recv);
|
|
||||||
|
|
||||||
return socket_ops->recv(sock, buf, max_len, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline ssize_t recvfrom(int sock, void *buf,
|
|
||||||
short int len,
|
|
||||||
short int flags,
|
|
||||||
struct sockaddr *from,
|
|
||||||
socklen_t *fromlen)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->recvfrom);
|
|
||||||
|
|
||||||
return socket_ops->recvfrom(sock, buf, len, flags, from, fromlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline ssize_t send(int sock, const void *buf, size_t len,
|
|
||||||
int flags)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->send);
|
|
||||||
|
|
||||||
return socket_ops->send(sock, buf, len, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline ssize_t sendto(int sock, const void *buf,
|
|
||||||
size_t len, int flags,
|
|
||||||
const struct sockaddr *to,
|
|
||||||
socklen_t tolen)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->sendto);
|
|
||||||
|
|
||||||
return socket_ops->sendto(sock, buf, len, flags, to, tolen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct addrinfo *hints,
|
|
||||||
struct addrinfo **res)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->getaddrinfo);
|
|
||||||
|
|
||||||
return socket_ops->getaddrinfo(node, service, hints, res);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void freeaddrinfo(struct addrinfo *res)
|
|
||||||
{
|
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
|
||||||
__ASSERT_NO_MSG(socket_ops->freeaddrinfo);
|
|
||||||
|
|
||||||
return socket_ops->freeaddrinfo(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
int fcntl(int fd, int cmd, ...);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2018 Linaro Limited.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* @brief Socket Offload Redirect API
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_OPS_H_
|
|
||||||
#define ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_OPS_H_
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <net/net_ip.h>
|
|
||||||
#include <net/socket.h> /* needed for struct pollfd */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Socket Offload Redirect API
|
|
||||||
* @defgroup socket_offload Socket offloading interface
|
|
||||||
* @ingroup networking
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief An offloaded Socket API interface
|
|
||||||
*
|
|
||||||
* It is assumed that these offload functions follow the
|
|
||||||
* POSIX socket API standard for arguments, return values and setting of errno.
|
|
||||||
*/
|
|
||||||
struct socket_offload {
|
|
||||||
/* POSIX Socket Functions: */
|
|
||||||
int (*socket)(int family, int type, int proto);
|
|
||||||
int (*close)(int sock);
|
|
||||||
int (*accept)(int sock, struct sockaddr *addr, socklen_t *addrlen);
|
|
||||||
int (*bind)(int sock, const struct sockaddr *addr, socklen_t addrlen);
|
|
||||||
int (*listen)(int sock, int backlog);
|
|
||||||
int (*connect)(int sock, const struct sockaddr *addr,
|
|
||||||
socklen_t addrlen);
|
|
||||||
int (*poll)(struct pollfd *fds, int nfds, int timeout);
|
|
||||||
int (*setsockopt)(int sock, int level, int optname,
|
|
||||||
const void *optval, socklen_t optlen);
|
|
||||||
int (*getsockopt)(int sock, int level, int optname, void *optval,
|
|
||||||
socklen_t *optlen);
|
|
||||||
ssize_t (*recv)(int sock, void *buf, size_t max_len, int flags);
|
|
||||||
ssize_t (*recvfrom)(int sock, void *buf, short int len,
|
|
||||||
short int flags, struct sockaddr *from,
|
|
||||||
socklen_t *fromlen);
|
|
||||||
ssize_t (*send)(int sock, const void *buf, size_t len, int flags);
|
|
||||||
ssize_t (*sendto)(int sock, const void *buf, size_t len, int flags,
|
|
||||||
const struct sockaddr *to, socklen_t tolen);
|
|
||||||
int (*getaddrinfo)(const char *node, const char *service,
|
|
||||||
const struct addrinfo *hints,
|
|
||||||
struct addrinfo **res);
|
|
||||||
void (*freeaddrinfo)(struct addrinfo *res);
|
|
||||||
int (*fcntl)(int fd, int cmd, va_list args);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Register an offloaded socket API interface.
|
|
||||||
*
|
|
||||||
* @param ops A pointer to the offloaded socket API interface.
|
|
||||||
*/
|
|
||||||
extern void socket_offload_register(const struct socket_offload *ops);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ZEPHYR_INCLUDE_NET_SOCKET_OFFLOAD_OPS_H_ */
|
|
|
@ -2,12 +2,15 @@
|
||||||
|
|
||||||
zephyr_include_directories(.)
|
zephyr_include_directories(.)
|
||||||
|
|
||||||
if(NOT CONFIG_NET_SOCKETS_OFFLOAD)
|
|
||||||
zephyr_sources(
|
zephyr_sources(
|
||||||
getaddrinfo.c
|
getaddrinfo.c
|
||||||
getnameinfo.c
|
|
||||||
sockets.c
|
sockets.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT CONFIG_NET_SOCKETS_OFFLOAD)
|
||||||
|
zephyr_sources(
|
||||||
sockets_select.c
|
sockets_select.c
|
||||||
|
getnameinfo.c
|
||||||
sockets_misc.c
|
sockets_misc.c
|
||||||
)
|
)
|
||||||
zephyr_sources_ifdef(CONFIG_NET_SOCKETS_SOCKOPT_TLS sockets_tls.c)
|
zephyr_sources_ifdef(CONFIG_NET_SOCKETS_SOCKOPT_TLS sockets_tls.c)
|
||||||
|
|
|
@ -14,6 +14,7 @@ LOG_MODULE_REGISTER(net_sock_addr, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <net/socket.h>
|
#include <net/socket.h>
|
||||||
|
#include <net/socket_offload.h>
|
||||||
#include <syscall_handler.h>
|
#include <syscall_handler.h>
|
||||||
|
|
||||||
#define AI_ARR_MAX 2
|
#define AI_ARR_MAX 2
|
||||||
|
@ -320,10 +321,17 @@ out:
|
||||||
#include <syscalls/z_zsock_getaddrinfo_internal_mrsh.c>
|
#include <syscalls/z_zsock_getaddrinfo_internal_mrsh.c>
|
||||||
#endif /* CONFIG_USERSPACE */
|
#endif /* CONFIG_USERSPACE */
|
||||||
|
|
||||||
|
#endif /* defined(CONFIG_DNS_RESOLVER) */
|
||||||
|
|
||||||
int zsock_getaddrinfo(const char *host, const char *service,
|
int zsock_getaddrinfo(const char *host, const char *service,
|
||||||
const struct zsock_addrinfo *hints,
|
const struct zsock_addrinfo *hints,
|
||||||
struct zsock_addrinfo **res)
|
struct zsock_addrinfo **res)
|
||||||
{
|
{
|
||||||
|
if (IS_ENABLED(CONFIG_NET_SOCKETS_OFFLOAD)) {
|
||||||
|
return socket_offload_getaddrinfo(host, service, hints, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_DNS_RESOLVER)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
*res = calloc(AI_ARR_MAX, sizeof(struct zsock_addrinfo));
|
*res = calloc(AI_ARR_MAX, sizeof(struct zsock_addrinfo));
|
||||||
|
@ -336,6 +344,18 @@ int zsock_getaddrinfo(const char *host, const char *service,
|
||||||
*res = NULL;
|
*res = NULL;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return DNS_EAI_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void zsock_freeaddrinfo(struct zsock_addrinfo *ai)
|
||||||
|
{
|
||||||
|
if (IS_ENABLED(CONFIG_NET_SOCKETS_OFFLOAD)) {
|
||||||
|
return socket_offload_freeaddrinfo(ai);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(ai);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ERR(e) case DNS_ ## e: return #e
|
#define ERR(e) case DNS_ ## e: return #e
|
||||||
|
@ -356,5 +376,3 @@ const char *zsock_gai_strerror(int errcode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef ERR
|
#undef ERR
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -8,29 +8,34 @@
|
||||||
LOG_MODULE_REGISTER(net_socket_offload, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
LOG_MODULE_REGISTER(net_socket_offload, CONFIG_NET_SOCKETS_LOG_LEVEL);
|
||||||
|
|
||||||
#include <net/socket_offload.h>
|
#include <net/socket_offload.h>
|
||||||
|
#include <net/socket.h>
|
||||||
|
|
||||||
/* Only one provider may register socket operations upon boot. */
|
#include "sockets_internal.h"
|
||||||
const struct socket_offload *socket_ops;
|
|
||||||
|
|
||||||
void socket_offload_register(const struct socket_offload *ops)
|
const struct socket_dns_offload *dns_offload;
|
||||||
|
|
||||||
|
void socket_offload_dns_register(const struct socket_dns_offload *ops)
|
||||||
{
|
{
|
||||||
__ASSERT_NO_MSG(ops);
|
__ASSERT_NO_MSG(ops);
|
||||||
__ASSERT_NO_MSG(socket_ops == NULL);
|
__ASSERT_NO_MSG(dns_offload == NULL);
|
||||||
|
|
||||||
socket_ops = ops;
|
dns_offload = ops;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fcntl(int fd, int cmd, ...)
|
int socket_offload_getaddrinfo(const char *node, const char *service,
|
||||||
|
const struct zsock_addrinfo *hints,
|
||||||
|
struct zsock_addrinfo **res)
|
||||||
{
|
{
|
||||||
__ASSERT_NO_MSG(socket_ops);
|
__ASSERT_NO_MSG(dns_offload);
|
||||||
__ASSERT_NO_MSG(socket_ops->fcntl);
|
__ASSERT_NO_MSG(dns_offload->getaddrinfo);
|
||||||
|
|
||||||
va_list args;
|
return dns_offload->getaddrinfo(node, service, hints, res);
|
||||||
int res;
|
}
|
||||||
|
|
||||||
va_start(args, cmd);
|
void socket_offload_freeaddrinfo(struct zsock_addrinfo *res)
|
||||||
res = socket_ops->fcntl(fd, cmd, args);
|
{
|
||||||
va_end(args);
|
__ASSERT_NO_MSG(dns_offload);
|
||||||
|
__ASSERT_NO_MSG(dns_offload->freeaddrinfo);
|
||||||
return res;
|
|
||||||
|
return dns_offload->freeaddrinfo(res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,12 @@ int z_impl_zsock_socket(int family, int type, int proto)
|
||||||
return sock_family->handler(family, type, proto);
|
return sock_family->handler(family, type, proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
return zsock_socket_internal(family, type, proto);
|
if (IS_ENABLED(CONFIG_NET_NATIVE)) {
|
||||||
|
return zsock_socket_internal(family, type, proto);
|
||||||
|
}
|
||||||
|
|
||||||
|
errno = EAFNOSUPPORT;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue