examples/udpblaster: Several fixes to work with 6loWPAN.

This commit is contained in:
Gregory Nutt 2017-04-06 09:37:52 -06:00
parent 35cf98d4df
commit 14fc6d7575
6 changed files with 76 additions and 66 deletions

View File

@ -99,9 +99,6 @@ else
INSTALL_DIR = $(BIN_DIR) INSTALL_DIR = $(BIN_DIR)
endif endif
CONFIG_XYZ_PROGNAME ?= nettest$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
# NET test built-in application info # NET test built-in application info

View File

@ -12,6 +12,22 @@ config EXAMPLES_UDPBLASTER
if EXAMPLES_UDPBLASTER if EXAMPLES_UDPBLASTER
config EXAMPLES_UDPBLASTER_PROGNAME
string "Program name"
default "nettest"
depends on BUILD_KERNEL
---help---
This is the name of the program that will be use when the Nettest
program is installed.
config EXAMPLES_UDPBLASTER_STACKSIZE
int "Nettest stack size"
default 2048
config EXAMPLES_UDPBLASTER_PRIORITY
int "Nettest priority"
default 100
config EXAMPLES_UDPBLASTER_HOSTRATE config EXAMPLES_UDPBLASTER_HOSTRATE
int "Host send rate (bits/second)" int "Host send rate (bits/second)"
default 800000 default 800000
@ -153,87 +169,87 @@ config EXAMPLES_UDPBLASTER_TARGETIPv6_8
specified individually. This is the last of the 8-values. The specified individually. This is the last of the 8-values. The
default for all eight values is fc00::2. default for all eight values is fc00::2.
comment "Router IPv6 address" comment "Host IPv6 address"
config EXAMPLES_UDPBLASTER_HOSTIPv6_1 config EXAMPLES_UDPBLASTER_HOSTIPv6_1
hex "[0]" hex "[0]"
default 0xfc00 default 0xfc00
range 0x0 0xffff range 0x0 0xffff
---help--- ---help---
Default router IP address (aka, Gateway). This is a 16-bit integer Host IP address. This is a 16-bit integer value in host order.
value in host order. Each of the eight values forming the full IP Each of the eight values forming the full IP address must be
address must be specified individually. This is the first of the specified individually. This is the first of the 8-values.
8-values. The default for all eight values is fc00::1. The default for all eight values is fc00::1.
config EXAMPLES_UDPBLASTER_HOSTIPv6_2 config EXAMPLES_UDPBLASTER_HOSTIPv6_2
hex "[1]" hex "[1]"
default 0x0000 default 0x0000
range 0x0 0xffff range 0x0 0xffff
---help--- ---help---
Default router IP address (aka, Gateway). This is a 16-bit integer Host IP address. This is a 16-bit integer value in host order.
value in host order. Each of the eight values forming the full IP Each of the eight values forming the full IP address must be
address must be specified individually. This is the second of the specified individually. This is the second of the 8-values.
8-values. The default for all eight values is fc00::1. The default for all eight values is fc00::1.
config EXAMPLES_UDPBLASTER_HOSTIPv6_3 config EXAMPLES_UDPBLASTER_HOSTIPv6_3
hex "[2]" hex "[2]"
default 0x0000 default 0x0000
range 0x0 0xffff range 0x0 0xffff
---help--- ---help---
Default router IP address (aka, Gateway). This is a 16-bit integer Host IP address. This is a 16-bit integer value in host order.
value in host order. Each of the eight values forming the full IP Each of the eight values forming the full IP address must be
address must be specified individually. This is the third of the specified individually. This is the third of the 8-values.
8-values. The default for all eight values is fc00::1. The default for all eight values is fc00::1.
config EXAMPLES_UDPBLASTER_HOSTIPv6_4 config EXAMPLES_UDPBLASTER_HOSTIPv6_4
hex "[3]" hex "[3]"
default 0x0000 default 0x0000
range 0x0 0xffff range 0x0 0xffff
---help--- ---help---
Default router IP address (aka, Gateway). This is a 16-bit integer Host IP address. This is a 16-bit integer value in host order.
value in host order. Each of the eight values forming the full IP Each of the eight values forming the full IP address must be
address must be specified individually. This is the fourth of the specified individually. This is the fourth of the 8-values.
8-values. The default for all eight values is fc00::1. The default for all eight values is fc00::1.
config EXAMPLES_UDPBLASTER_HOSTIPv6_5 config EXAMPLES_UDPBLASTER_HOSTIPv6_5
hex "[4]" hex "[4]"
default 0x0000 default 0x0000
range 0x0 0xffff range 0x0 0xffff
---help--- ---help---
Default router IP address (aka, Gateway). This is a 16-bit integer Host IP address. This is a 16-bit integer value in host order.
value in host order. Each of the eight values forming the full IP Each of the eight values forming the full IP address must be
address must be specified individually. This is the fifth of the specified individually. This is the fifth of the 8-values.
8-values. The default for all eight values is fc00::1. The default for all eight values is fc00::1.
config EXAMPLES_UDPBLASTER_HOSTIPv6_6 config EXAMPLES_UDPBLASTER_HOSTIPv6_6
hex "[5]" hex "[5]"
default 0x0000 default 0x0000
range 0x0 0xffff range 0x0 0xffff
---help--- ---help---
Default router IP address (aka, Gateway). This is a 16-bit integer Host IP address. This is a 16-bit integer value in host order.
value in host order. Each of the eight values forming the full IP Each of the eight values forming the full IP address must be
address must be specified individually. This is the sixth of the specified individually. This is the sixth of the 8-values.
8-values. The default for all eight values is fc00::1. The default for all eight values is fc00::1.
config EXAMPLES_UDPBLASTER_HOSTIPv6_7 config EXAMPLES_UDPBLASTER_HOSTIPv6_7
hex "[6]" hex "[6]"
default 0x0000 default 0x0000
range 0x0 0xffff range 0x0 0xffff
---help--- ---help---
Default router IP address (aka, Gateway). This is a 16-bit integer Host IP address. This is a 16-bit integer value in host order.
value in host order. Each of the eight values forming the full IP Each of the eight values forming the full IP address must be
address must be specified individually. This is the seventh of the specified individually. This is the seventh of the 8-values.
8-values. The default for all eight values is fc00::1. The default for all eight values is fc00::1.
config EXAMPLES_UDPBLASTER_HOSTIPv6_8 config EXAMPLES_UDPBLASTER_HOSTIPv6_8
hex "[7]" hex "[7]"
default 0x0001 default 0x0001
range 0x0 0xffff range 0x0 0xffff
---help--- ---help---
Default router IP address (aka, Gateway). This is a 16-bit integer Host IP address. This is a 16-bit integer value in host order.
value in host order. Each of the eight values forming the full IP Each of the eight values forming the full IP address must be
address must be specified individually. This is the last of the specified individually. This is the last of the 8-values.
8-values. The default for all eight values is fc00::1. The default for all eight values is fc00::1.
if EXAMPLES_UDPBLASTER_INIT if EXAMPLES_UDPBLASTER_INIT

View File

@ -79,16 +79,19 @@ else
INSTALL_DIR = $(BIN_DIR) INSTALL_DIR = $(BIN_DIR)
endif endif
CONFIG_XYZ_PROGNAME ?= udpblaster$(EXEEXT) CONFIG_UPBLASTER_PROGNAME ?= udpblaster$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME) PROGNAME = $(CONFIG_UPBLASTER_PROGNAME)
ROOTDEPPATH = --dep-path . ROOTDEPPATH = --dep-path .
# NET test built-in application info # NET test built-in application info
CONFIG_EXAMPLES_UDPBLASTER_STACKSIZE ?= 2048
CONFIG_EXAMPLES_UDPBLASTER_PRIORITY ?= 100
APPNAME = udpblaster APPNAME = udpblaster
PRIORITY = SCHED_PRIORITY_DEFAULT PRIORITY = $(CONFIG_EXAMPLES_UDPBLASTER_PRIORITY)
STACKSIZE = 2048 STACKSIZE = $(CONFIG_EXAMPLES_UDPBLASTER_STACKSIZE)
# Common build # Common build

View File

@ -88,7 +88,6 @@
# else # else
# define UDPBLASTER_MSS (UDPBLASTER_MTU - ETH_HDRLEN - IPv4_HDRLEN - UDP_HDRLEN) # define UDPBLASTER_MSS (UDPBLASTER_MTU - ETH_HDRLEN - IPv4_HDRLEN - UDP_HDRLEN)
# endif # endif
#
#elif defined(CONFIG_NET_LOOPBACK) #elif defined(CONFIG_NET_LOOPBACK)
# define UDPBLASTER_MTU 1518 # define UDPBLASTER_MTU 1518
# ifdef CONFIG_EXAMPLES_UDPBLASTER_IPv6 # ifdef CONFIG_EXAMPLES_UDPBLASTER_IPv6
@ -96,6 +95,9 @@
# else # else
# define UDPBLASTER_MSS (UDPBLASTER_MTU - IPv4_HDRLEN - UDP_HDRLEN) # define UDPBLASTER_MSS (UDPBLASTER_MTU - IPv4_HDRLEN - UDP_HDRLEN)
# endif # endif
#elif defined(CONFIG_NET_6LOWPAN)
# define UDPBLASTER_MTU CONFIG_NET_6LOWPAN_MTU
# define UDPBLASTER_MSS (CONFIG_NET_6LOWPAN_MTU - IPv6_HDRLEN - UDP_HDRLEN)
#elif defined(CONFIG_NET_SLIP) #elif defined(CONFIG_NET_SLIP)
# define UDPBLASTER_MTU CONFIG_NET_SLIP_MTU # define UDPBLASTER_MTU CONFIG_NET_SLIP_MTU
# ifdef CONFIG_EXAMPLES_UDPBLASTER_IPv6 # ifdef CONFIG_EXAMPLES_UDPBLASTER_IPv6

View File

@ -48,14 +48,6 @@
#include "udpblaster.h" #include "udpblaster.h"
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* main * main
****************************************************************************/ ****************************************************************************/
@ -91,14 +83,14 @@ int main(int argc, char **argv, char **envp)
#else #else
target.sin6_family = AF_INET6; target.sin6_family = AF_INET6;
target.sin6_port = HTONS(UDPBLASTER_PORTNO); target.sin6_port = HTONS(UDPBLASTER_PORTNO);
target.sin6_addr.s6_addr16[0] = HTONL(EXAMPLES_UDPBLASTER_TARGETIPv6_1); target.sin6_addr.s6_addr16[0] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_1);
target.sin6_addr.s6_addr16[1] = HTONL(EXAMPLES_UDPBLASTER_TARGETIPv6_2); target.sin6_addr.s6_addr16[1] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_2);
target.sin6_addr.s6_addr16[2] = HTONL(EXAMPLES_UDPBLASTER_TARGETIPv6_3); target.sin6_addr.s6_addr16[2] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_3);
target.sin6_addr.s6_addr16[3] = HTONL(EXAMPLES_UDPBLASTER_TARGETIPv6_4); target.sin6_addr.s6_addr16[3] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_4);
target.sin6_addr.s6_addr16[4] = HTONL(EXAMPLES_UDPBLASTER_TARGETIPv6_5); target.sin6_addr.s6_addr16[4] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_5);
target.sin6_addr.s6_addr16[5] = HTONL(EXAMPLES_UDPBLASTER_TARGETIPv6_6); target.sin6_addr.s6_addr16[5] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_6);
target.sin6_addr.s6_addr16[6] = HTONL(EXAMPLES_UDPBLASTER_TARGETIPv6_7); target.sin6_addr.s6_addr16[6] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_7);
target.sin6_addr.s6_addr16[7] = HTONL(EXAMPLES_UDPBLASTER_TARGETIPv6_8); target.sin6_addr.s6_addr16[7] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_TARGETIPv6_8);
addrlen = sizeof(struct sockaddr_in6); addrlen = sizeof(struct sockaddr_in6);
sockfd = socket(PF_INET6, SOCK_DGRAM, 0); sockfd = socket(PF_INET6, SOCK_DGRAM, 0);

View File

@ -223,20 +223,20 @@ int udpblaster_main(int argc, char *argv[])
#else #else
host.sin6_family = AF_INET6; host.sin6_family = AF_INET6;
host.sin6_port = HTONS(UDPBLASTER_PORTNO); host.sin6_port = HTONS(UDPBLASTER_PORTNO);
host.sin6_addr.s6_addr16[0] = HTONL(EXAMPLES_UDPBLASTER_HOSTIPv6_1); host.sin6_addr.s6_addr16[0] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_1);
host.sin6_addr.s6_addr16[1] = HTONL(EXAMPLES_UDPBLASTER_HOSTIPv6_2); host.sin6_addr.s6_addr16[1] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_2);
host.sin6_addr.s6_addr16[2] = HTONL(EXAMPLES_UDPBLASTER_HOSTIPv6_3); host.sin6_addr.s6_addr16[2] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_3);
host.sin6_addr.s6_addr16[3] = HTONL(EXAMPLES_UDPBLASTER_HOSTIPv6_4); host.sin6_addr.s6_addr16[3] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_4);
host.sin6_addr.s6_addr16[4] = HTONL(EXAMPLES_UDPBLASTER_HOSTIPv6_5); host.sin6_addr.s6_addr16[4] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_5);
host.sin6_addr.s6_addr16[5] = HTONL(EXAMPLES_UDPBLASTER_HOSTIPv6_6); host.sin6_addr.s6_addr16[5] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_6);
host.sin6_addr.s6_addr16[6] = HTONL(EXAMPLES_UDPBLASTER_HOSTIPv6_7); host.sin6_addr.s6_addr16[6] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_7);
host.sin6_addr.s6_addr16[7] = HTONL(EXAMPLES_UDPBLASTER_HOSTIPv6_8); host.sin6_addr.s6_addr16[7] = HTONS(CONFIG_EXAMPLES_UDPBLASTER_HOSTIPv6_8);
addrlen = sizeof(struct sockaddr_in6); addrlen = sizeof(struct sockaddr_in6);
sockfd = socket(PF_INET6, SOCK_DGRAM, 0); sockfd = socket(PF_INET6, SOCK_DGRAM, 0);
if (sockfd < 0) if (sockfd < 0)
{ {
fprintf(stderr, "ERROR: socket() failed: %d\n", errno) fprintf(stderr, "ERROR: socket() failed: %d\n", errno);
return 1; return 1;
} }
#endif #endif