apps/examples/tcpblaster: Fix several problems with the host is the client and the target in the server. Basic problem was that the host did not know the IP address of the target server due to several bugs and build issues that only seemed to affect this configuration.

This commit is contained in:
Gregory Nutt 2019-12-08 17:11:07 -06:00
parent 7b4a3ac5ac
commit e305592ce6
3 changed files with 41 additions and 9 deletions

View File

@ -85,10 +85,10 @@ ifneq ($(CONFIG_EXAMPLES_TCPBLASTER_LOOPBACK),y)
HOSTCFLAGS += -DTCPBLASTER_HOST=1
ifeq ($(CONFIG_EXAMPLES_TCPBLASTER_SERVER),y)
HOSTCFLAGS += -DCONFIG_EXAMPLES_TCPBLASTER_SERVER=1 -DCONFIG_EXAMPLES_TCPBLASTER_SERVERIP="$(CONFIG_EXAMPLES_TCPBLASTER_SERVERIP)"
HOSTCFLAGS += -DCONFIG_EXAMPLES_TCPBLASTER_SERVER=1 -DCONFIG_EXAMPLES_TCPBLASTER_SERVERIP=$(CONFIG_EXAMPLES_TCPBLASTER_SERVERIP)
endif
HOST_SRCS = tcpblaster_host.c
HOST_SRCS = tcpblaster_host.c tcpblaster_cmdline.c
ifeq ($(CONFIG_EXAMPLES_TCPBLASTER_SERVER),y)
HOST_SRCS += tcpblaster_client.c
HOST_BIN = tcpclient$(EXEEXT)

View File

@ -51,14 +51,42 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef HTONS
# ifdef CONFIG_ENDIAN_BIG
# define HTONS(ns) (ns)
# else
# define HTONS(ns) \
(unsigned short) \
(((((unsigned short)(ns)) & 0x00ff) << 8) | \
((((unsigned short)(ns)) >> 8) & 0x00ff))
# endif
#endif
#ifndef HTONL
# ifdef CONFIG_ENDIAN_BIG
# define HTONL(nl) (nl)
# else
# define HTONL(nl) \
(unsigned long) \
(((((unsigned long)(nl)) & 0x000000ffUL) << 24) | \
((((unsigned long)(nl)) & 0x0000ff00UL) << 8) | \
((((unsigned long)(nl)) & 0x00ff0000UL) >> 8) | \
((((unsigned long)(nl)) & 0xff000000UL) >> 24))
# endif
#endif
#ifndef NTOHS
# define NTOHS(hs) HTONS(hs)
#endif
#ifndef NTOHL
# define NTOHL(hl) HTONL(hl)
#endif
#ifdef TCPBLASTER_HOST
/* HTONS/L macros are unique to uIP */
# define HTONS(a) htons(a)
# define HTONL(a) htonl(a)
/* Have SO_LINGER */
# define FAR
# define TCPBLASTER_HAVE_SOLINGER 1
#else
@ -92,9 +120,9 @@
****************************************************************************/
#ifdef CONFIG_EXAMPLES_TCPBLASTER_IPv6
uint16_t g_tcpblasterserver_ipv6[8];
extern uint16_t g_tcpblasterserver_ipv6[8];
#else
uint32_t g_tcpblasterserver_ipv4;
extern uint32_t g_tcpblasterserver_ipv4;
#endif
/****************************************************************************

View File

@ -54,6 +54,10 @@
int main(int argc, char **argv, char **envp)
{
/* Parse any command line options */
tcpblaster_cmdline(argc, argv);
#ifdef CONFIG_EXAMPLES_TCPBLASTER_SERVER
tcpblaster_client();
#else