From 9dbfa9ca0ade7925116522151a565329bc442a79 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Fri, 19 Jan 2018 21:08:51 +0100 Subject: [PATCH] lwiperf: enable TCP over IPv6 connections tested against iperf 2.0.10 redefine LWIPERF_SERVER_IP_TYPE if you don't want both IP versions --- src/apps/lwiperf/lwiperf.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/apps/lwiperf/lwiperf.c b/src/apps/lwiperf/lwiperf.c index 742f63a7..274a78ec 100644 --- a/src/apps/lwiperf/lwiperf.c +++ b/src/apps/lwiperf/lwiperf.c @@ -52,8 +52,8 @@ #include -/* Currently, only TCP-over-IPv4 is implemented (does iperf support IPv6 anyway?) */ -#if LWIP_IPV4 && LWIP_TCP && LWIP_CALLBACK_API +/* Currently, only TCP is implemented (does iperf support IPv6 anyway?) */ +#if LWIP_TCP && LWIP_CALLBACK_API /** Specify the idle timeout (in seconds) after that the test fails */ #ifndef LWIPERF_TCP_MAX_IDLE_SEC @@ -63,6 +63,11 @@ #error LWIPERF_TCP_MAX_IDLE_SEC must fit into an u8_t #endif +/** Change this if you don't want to lwiperf to listen to any IP version */ +#ifndef LWIPERF_SERVER_IP_TYPE +#define LWIPERF_SERVER_IP_TYPE IPADDR_TYPE_ANY +#endif + /* File internal memory allocation (struct lwiperf_*): this defaults to the heap */ #ifndef LWIPERF_ALLOC @@ -365,7 +370,7 @@ lwiperf_tx_start(lwiperf_state_tcp_t *conn) if (client_conn == NULL) { return ERR_MEM; } - newpcb = tcp_new(); + newpcb = tcp_new_ip_type(IP_GET_TYPE(&conn->conn_pcb->remote_ip)); if (newpcb == NULL) { LWIPERF_FREE(lwiperf_state_tcp_t, client_conn); return ERR_MEM; @@ -614,7 +619,7 @@ lwiperf_start_tcp_server(const ip_addr_t *local_addr, u16_t local_port, s->report_fn = report_fn; s->report_arg = report_arg; - pcb = tcp_new(); + pcb = tcp_new_ip_type(LWIPERF_SERVER_IP_TYPE); if (pcb != NULL) { err = tcp_bind(pcb, local_addr, local_port); if (err == ERR_OK) { @@ -663,4 +668,4 @@ lwiperf_abort(void *lwiperf_session) } } -#endif /* LWIP_IPV4 && LWIP_TCP && LWIP_CALLBACK_API */ +#endif /* LWIP_TCP && LWIP_CALLBACK_API */