apps/examples/nettest: Add option to suppress networking initialization
This commit is contained in:
parent
b7b943067a
commit
6cedfcd632
@ -1412,4 +1412,7 @@
|
|||||||
substantial effect on system image size. Mainly code/text. If
|
substantial effect on system image size. Mainly code/text. If
|
||||||
loading of applications at runtime is not planned do not select
|
loading of applications at runtime is not planned do not select
|
||||||
this. From Pavel Pisa (2015-08-23).
|
this. From Pavel Pisa (2015-08-23).
|
||||||
|
* apps/nettest: Add option to suppress network initialization. This
|
||||||
|
is necessary if the nettest is run from NSH which has already
|
||||||
|
initialized the network (2015-08-26).
|
||||||
|
|
||||||
|
@ -26,10 +26,6 @@ config EXAMPLES_NETTEST_PERFORMANCE
|
|||||||
Configure the example to test for network performance. Default: Test
|
Configure the example to test for network performance. Default: Test
|
||||||
is for network functionality.
|
is for network functionality.
|
||||||
|
|
||||||
config EXAMPLES_NETTEST_NOMAC
|
|
||||||
bool "Use Canned MAC Address"
|
|
||||||
default n
|
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "IP Domain"
|
prompt "IP Domain"
|
||||||
default EXAMPLES_NETTEST_IPv4 if NET_IPv4
|
default EXAMPLES_NETTEST_IPv4 if NET_IPv4
|
||||||
@ -45,10 +41,28 @@ config EXAMPLES_NETTEST_IPv6
|
|||||||
|
|
||||||
endchoice # IP Domain
|
endchoice # IP Domain
|
||||||
|
|
||||||
|
config EXAMPLES_NETTEST_INIT
|
||||||
|
bool "Initialize network"
|
||||||
|
default n if NSH_BUILTIN_APPS
|
||||||
|
default y if !NSH_BUILTIN_APPS
|
||||||
|
depends on !BUILD_KERNEL
|
||||||
|
---help---
|
||||||
|
Include logic to initialize the network. This should not be done if
|
||||||
|
the network is already initialized when nettest runs. This is
|
||||||
|
usually the case, for example, when nettest is run as an NSH built-
|
||||||
|
in task.
|
||||||
|
|
||||||
|
config EXAMPLES_NETTEST_NOMAC
|
||||||
|
bool "Use Canned MAC Address"
|
||||||
|
default n
|
||||||
|
depends on EXAMPLES_NETTEST_INIT
|
||||||
|
|
||||||
if EXAMPLES_NETTEST_IPv4
|
if EXAMPLES_NETTEST_IPv4
|
||||||
|
|
||||||
comment "IPv4 addresses"
|
comment "IPv4 addresses"
|
||||||
|
|
||||||
|
if EXAMPLES_NETTEST_INIT
|
||||||
|
|
||||||
config EXAMPLES_NETTEST_IPADDR
|
config EXAMPLES_NETTEST_IPADDR
|
||||||
hex "Target IP address"
|
hex "Target IP address"
|
||||||
default 0x0a000002
|
default 0x0a000002
|
||||||
@ -61,6 +75,8 @@ config EXAMPLES_NETTEST_NETMASK
|
|||||||
hex "Network Mask"
|
hex "Network Mask"
|
||||||
default 0xffffff00
|
default 0xffffff00
|
||||||
|
|
||||||
|
endif # EXAMPLES_NETTEST_INIT
|
||||||
|
|
||||||
config EXAMPLES_NETTEST_CLIENTIP
|
config EXAMPLES_NETTEST_CLIENTIP
|
||||||
hex "Client IP Address"
|
hex "Client IP Address"
|
||||||
default 0x0a000001 if !EXAMPLES_NETTEST_SERVER
|
default 0x0a000001 if !EXAMPLES_NETTEST_SERVER
|
||||||
@ -80,6 +96,8 @@ if !NET_ICMPv6_AUTOCONF
|
|||||||
|
|
||||||
comment "Target IPv6 address"
|
comment "Target IPv6 address"
|
||||||
|
|
||||||
|
if EXAMPLES_NETTEST_INIT
|
||||||
|
|
||||||
config EXAMPLES_NETTEST_IPv6ADDR_1
|
config EXAMPLES_NETTEST_IPv6ADDR_1
|
||||||
hex "[0]"
|
hex "[0]"
|
||||||
default 0xfc00
|
default 0xfc00
|
||||||
@ -325,6 +343,7 @@ config EXAMPLES_NETTEST_IPv6NETMASK_8
|
|||||||
all eight values is fe00::0.
|
all eight values is fe00::0.
|
||||||
|
|
||||||
endif # NET_ICMPv6_AUTOCONF
|
endif # NET_ICMPv6_AUTOCONF
|
||||||
|
endif # EXAMPLES_NETTEST_INIT
|
||||||
|
|
||||||
comment "Client IPv6 address"
|
comment "Client IPv6 address"
|
||||||
|
|
||||||
|
@ -60,7 +60,9 @@
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_EXAMPLES_NETTEST_IPv6) && !defined(CONFIG_NET_ICMPv6_AUTOCONF)
|
#if defined(CONFIG_EXAMPLES_NETTEST_INIT) && \
|
||||||
|
defined(CONFIG_EXAMPLES_NETTEST_IPv6) && \
|
||||||
|
!defined(CONFIG_NET_ICMPv6_AUTOCONF)
|
||||||
/* Our host IPv6 address */
|
/* Our host IPv6 address */
|
||||||
|
|
||||||
static const uint16_t g_ipv6_hostaddr[8] =
|
static const uint16_t g_ipv6_hostaddr[8] =
|
||||||
@ -102,21 +104,14 @@ static const uint16_t g_ipv6_netmask[8] =
|
|||||||
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_7),
|
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_7),
|
||||||
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_8),
|
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_8),
|
||||||
};
|
};
|
||||||
#endif /* CONFIG_EXAMPLES_NETTEST_IPv6 && !CONFIG_NET_ICMPv6_AUTOCONF */
|
#endif /* CONFIG_EXAMPLES_NETTEST_INIT && CONFIG_EXAMPLES_NETTEST_IPv6 && !CONFIG_NET_ICMPv6_AUTOCONF */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
#ifdef CONFIG_EXAMPLES_NETTEST_INIT
|
||||||
* nettest_main
|
static void netest_initialize(void)
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_BUILD_KERNEL
|
|
||||||
int main(int argc, FAR char *argv[])
|
|
||||||
#else
|
|
||||||
int nettest_main(int argc, char *argv[])
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_EXAMPLES_NETTEST_IPv6
|
#ifndef CONFIG_EXAMPLES_NETTEST_IPv6
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
@ -179,10 +174,36 @@ int nettest_main(int argc, char *argv[])
|
|||||||
netlib_set_ipv4netmask("eth0", &addr);
|
netlib_set_ipv4netmask("eth0", &addr);
|
||||||
|
|
||||||
#endif /* CONFIG_EXAMPLES_NETTEST_IPv6 */
|
#endif /* CONFIG_EXAMPLES_NETTEST_IPv6 */
|
||||||
|
}
|
||||||
|
#endif /*CONFIG_EXAMPLES_NETTEST_INIT */
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* nettest_main
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_BUILD_KERNEL
|
||||||
|
int main(int argc, FAR char *argv[])
|
||||||
|
#else
|
||||||
|
int nettest_main(int argc, char *argv[])
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_EXAMPLES_NETTEST_INIT
|
||||||
|
/* Initialize the network */
|
||||||
|
|
||||||
|
netest_initialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_EXAMPLES_NETTEST_SERVER
|
#ifdef CONFIG_EXAMPLES_NETTEST_SERVER
|
||||||
|
/* Then perform the server side of the test */
|
||||||
|
|
||||||
recv_server();
|
recv_server();
|
||||||
#else
|
#else
|
||||||
|
/* Then perform the client side of the test */
|
||||||
|
|
||||||
send_client();
|
send_client();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user