apps/nshlib: Add a new option CONFIG_NSH_NETLOCAL that will suppress some built in operations and will support manual configuration of a wireless network
This commit is contained in:
parent
ccb6282f5b
commit
8c1446671c
@ -1009,10 +1009,34 @@ config NSH_NETINIT
|
||||
|
||||
if NSH_NETINIT
|
||||
|
||||
config NSH_NETLOCAL
|
||||
bool "Local network initialization"
|
||||
default n
|
||||
---help---
|
||||
If this option is selected, then NSH will only initialize the local
|
||||
attributes of the network: The MAC address is needed and any IP
|
||||
addresses as needed. More importantly, it will not do the following:
|
||||
|
||||
- It will not bring the netup up. The can be done later with the
|
||||
NSH ifup command.
|
||||
- It will not associate any wireless devices to an access point.
|
||||
- It will not attempt to obtain an IP address if DHCPC is selected.
|
||||
This may be done later from the NSH command line with the
|
||||
apps/system/dhcpc 'renew' command.
|
||||
- It will not start the NTPC daemon. This may be done later from
|
||||
the NSH command line with the apps/system/ntpc 'ntpcstart' command.
|
||||
|
||||
This option permits you to divid the network configuration into two
|
||||
parts: The local configuration of the network device and the dynamic
|
||||
configuration of the device in the network. This may be important in
|
||||
an environment when, for example, you need to manually scan for
|
||||
available access points and associate the wireless driver with an
|
||||
access point.
|
||||
|
||||
config NSH_NETINIT_THREAD
|
||||
bool "Network initialization thread"
|
||||
default n
|
||||
depends on !DISABLE_PTHREAD
|
||||
depends on !DISABLE_PTHREAD && !NSH_NETLOCAL
|
||||
---help---
|
||||
NSH is brought up through a series of sequential initialization
|
||||
steps. This includes networking. If the network is available on
|
||||
|
@ -74,11 +74,15 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
CSRCS += nsh_netinit.c nsh_netcmds.c
|
||||
|
||||
ifeq ($(CONFIG_WIRELESS_WAPI),y)
|
||||
ifeq ($(CONFIG_NSH_NETINIT),y)
|
||||
ifneq ($(CONFIG_NSH_NETLOCAL),y)
|
||||
CSRCS += nsh_associate.c
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NET_ROUTE),y)
|
||||
CSRCS += nsh_routecmds.c
|
||||
endif
|
||||
|
@ -248,11 +248,12 @@ static void nsh_netinit_configure(void)
|
||||
struct in_addr addr;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NSH_DHCPC)
|
||||
#if defined(CONFIG_NSH_DHCPC) && !defined(CONFIG_NSH_NETLOCAL)
|
||||
FAR void *handle;
|
||||
#endif
|
||||
|
||||
#if (defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_NOMAC)) && defined(HAVE_MAC)
|
||||
#if (((defined(CONFIG_NSH_DHCPC) && !defined(CONFIG_NSH_NETLOCAL)) || \
|
||||
defined(CONFIG_NSH_NOMAC)) && defined(HAVE_MAC))
|
||||
#if defined(CONFIG_NET_ETHERNET)
|
||||
uint8_t mac[IFHWADDRLEN];
|
||||
#elif defined(CONFIG_NET_6LOWPAN)
|
||||
@ -358,9 +359,10 @@ static void nsh_netinit_configure(void)
|
||||
netlib_set_ipv4dnsaddr(&addr);
|
||||
#endif
|
||||
|
||||
/* New versions of netlib_set_ipvXaddr will not bring the network up,
|
||||
* So ensure the network is really up at this point.
|
||||
*/
|
||||
/* That completes the 'local' initialization of the network device. */
|
||||
|
||||
#ifndef CONFIG_NSH_NETLOCAL
|
||||
/* Bring the network up. */
|
||||
|
||||
netlib_ifup("eth0");
|
||||
|
||||
@ -413,6 +415,7 @@ static void nsh_netinit_configure(void)
|
||||
|
||||
ntpc_start();
|
||||
#endif
|
||||
#endif /* CONFIG_NSH_NETLOCAL */
|
||||
#endif /* NSH_HAVE_NETDEV */
|
||||
|
||||
ninfo("Exit\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user