diff --git a/nshlib/nsh_netcmds.c b/nshlib/nsh_netcmds.c index c2cc648f3..5c8fe29d9 100644 --- a/nshlib/nsh_netcmds.c +++ b/nshlib/nsh_netcmds.c @@ -113,15 +113,24 @@ #undef HAVE_PING #undef HAVE_PING6 +#undef HAVE_EADDR #if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING) && \ !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_NSH_DISABLE_PING) -# define HAVE_PING +# define HAVE_PING 1 #endif #if defined(CONFIG_NET_ICMPv6) && defined(CONFIG_NET_ICMPv6_PING) && \ !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_NSH_DISABLE_PING6) -# define HAVE_PING6 +# define HAVE_PING6 1 +#endif + +#if defined(CONFIG_NET_6LOWPAN) +# if defined(CONFIG_WIRELESS_IEEE802154) +# define HAVE_EADDR 1 +# elif defined(CONFIG_WIRELESS_PKTRADIO) +# warning Missing logic +# endif #endif /* Size of the ECHO data */ @@ -748,7 +757,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) FAR char *gwip = NULL; FAR char *mask = NULL; FAR char *tmp = NULL; -#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN) +#if defined(CONFIG_NET_ETHERNET) || defined(HAVE_EADDR) FAR char *hw = NULL; #endif #if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) @@ -760,7 +769,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) bool badarg = false; #if defined(CONFIG_NET_ETHERNET) uint8_t mac[IFHWADDRLEN]; -#elif defined(CONFIG_NET_6LOWPAN) +#elif defined(HAVE_EADDR) uint8_t eaddr[8]; #endif #if defined(CONFIG_NSH_DHCPC) @@ -849,7 +858,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #endif } -#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN) +#if defined(CONFIG_NET_ETHERNET) || defined(HAVE_EADDR) /* REVISIT: How will we handle Ethernet and SLIP networks together? */ else if (!strcmp(tmp, "hw")) @@ -895,7 +904,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return ERROR; } -#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_NET_6LOWPAN) +#if defined(CONFIG_NET_ETHERNET) || defined(HAVE_EADDR) /* Set Hardware Ethernet MAC address */ /* REVISIT: How will we handle Ethernet and SLIP networks together? */ @@ -1022,6 +1031,8 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) } #endif /* CONFIG_NET_IPv4 */ + UNUSED(intf); /* Not used in all configurations */ + #if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) #ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv4 diff --git a/nshlib/nsh_netinit.c b/nshlib/nsh_netinit.c index 2670f084e..a4c04be6a 100644 --- a/nshlib/nsh_netinit.c +++ b/nshlib/nsh_netinit.c @@ -130,6 +130,20 @@ # define HAVE_MAC 1 #endif +/* Currently there is only logic in 6LoWPAN configurations to + * set the IEEE 802.15.4 addresses. + */ + +#undef HAVE_EADDR + +#if defined(CONFIG_NET_6LOWPAN) +# if defined(CONFIG_WIRELESS_IEEE802154) +# define HAVE_EADDR 1 +# elif defined(CONFIG_WIRELESS_PKTRADIO) +# warning Missing logic +# endif +#endif + /* Provide a default DNS address */ #if defined(CONFIG_NSH_DRIPADDR) && !defined(CONFIG_NSH_DNSIPADDR) @@ -278,7 +292,7 @@ static void nsh_set_macaddr(void) { #if defined(CONFIG_NET_ETHERNET) uint8_t mac[IFHWADDRLEN]; -#elif defined(CONFIG_NET_6LOWPAN) +#elif defined(HAVE_EADDR) uint8_t eaddr[8]; #endif @@ -298,7 +312,7 @@ static void nsh_set_macaddr(void) netlib_setmacaddr(NET_DEVNAME, mac); -#elif defined(CONFIG_NET_6LOWPAN) +#elif defined(HAVE_EADDR) /* Use the configured, fixed extended address */ eaddr[0] = (CONFIG_NSH_MACADDR >> (8 * 7)) & 0xff; @@ -313,8 +327,7 @@ static void nsh_set_macaddr(void) /* Set the 6LoWPAN extended address */ (void)netlib_seteaddr(NET_DEVNAME, eaddr); - -#endif /* CONFIG_NET_ETHERNET */ +#endif /* CONFIG_NET_ETHERNET or HAVE_EADDR */ } #else # define nsh_set_macaddr()