Replace self defined macros with NET_SOCK_[FAMILY|TYPE|PROTOCOL]

NET_SOCK_* is defined by nuttx/net/netconfig.h and then can be shared

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-12-19 21:03:15 +08:00 committed by Gustavo Henrique Nihei
parent fcd69d1cdf
commit 66dbaa4539
35 changed files with 50 additions and 201 deletions

View File

@ -79,95 +79,6 @@
# define IPv6_ROUTE_PATH CONFIG_NETLIB_PROCFS_MOUNTPT "/net/route/ipv6"
#endif
/* Using the following definitions, the following socket() arguments should
* provide a valid socket in all configurations:
*
* ret = socket(NETLIB_SOCK_FAMILY, NETLIB_SOCK_TYPE,
* NETLIB_SOCK_PROTOCOL);
*/
/* The address family that we used to create the socket really does not
* matter. It should, however, be valid in the current configuration.
*/
#if defined(CONFIG_NET_IPv4)
# define NETLIB_SOCK_FAMILY AF_INET
#elif defined(CONFIG_NET_IPv6)
# define NETLIB_SOCK_FAMILY AF_INET6
#elif defined(CONFIG_NET_LOCAL)
# define NETLIB_SOCK_FAMILY AF_LOCAL
#elif defined(CONFIG_NET_PKT)
# define NETLIB_SOCK_FAMILY AF_PACKET
#elif defined(CONFIG_NET_CAN)
# define NETLIB_SOCK_FAMILY AF_CAN
#elif defined(CONFIG_NET_IEEE802154)
# define NETLIB_SOCK_FAMILY AF_IEEE802154
#elif defined(CONFIG_WIRELESS_PKTRADIO)
# define NETLIB_SOCK_FAMILY AF_PKTRADIO
#elif defined(CONFIG_NET_BLUETOOTH)
# define NETLIB_SOCK_FAMILY AF_BLUETOOTH
#elif defined(CONFIG_NET_USRSOCK)
# define NETLIB_SOCK_FAMILY AF_INET
#elif defined(CONFIG_NET_NETLINK)
# define NETLIB_SOCK_FAMILY AF_NETLINK
#elif defined(CONFIG_NET_RPMSG)
# define NETLIB_SOCK_FAMILY AF_RPMSG
#else
# define NETLIB_SOCK_FAMILY AF_UNSPEC
#endif
/* Socket protocol of zero normally works */
#define NETLIB_SOCK_PROTOCOL 0
/* SOCK_DGRAM is the preferred socket type to use when we just want a
* socket for performing driver ioctls. However, we can't use SOCK_DRAM
* if UDP is disabled.
*
* Pick a socket type (and perhaps protocol) compatible with the currently
* selected address family.
*/
#if NETLIB_SOCK_FAMILY == AF_INET
# if defined(CONFIG_NET_UDP)
# define NETLIB_SOCK_TYPE SOCK_DGRAM
# elif defined(CONFIG_NET_TCP)
# define NETLIB_SOCK_TYPE SOCK_STREAM
# elif defined(CONFIG_NET_ICMP_SOCKET)
# define NETLIB_SOCK_TYPE SOCK_DGRAM
# undef NETLIB_SOCK_PROTOCOL
# define NETLIB_SOCK_PROTOCOL IPPROTO_ICMP
# endif
#elif NETLIB_SOCK_FAMILY == AF_INET6
# if defined(CONFIG_NET_UDP)
# define NETLIB_SOCK_TYPE SOCK_DGRAM
# elif defined(CONFIG_NET_TCP)
# define NETLIB_SOCK_TYPE SOCK_STREAM
# elif defined(CONFIG_NET_ICMPv6_SOCKET)
# define NETLIB_SOCK_TYPE SOCK_DGRAM
# undef NETLIB_SOCK_PROTOCOL
# define NETLIB_SOCK_PROTOCOL IPPROTO_ICMP6
# endif
#elif NETLIB_SOCK_FAMILY == AF_LOCAL
# if defined(CONFIG_NET_LOCAL_DGRAM)
# define NETLIB_SOCK_TYPE SOCK_DGRAM
# elif defined(CONFIG_NET_LOCAL_STREAM)
# define NETLIB_SOCK_TYPE SOCK_STREAM
# endif
#elif NETLIB_SOCK_FAMILY == AF_PACKET
# define NETLIB_SOCK_TYPE SOCK_RAW
#elif NETLIB_SOCK_FAMILY == AF_CAN
# define NETLIB_SOCK_TYPE SOCK_RAW
#elif NETLIB_SOCK_FAMILY == AF_IEEE802154
# define NETLIB_SOCK_TYPE SOCK_DGRAM
#elif NETLIB_SOCK_FAMILY == AF_BLUETOOTH
# define NETLIB_SOCK_TYPE SOCK_RAW
#elif NETLIB_SOCK_FAMILY == AF_NETLINK
# define NETLIB_SOCK_TYPE SOCK_DGRAM
#elif NETLIB_SOCK_FAMILY == AF_RPMSG
# define NETLIB_SOCK_TYPE SOCK_STREAM
#endif
/****************************************************************************
* Public Types
****************************************************************************/

View File

@ -70,31 +70,6 @@
#define WAPI_PROC_LINE_SIZE 1024
/* Select options to successfully open a socket in this network
* configuration.
*/
/* The address family that we used to create the socket really does not
* matter. It should, however, be valid in the current configuration.
*/
#if defined(CONFIG_NET_IPv4)
# define PF_INETX PF_INET
#elif defined(CONFIG_NET_IPv6)
# define PF_INETX PF_INET6
#endif
/* SOCK_DGRAM is the preferred socket type to use when we just want a
* socket for performing driver ioctls. However, we can't use SOCK_DRAM
* if UDP is disabled.
*/
#ifdef CONFIG_NET_UDP
# define SOCK_WAPI SOCK_DGRAM
#else
# define SOCK_WAPI SOCK_STREAM
#endif
#ifndef CONFIG_WIRELESS_WAPI_INITCONF
# define wapi_load_config(ifname, confname, conf) NULL
# define wapi_unload_config(load)

View File

@ -202,16 +202,6 @@
# undef CONFIG_NETINIT_MONITOR
#endif
/* We need a valid IP domain (any domain) to create a socket that we can use
* to communicate with the network device.
*/
#if defined(CONFIG_NET_IPv4)
# define AF_INETX AF_INET
#elif defined(CONFIG_NET_IPv6)
# define AF_INETX AF_INET6
#endif
/* While the network is up, the network monitor really does nothing. It
* will wait for a very long time while waiting, it can be awakened by a
* signal indicating a change in network status.
@ -763,7 +753,7 @@ static int netinit_monitor(void)
* interface driver.
*/
sd = socket(AF_INETX, SOCK_DGRAM, 0);
sd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sd < 0)
{
ret = -errno;

View File

@ -65,7 +65,7 @@ int netlib_icmpv6_autoconfiguration(FAR const char *ifname)
{
/* Get an IPv6 socket */
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
/* Create a request consisting only of the interface name */

View File

@ -63,7 +63,7 @@ int netlib_del_arpmapping(FAR const struct sockaddr_in *inaddr)
if (inaddr != NULL)
{
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct arpreq req;

View File

@ -66,7 +66,7 @@ int netlib_get_arpmapping(FAR const struct sockaddr_in *inaddr,
if (inaddr != NULL && macaddr != NULL)
{
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct arpreq req;

View File

@ -66,7 +66,7 @@ int netlib_get_dripv4addr(FAR const char *ifname, FAR struct in_addr *addr)
if (ifname && addr)
{
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct ifreq req;

View File

@ -69,8 +69,7 @@ int netlib_getessid(FAR const char *ifname, FAR char *essid, size_t idlen)
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(NETLIB_SOCK_FAMILY,
NETLIB_SOCK_TYPE, NETLIB_SOCK_PROTOCOL);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct iwreq req;

View File

@ -65,8 +65,7 @@ int netlib_getifstatus(FAR const char *ifname, FAR uint8_t *flags)
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(NETLIB_SOCK_FAMILY,
NETLIB_SOCK_TYPE, NETLIB_SOCK_PROTOCOL);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct ifreq req;

View File

@ -66,7 +66,7 @@ int netlib_get_ipv4addr(FAR const char *ifname, FAR struct in_addr *addr)
if (ifname && addr)
{
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct ifreq req;

View File

@ -66,7 +66,7 @@ int netlib_get_ipv4netmask(FAR const char *ifname, FAR struct in_addr *addr)
if (ifname && addr)
{
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct ifreq req;

View File

@ -66,7 +66,7 @@ int netlib_get_ipv6addr(FAR const char *ifname, FAR struct in6_addr *addr)
if (ifname && addr)
{
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct lifreq req;

View File

@ -64,8 +64,7 @@ int netlib_getmacaddr(const char *ifname, uint8_t *macaddr)
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(NETLIB_SOCK_FAMILY,
NETLIB_SOCK_TYPE, NETLIB_SOCK_PROTOCOL);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct ifreq req;

View File

@ -67,7 +67,7 @@ int netlib_getnodnodeaddr(FAR const char *ifname,
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
/* Copy the network interface name */

View File

@ -67,7 +67,7 @@ int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid)
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
/* Perform the IOCTL */

View File

@ -67,7 +67,7 @@ int netlib_getproperties(FAR const char *ifname,
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
/* Copy the network interface name */

View File

@ -81,7 +81,7 @@ int ipmsfilter(FAR const struct in_addr *interface,
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct ip_msfilter imsf;

View File

@ -96,7 +96,7 @@ static int _netlib_ipv4adaptor(in_addr_t destipaddr,
ifc.ifc_req = NULL;
ifc.ifc_len = 0;
sd = socket(AF_INET, NETLIB_SOCK_TYPE, 0);
sd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sd < 0)
{
ret = -errno;

View File

@ -96,7 +96,7 @@ static int _netlib_ipv6adaptor(FAR const struct in6_addr *destipaddr,
lifc.lifc_req = NULL;
lifc.lifc_len = 0;
sd = socket(AF_INET6, NETLIB_SOCK_TYPE, 0);
sd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sd < 0)
{
ret = -errno;

View File

@ -66,7 +66,7 @@ int netlib_set_arpmapping(FAR const struct sockaddr_in *inaddr,
if (inaddr != NULL && macaddr != NULL)
{
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct arpreq req;

View File

@ -82,7 +82,7 @@ int netlib_set_dripv4addr(FAR const char *ifname,
if (ifname && addr)
{
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
FAR struct sockaddr_in *inaddr;

View File

@ -63,7 +63,7 @@ int netlib_set_dripv6addr(FAR const char *ifname,
if (ifname && addr)
{
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
FAR struct sockaddr_in6 *inaddr;
@ -80,7 +80,8 @@ int netlib_set_dripv6addr(FAR const char *ifname,
inaddr->sin6_port = 0;
memcpy(&inaddr->sin6_addr, addr, sizeof(struct in6_addr));
ret = ioctl(sockfd, SIOCSLIFDSTADDR, (unsigned long)((uintptr_t)&req));
ret = ioctl(sockfd, SIOCSLIFDSTADDR,
(unsigned long)((uintptr_t)&req));
close(sockfd);
}
}

View File

@ -67,7 +67,7 @@ int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr)
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
/* Perform the IOCTL */

View File

@ -68,8 +68,7 @@ int netlib_setessid(FAR const char *ifname, FAR const char *essid)
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(NETLIB_SOCK_FAMILY,
NETLIB_SOCK_TYPE, NETLIB_SOCK_PROTOCOL);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct iwreq req;

View File

@ -63,8 +63,7 @@ int netlib_ifup(const char *ifname)
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(NETLIB_SOCK_FAMILY,
NETLIB_SOCK_TYPE, NETLIB_SOCK_PROTOCOL);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct ifreq req;
@ -107,8 +106,7 @@ int netlib_ifdown(const char *ifname)
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(NETLIB_SOCK_FAMILY,
NETLIB_SOCK_TYPE, NETLIB_SOCK_PROTOCOL);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct ifreq req;

View File

@ -63,7 +63,7 @@ int netlib_set_ipv4addr(FAR const char *ifname,
if (ifname && addr)
{
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
FAR struct sockaddr_in *inaddr;

View File

@ -62,7 +62,7 @@ int netlib_set_ipv4netmask(FAR const char *ifname,
if (ifname && addr)
{
int sockfd = socket(PF_INET, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
FAR struct sockaddr_in *inaddr;

View File

@ -63,7 +63,7 @@ int netlib_set_ipv6addr(FAR const char *ifname,
if (ifname && addr)
{
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
FAR struct sockaddr_in6 *inaddr;

View File

@ -62,7 +62,7 @@ int netlib_set_ipv6netmask(FAR const char *ifname,
if (ifname && addr)
{
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
FAR struct sockaddr_in6 *inaddr;

View File

@ -65,8 +65,7 @@ int netlib_setmacaddr(const char *ifname, const uint8_t *macaddr)
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(NETLIB_SOCK_FAMILY,
NETLIB_SOCK_TYPE, NETLIB_SOCK_PROTOCOL);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
struct ifreq req;
@ -77,7 +76,7 @@ int netlib_setmacaddr(const char *ifname, const uint8_t *macaddr)
/* Put the new MAC address into the request */
req.ifr_hwaddr.sa_family = NETLIB_SOCK_FAMILY;
req.ifr_hwaddr.sa_family = NET_SOCK_FAMILY;
memcpy(&req.ifr_hwaddr.sa_data, macaddr, IFHWADDRLEN);
/* Perform the ioctl to set the MAC address */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/netutils/netlib/netlib_setnodnodeaddr.c
* apps/netutils/netlib/netlib_setnodeaddr.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -67,7 +67,7 @@ int netlib_setnodeaddr(FAR const char *ifname,
{
/* Get a socket (only so that we get access to the INET subsystem) */
int sockfd = socket(PF_INET6, NETLIB_SOCK_TYPE, 0);
int sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd >= 0)
{
/* Copy the network interface name */

View File

@ -256,7 +256,7 @@ int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* We need to have a socket (any socket) in order to perform the ioctl */
sockfd = socket(family, NETLIB_SOCK_TYPE, 0);
sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd < 0)
{
nsh_error(vtbl, g_fmtcmdfailed, argv[0], "socket", NSH_ERRNO);
@ -503,7 +503,7 @@ int cmd_delroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* used.
*/
if (shift > 0 && argc != 2)
if (shift > 0 && argc != 2)
{
nsh_error(vtbl, g_fmttoomanyargs, argv[0]);
goto errout;
@ -537,7 +537,7 @@ int cmd_delroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
/* We need to have a socket (any socket) in order to perform the ioctl */
sockfd = socket(family, NETLIB_SOCK_TYPE, 0);
sockfd = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sockfd < 0)
{
nsh_error(vtbl, g_fmtcmdfailed, argv[0], "socket", NSH_ERRNO);

View File

@ -7,10 +7,11 @@
* Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@ -43,31 +44,6 @@
#include "wireless/ieee802154.h"
#include "wireless/iwpan.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* The address family that we used to create the socket really does not
* matter. It should, however, be valid in the current configuration.
*/
#if defined(CONFIG_NET_IPv4)
# define PF_INETX PF_INET
#elif defined(CONFIG_NET_IPv6)
# define PF_INETX PF_INET6
#endif
/* SOCK_DGRAM is the preferred socket type to use when we just want a
* socket for performing driver ioctls. However, we can't use SOCK_DRAM
* if UDP is disabled.
*/
#ifdef CONFIG_NET_UDP
# define SOCK_IWPAN SOCK_DGRAM
#else
# define SOCK_IWPAN SOCK_STREAM
#endif
/****************************************************************************
* Private Types
****************************************************************************/
@ -236,7 +212,8 @@ static uint8_t iwpan_char2nibble(char ch)
}
else
{
fprintf(stderr, "ERROR: Unexpected character in hex value: %02x\n", ch);
fprintf(stderr,
"ERROR: Unexpected character in hex value: %02x\n", ch);
exit(EXIT_FAILURE);
}
}
@ -420,12 +397,12 @@ static void iwpan_show_cmd(int sock, FAR const char *ifname)
static void iwpan_cca_cmd(int sock, FAR const char *ifname,
FAR const char *ccastr)
{
int ret;
union
{
struct ieee802154_cca_s cca;
uint8_t b;
} u;
int ret;
/* Convert input strings to values */
@ -589,7 +566,7 @@ static void iwpan_promisc_cmd(int sock, FAR const char *ifname,
static void iwpan_saddr_cmd(int sock, FAR const char *ifname,
FAR const char *addrstr)
{
uint16_t saddr;
uint16_t saddr;
int ret;
/* Convert input strings to values */
@ -734,7 +711,7 @@ int main(int argc, FAR char *argv[])
/* Create a communication socket */
sock = socket(PF_INETX, SOCK_IWPAN, 0);
sock = socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
if (sock < 0)
{
fprintf(stderr, "ERROR: iwpan_make_socket() failed: %d\n", sock);

View File

@ -245,7 +245,7 @@ int wpa_driver_wext_associate(FAR struct wpa_wconfig_s *wconfig)
/* Get a socket (only so that we get access to the INET subsystem) */
sockfd = socket(PF_INETX, SOCK_WAPI, 0);
sockfd = wapi_make_socket();
if (sockfd < 0)
{
return sockfd;

View File

@ -49,6 +49,8 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <nuttx/net/netconfig.h>
#include "wireless/wapi.h"
#include "util.h"
@ -188,7 +190,7 @@ static bool wapi_json_update(FAR cJSON *root,
int wapi_make_socket(void)
{
return socket(PF_INETX, SOCK_WAPI, 0);
return socket(NET_SOCK_FAMILY, NET_SOCK_TYPE, NET_SOCK_PROTOCOL);
}
/****************************************************************************