From 5fbf2fd8d12b4e4fad36d773f490a7e671732cac Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 9 May 2017 06:39:08 -0600 Subject: [PATCH] NSH wireless setup: Move call to nsh_associate(). It should be possible to associate with an AP when DHCPC is disabled. --- nshlib/nsh_netinit.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nshlib/nsh_netinit.c b/nshlib/nsh_netinit.c index f75922cbe..de136ad00 100644 --- a/nshlib/nsh_netinit.c +++ b/nshlib/nsh_netinit.c @@ -309,7 +309,7 @@ static void nsh_netinit_configure(void) #ifdef CONFIG_NET_IPv4 /* Set up our host address */ -#if !defined(CONFIG_NSH_DHCPC) +#ifndef CONFIG_NSH_DHCPC addr.s_addr = HTONL(CONFIG_NSH_IPADDR); #else addr.s_addr = 0; @@ -353,22 +353,22 @@ static void nsh_netinit_configure(void) #endif /* CONFIG_NET_ICMPv6_AUTOCONF */ #endif /* CONFIG_NET_IPv6 */ -#if defined(CONFIG_NSH_DNS) +#ifdef CONFIG_NSH_DNS addr.s_addr = HTONL(CONFIG_NSH_DNSIPADDR); netlib_set_ipv4dnsaddr(&addr); #endif -#if defined(CONFIG_NSH_DHCPC) - /* Get the MAC address of the NIC */ - - netlib_getmacaddr(NET_DEVNAME, mac); - #ifdef CONFIG_WIRELESS_WAPI - /* Associate the wlan */ + /* Associate the wlan with an access point. */ nsh_associate(NET_DEVNAME); #endif +#ifdef CONFIG_NSH_DHCPC + /* Get the MAC address of the NIC */ + + netlib_getmacaddr(NET_DEVNAME, mac); + /* Set up the DHCPC modules */ handle = dhcpc_open(&mac, IFHWADDRLEN);