From 41ce937ed0e0ab373cbfa4407c1c76963d98cb57 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 20 Aug 2017 09:09:47 -0600 Subject: [PATCH] Changes to netlib and nsh so that you build build with PF_IEEE802154 enabled and 6LoWPAN disabled. --- examples/pf_ieee802154/pf_server.c | 2 +- include/netutils/netlib.h | 2 -- netutils/netlib/Makefile | 3 +-- netutils/netlib/netlib_getessid.c | 16 ++++++++------ netutils/netlib/netlib_getifstatus.c | 17 ++++++++------- netutils/netlib/netlib_getmacaddr.c | 16 ++++++++------ netutils/netlib/netlib_getnodeaddr.c | 5 +++-- netutils/netlib/netlib_getpanid.c | 27 +++++++++++++++++++----- netutils/netlib/netlib_getproperties.c | 5 +++-- netutils/netlib/netlib_nodeaddrconv.c | 6 ++++-- netutils/netlib/netlib_seteaddr.c | 29 ++++++++++++++++++++------ netutils/netlib/netlib_setessid.c | 16 ++++++++------ netutils/netlib/netlib_setifstatus.c | 19 ++++++++++------- netutils/netlib/netlib_setmacaddr.c | 26 +++++++++++++---------- netutils/netlib/netlib_setnodeaddr.c | 5 +++-- nshlib/nsh_netinit.c | 17 +++++++++++++-- 16 files changed, 141 insertions(+), 70 deletions(-) diff --git a/examples/pf_ieee802154/pf_server.c b/examples/pf_ieee802154/pf_server.c index 8d3f26896..f7e39214a 100644 --- a/examples/pf_ieee802154/pf_server.c +++ b/examples/pf_ieee802154/pf_server.c @@ -145,7 +145,7 @@ int pfserver_main(int argc, char *argv[]) if (client.sa_addr.s_mode == IEEE802154_ADDRMODE_SHORT) { - printf("server: %d. Received %d bytes from %02x:02x\n", + printf("server: %d. Received %d bytes from %02x:%02x\n", offset, nbytes, client.sa_addr.s_saddr[0], client.sa_addr.s_saddr[1]); } diff --git a/include/netutils/netlib.h b/include/netutils/netlib.h index fdbd522de..652c3bf97 100644 --- a/include/netutils/netlib.h +++ b/include/netutils/netlib.h @@ -114,7 +114,6 @@ int netlib_setmacaddr(FAR const char *ifname, FAR const uint8_t *macaddr); int netlib_getmacaddr(FAR const char *ifname, FAR uint8_t *macaddr); #endif -#ifdef CONFIG_NET_6LOWPAN #ifdef CONFIG_WIRELESS_IEEE802154 /* IEEE 802.15.4 MAC IOCTL commands. */ @@ -139,7 +138,6 @@ int netlib_getnodnodeaddr(FAR const char *ifname, bool netlib_nodeaddrconv(FAR const char *addrstr, FAR struct pktradio_addr_s *nodeaddr); #endif -#endif /* IP address support */ diff --git a/netutils/netlib/Makefile b/netutils/netlib/Makefile index 7bf76509f..962e76e19 100644 --- a/netutils/netlib/Makefile +++ b/netutils/netlib/Makefile @@ -86,15 +86,14 @@ ifeq ($(CONFIG_NET_ETHERNET),y) CSRCS += netlib_setmacaddr.c netlib_getmacaddr.c endif -ifeq ($(CONFIG_NET_6LOWPAN),y) ifeq ($(CONFIG_WIRELESS_IEEE802154),y) CSRCS += netlib_seteaddr.c netlib_getpanid.c netlib_saddrconv.c netlib_eaddrconv.c endif + ifeq ($(CONFIG_WIRELESS_PKTRADIO),y) CSRCS += netlib_getproperties.c netlib_getnodeaddr.c netlib_setnodeaddr.c CSRCS += netlib_nodeaddrconv.c endif -endif # IGMP support diff --git a/netutils/netlib/netlib_getessid.c b/netutils/netlib/netlib_getessid.c index dcf63d97b..0950f2b6c 100644 --- a/netutils/netlib/netlib_getessid.c +++ b/netutils/netlib/netlib_getessid.c @@ -38,7 +38,6 @@ ****************************************************************************/ #include -#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 #include #include @@ -54,6 +53,8 @@ #include "netutils/netlib.h" +#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -64,11 +65,14 @@ */ #if defined(CONFIG_NET_IPv4) -# define PF_INETX PF_INET -# define AF_INETX AF_INET +# define PF_FAMILY PF_INET +# define AF_FAMILY AF_INET #elif defined(CONFIG_NET_IPv6) -# define PF_INETX PF_INET6 -# define AF_INETX AF_INET6 +# define PF_FAMILY PF_INET6 +# define AF_FAMILY AF_INET6 +#elif defined(CONFIG_NET_IEEE802154) +# define PF_FAMILY PF_IEEE802154 +# define AF_FAMILY AF_IEEE802154 #endif /**************************************************************************** @@ -100,7 +104,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(PF_INETX, NETLIB_SOCK_IOCTL, 0); + int sockfd = socket(PF_FAMILY, NETLIB_SOCK_IOCTL, 0); if (sockfd >= 0) { struct iwreq req; diff --git a/netutils/netlib/netlib_getifstatus.c b/netutils/netlib/netlib_getifstatus.c index 2fdbeb853..f3c0b6f0c 100644 --- a/netutils/netlib/netlib_getifstatus.c +++ b/netutils/netlib/netlib_getifstatus.c @@ -38,7 +38,6 @@ ****************************************************************************/ #include -#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 #include #include @@ -53,6 +52,8 @@ #include "netutils/netlib.h" +#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -61,15 +62,17 @@ */ #if defined(CONFIG_NET_IPv4) -# define PF_INETX PF_INET +# define AF_FAMILY AF_INET #elif defined(CONFIG_NET_IPv6) -# define PF_INETX PF_INET6 +# define AF_FAMILY AF_INET6 #elif defined(CONFIG_NET_LOCAL) -# define PF_INETX PF_LOCAL +# define AF_FAMILY AF_LOCAL #elif defined(CONFIG_NET_PKT) -# define PF_INETX PF_PACKET +# define AF_FAMILY AF_PACKET +#elif defined(CONFIG_NET_IEEE802154) +# define AF_FAMILY AF_IEEE802154 #elif defined(CONFIG_NET_USRSOCK) -# define PF_INETX PF_INET +# define AF_FAMILY AF_INET #endif /**************************************************************************** @@ -98,7 +101,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(PF_INETX, NETLIB_SOCK_IOCTL, 0); + int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0); if (sockfd >= 0) { struct ifreq req; diff --git a/netutils/netlib/netlib_getmacaddr.c b/netutils/netlib/netlib_getmacaddr.c index 6f1fa5d26..119c2db39 100644 --- a/netutils/netlib/netlib_getmacaddr.c +++ b/netutils/netlib/netlib_getmacaddr.c @@ -38,7 +38,6 @@ ****************************************************************************/ #include -#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 #include #include @@ -52,6 +51,8 @@ #include "netutils/netlib.h" +#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -60,13 +61,15 @@ */ #if defined(CONFIG_NET_IPv4) -# define PF_INETX PF_INET +# define AF_FAMILY AF_INET #elif defined(CONFIG_NET_IPv6) -# define PF_INETX PF_INET6 +# define AF_FAMILY AF_INET6 #elif defined(CONFIG_NET_PKT) -# define PF_INETX PF_PACKET +# define AF_FAMILY AF_PACKET +#elif defined(CONFIG_NET_IEEE802154) +# define AF_FAMILY AF_IEEE802154 #elif defined(CONFIG_NET_USRSOCK) -# define PF_INETX PF_INET +# define AF_FAMILY AF_INET #endif /**************************************************************************** @@ -95,7 +98,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(PF_INETX, NETLIB_SOCK_IOCTL, 0); + int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0); if (sockfd >= 0) { struct ifreq req; @@ -114,6 +117,7 @@ int netlib_getmacaddr(const char *ifname, uint8_t *macaddr) memcpy(macaddr, &req.ifr_hwaddr.sa_data, IFHWADDRLEN); } + close(sockfd); } } diff --git a/netutils/netlib/netlib_getnodeaddr.c b/netutils/netlib/netlib_getnodeaddr.c index 01c6c222c..cd65a83c0 100644 --- a/netutils/netlib/netlib_getnodeaddr.c +++ b/netutils/netlib/netlib_getnodeaddr.c @@ -50,7 +50,8 @@ #include "nuttx/wireless/pktradio.h" #include "netutils/netlib.h" -#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0 +#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \ + CONFIG_NSOCKET_DESCRIPTORS > 0 /**************************************************************************** * Public Functions @@ -108,4 +109,4 @@ int netlib_getnodnodeaddr(FAR const char *ifname, return ret; } -#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */ +#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */ diff --git a/netutils/netlib/netlib_getpanid.c b/netutils/netlib/netlib_getpanid.c index 98e2b4508..c5b889b1f 100644 --- a/netutils/netlib/netlib_getpanid.c +++ b/netutils/netlib/netlib_getpanid.c @@ -42,14 +42,18 @@ #include #include #include +#include #include #include #include -#include "wireless/ieee802154.h" +#include +#include + #include "netutils/netlib.h" -#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0 +#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \ + CONFIG_NSOCKET_DESCRIPTORS > 0 /**************************************************************************** * Public Functions @@ -72,6 +76,7 @@ int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid) { + struct ieee802154_netmac_s arg; int ret = ERROR; if (ifname != NULL && panid != NULL) @@ -81,14 +86,26 @@ int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid) int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0); if (sockfd >= 0) { - /* Use the helper provided in libmac */ + /* Perform the IOCTL */ + + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + arg.u.getreq.attr = IEEE802154_ATTR_MAC_PANID; + + ret = ioctl(sockfd, MAC802154IOC_MLME_GET_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + ret = -errno; + fprintf(stderr, "MAC802154IOC_MLME_GET_REQUEST failed: %d\n", + ret); + } - ret = sixlowpan_getpanid(sockfd, ifname, panid); close(sockfd); + IEEE802154_PANIDCOPY(panid, arg.u.getreq.attrval.mac.panid); } } return ret; } -#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */ +#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */ diff --git a/netutils/netlib/netlib_getproperties.c b/netutils/netlib/netlib_getproperties.c index 1bf0ba295..80d9ca7d0 100644 --- a/netutils/netlib/netlib_getproperties.c +++ b/netutils/netlib/netlib_getproperties.c @@ -50,7 +50,8 @@ #include "nuttx/wireless/pktradio.h" #include "netutils/netlib.h" -#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0 +#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \ + CONFIG_NSOCKET_DESCRIPTORS > 0 /**************************************************************************** * Public Functions @@ -108,4 +109,4 @@ int netlib_getproperties(FAR const char *ifname, return ret; } -#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */ +#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */ diff --git a/netutils/netlib/netlib_nodeaddrconv.c b/netutils/netlib/netlib_nodeaddrconv.c index 9652a3423..7356e144d 100644 --- a/netutils/netlib/netlib_nodeaddrconv.c +++ b/netutils/netlib/netlib_nodeaddrconv.c @@ -52,7 +52,8 @@ #include "nuttx/wireless/pktradio.h" #include "netutils/netlib.h" -#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0 +#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \ + CONFIG_NSOCKET_DESCRIPTORS > 0 /**************************************************************************** * Private Functions @@ -189,4 +190,5 @@ bool netlib_nodeaddrconv(FAR const char *addrstr, return false; } -#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */ +#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */ + diff --git a/netutils/netlib/netlib_seteaddr.c b/netutils/netlib/netlib_seteaddr.c index 251653b22..71ed0dcba 100644 --- a/netutils/netlib/netlib_seteaddr.c +++ b/netutils/netlib/netlib_seteaddr.c @@ -42,14 +42,18 @@ #include #include #include +#include #include #include #include -#include "wireless/ieee802154.h" +#include +#include + #include "netutils/netlib.h" -#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0 +#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \ + CONFIG_NSOCKET_DESCRIPTORS > 0 /**************************************************************************** * Public Functions @@ -72,6 +76,7 @@ int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr) { + struct ieee802154_netmac_s arg; int ret = ERROR; if (ifname != NULL) @@ -81,14 +86,26 @@ int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr) int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0); if (sockfd >= 0) { - /* Use the helper provided in libmac */ + /* Perform the IOCTL */ - ret = sixlowpan_seteaddr(sockfd, ifname, eaddr); - close(sockfd); + strncpy(arg.ifr_name, ifname, IFNAMSIZ); + arg.u.setreq.attr = IEEE802154_ATTR_MAC_EADDR; + IEEE802154_EADDRCOPY(arg.u.setreq.attrval.mac.eaddr, eaddr); + + ret = ioctl(sockfd, MAC802154IOC_MLME_SET_REQUEST, + (unsigned long)((uintptr_t)&arg)); + if (ret < 0) + { + ret = -errno; + fprintf(stderr, "MAC802154IOC_MLME_SET_REQUEST failed: %d\n", + ret); + } + + close(sockfd); } } return ret; } -#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */ +#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */ diff --git a/netutils/netlib/netlib_setessid.c b/netutils/netlib/netlib_setessid.c index 4cf03071b..94356ebbd 100644 --- a/netutils/netlib/netlib_setessid.c +++ b/netutils/netlib/netlib_setessid.c @@ -38,7 +38,6 @@ ****************************************************************************/ #include -#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 #include #include @@ -54,6 +53,8 @@ #include "netutils/netlib.h" +#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -64,11 +65,14 @@ */ #if defined(CONFIG_NET_IPv4) -# define PF_INETX PF_INET -# define AF_INETX AF_INET +# define PF_FAMILY PF_INET +# define AF_FAMILY AF_INET #elif defined(CONFIG_NET_IPv6) -# define PF_INETX PF_INET6 -# define AF_INETX AF_INET6 +# define PF_FAMILY PF_INET6 +# define AF_FAMILY AF_INET6 +#elif defined(CONFIG_NET_IEEE802154) +# define PF_FAMILY PF_IEEE802154 +# define AF_FAMILY AF_IEEE802154 #endif /**************************************************************************** @@ -99,7 +103,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(PF_INETX, NETLIB_SOCK_IOCTL, 0); + int sockfd = socket(PF_FAMILY, NETLIB_SOCK_IOCTL, 0); if (sockfd >= 0) { struct iwreq req; diff --git a/netutils/netlib/netlib_setifstatus.c b/netutils/netlib/netlib_setifstatus.c index 48c9ad4e5..fb40bda45 100644 --- a/netutils/netlib/netlib_setifstatus.c +++ b/netutils/netlib/netlib_setifstatus.c @@ -38,7 +38,6 @@ ****************************************************************************/ #include -#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 #include #include @@ -52,6 +51,8 @@ #include "netutils/netlib.h" +#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -60,15 +61,17 @@ */ #if defined(CONFIG_NET_IPv4) -# define PF_INETX PF_INET +# define AF_FAMILY AF_INET #elif defined(CONFIG_NET_IPv6) -# define PF_INETX PF_INET6 +# define AF_FAMILY AF_INET6 #elif defined(CONFIG_NET_LOCAL) -# define PF_INETX PF_LOCAL +# define AF_FAMILY AF_LOCAL #elif defined(CONFIG_NET_PKT) -# define PF_INETX PF_PACKET +# define AF_FAMILY AF_PACKET +#elif defined(CONFIG_NET_IEEE802154) +# define AF_FAMILY AF_IEEE802154 #elif defined(CONFIG_NET_USRSOCK) -# define PF_INETX PF_INET +# define AF_FAMILY AF_INET #endif /**************************************************************************** @@ -96,7 +99,7 @@ int netlib_ifup(const char *ifname) { /* Get a socket (only so that we get access to the INET subsystem) */ - int sockfd = socket(PF_INETX, NETLIB_SOCK_IOCTL, 0); + int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0); if (sockfd >= 0) { struct ifreq req; @@ -139,7 +142,7 @@ int netlib_ifdown(const char *ifname) { /* Get a socket (only so that we get access to the INET subsystem) */ - int sockfd = socket(PF_INETX, NETLIB_SOCK_IOCTL, 0); + int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0); if (sockfd >= 0) { struct ifreq req; diff --git a/netutils/netlib/netlib_setmacaddr.c b/netutils/netlib/netlib_setmacaddr.c index 921e0847b..4c2c06d07 100644 --- a/netutils/netlib/netlib_setmacaddr.c +++ b/netutils/netlib/netlib_setmacaddr.c @@ -38,7 +38,6 @@ ****************************************************************************/ #include -#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 #include #include @@ -52,6 +51,8 @@ #include "netutils/netlib.h" +#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -61,17 +62,20 @@ */ #if defined(CONFIG_NET_IPv4) -# define PF_INETX PF_INET -# define AF_INETX AF_INET +# define PF_FAMILY PF_INET +# define AF_FAMILY AF_INET #elif defined(CONFIG_NET_IPv6) -# define PF_INETX PF_INET6 -# define AF_INETX AF_INET6 +# define PF_FAMILY PF_INET6 +# define AF_FAMILY AF_INET6 #elif defined(CONFIG_NET_PKT) -# define PF_INETX PF_PACKET -# define AF_INETX AF_PACKET +# define PF_FAMILY PF_PACKET +# define AF_FAMILY AF_PACKET +#elif defined(CONFIG_NET_IEEE802154) +# define PF_FAMILY PF_IEEE802154 +# define AF_FAMILY AF_IEEE802154 #elif defined(CONFIG_NET_USRSOCK) -# define PF_INETX PF_INET -# define AF_INETX AF_INET +# define PF_FAMILY PF_INET +# define AF_FAMILY AF_INET #endif /**************************************************************************** @@ -101,7 +105,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(PF_INETX, NETLIB_SOCK_IOCTL, 0); + int sockfd = socket(PF_FAMILY, NETLIB_SOCK_IOCTL, 0); if (sockfd >= 0) { struct ifreq req; @@ -112,7 +116,7 @@ int netlib_setmacaddr(const char *ifname, const uint8_t *macaddr) /* Put the new MAC address into the request */ - req.ifr_hwaddr.sa_family = AF_INETX; + req.ifr_hwaddr.sa_family = AF_FAMILY; memcpy(&req.ifr_hwaddr.sa_data, macaddr, IFHWADDRLEN); /* Perform the ioctl to set the MAC address */ diff --git a/netutils/netlib/netlib_setnodeaddr.c b/netutils/netlib/netlib_setnodeaddr.c index 24f66bce8..93813216d 100644 --- a/netutils/netlib/netlib_setnodeaddr.c +++ b/netutils/netlib/netlib_setnodeaddr.c @@ -50,7 +50,8 @@ #include "nuttx/wireless/pktradio.h" #include "netutils/netlib.h" -#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0 +#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \ + CONFIG_NSOCKET_DESCRIPTORS > 0 /**************************************************************************** * Public Functions @@ -104,4 +105,4 @@ int netlib_setnodeaddr(FAR const char *ifname, return ret; } -#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */ +#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */ diff --git a/nshlib/nsh_netinit.c b/nshlib/nsh_netinit.c index a4c04be6a..f6ad641e3 100644 --- a/nshlib/nsh_netinit.c +++ b/nshlib/nsh_netinit.c @@ -76,6 +76,10 @@ # include #endif +#ifdef CONFIG_NET_IEEE802154 +# include +#endif + #ifdef CONFIG_NETUTILS_NTPCLIENT # include "netutils/ntpclient.h" #endif @@ -100,26 +104,34 @@ # undef CONFIG_NET_TUN # undef CONFIG_NET_LOCAL # undef CONFIG_NET_USRSOCK +# undef CONFIG_NET_IEEE802154 # undef CONFIG_NET_LOOPBACK #elif defined(CONFIG_NET_6LOWPAN) # undef CONFIG_NET_SLIP # undef CONFIG_NET_TUN # undef CONFIG_NET_LOCAL # undef CONFIG_NET_USRSOCK +# undef CONFIG_NET_IEEE802154 # undef CONFIG_NET_LOOPBACK #elif defined(CONFIG_NET_SLIP) # undef CONFIG_NET_TUN # undef CONFIG_NET_LOCAL # undef CONFIG_NET_USRSOCK +# undef CONFIG_NET_IEEE802154 # undef CONFIG_NET_LOOPBACK #elif defined(CONFIG_NET_TUN) # undef CONFIG_NET_LOCAL # undef CONFIG_NET_USRSOCK +# undef CONFIG_NET_IEEE802154 # undef CONFIG_NET_LOOPBACK #elif defined(CONFIG_NET_LOCAL) # undef CONFIG_NET_USRSOCK +# undef CONFIG_NET_IEEE802154 # undef CONFIG_NET_LOOPBACK #elif defined(CONFIG_NET_USRSOCK) +# undef CONFIG_NET_IEEE802154 +# undef CONFIG_NET_LOOPBACK +#elif defined(CONFIG_NET_IEEE802154) # undef CONFIG_NET_LOOPBACK #endif @@ -174,7 +186,7 @@ #elif defined(CONFIG_NET_ETHERNET) # define NET_DEVNAME "eth0" # define NSH_HAVE_NETDEV -#elif defined(CONFIG_NET_6LOWPAN) +#elif defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154) # define NET_DEVNAME "wpan0" # define NSH_HAVE_NETDEV #elif defined(CONFIG_NET_SLIP) @@ -344,7 +356,8 @@ static void nsh_set_macaddr(void) * ****************************************************************************/ -#if defined(NSH_HAVE_NETDEV) && !defined(CONFIG_NET_6LOWPAN) +#if defined(NSH_HAVE_NETDEV) && !defined(CONFIG_NET_6LOWPAN) && ! \ + defined(CONFIG_NET_IEEE802154) static void nsh_set_ipaddrs(void) { #ifdef CONFIG_NET_IPv4