@@ -147,7 +147,8 @@ static void zsock_flush_queue(struct net_context *ctx)
147147 k_fifo_cancel_wait (& ctx -> recv_q );
148148}
149149
150- int zsock_socket_internal (int family , int type , int proto )
150+ #if defined(CONFIG_NET_NATIVE )
151+ static int zsock_socket_internal (int family , int type , int proto )
151152{
152153 int fd = z_reserve_fd ();
153154 struct net_context * ctx ;
@@ -205,6 +206,7 @@ int zsock_socket_internal(int family, int type, int proto)
205206
206207 return fd ;
207208}
209+ #endif /* CONFIG_NET_NATIVE */
208210
209211int z_impl_zsock_socket (int family , int type , int proto )
210212{
@@ -223,10 +225,6 @@ int z_impl_zsock_socket(int family, int type, int proto)
223225 return sock_family -> handler (family , type , proto );
224226 }
225227
226- if (IS_ENABLED (CONFIG_NET_NATIVE )) {
227- return zsock_socket_internal (family , type , proto );
228- }
229-
230228 errno = EAFNOSUPPORT ;
231229 return -1 ;
232230}
@@ -2208,3 +2206,17 @@ const struct socket_op_vtable sock_fd_op_vtable = {
22082206 .setsockopt = sock_setsockopt_vmeth ,
22092207 .getsockname = sock_getsockname_vmeth ,
22102208};
2209+
2210+ #if defined(CONFIG_NET_NATIVE )
2211+ static bool inet_is_supported (int family , int type , int proto )
2212+ {
2213+ if (family != AF_INET && family != AF_INET6 ) {
2214+ return false;
2215+ }
2216+
2217+ return true;
2218+ }
2219+
2220+ NET_SOCKET_REGISTER (af_inet46 , AF_UNSPEC , inet_is_supported ,
2221+ zsock_socket_internal );
2222+ #endif /* CONFIG_NET_NATIVE */
0 commit comments