Skip to content

Commit 5c8b7cd

Browse files
JordanYateskartben
authored andcommitted
net: lib: zperf: fix internal UDP header definition
Fix the zperf UDP datagram header definition, as iperf introduced a backwards incompatible format change in version 2.0.10 (August 2017). ``` struct UDP_datagram { // used to reference the 4 byte ID number we place in UDP datagrams // Support 64 bit seqno on machines that support them uint32_t id; uint32_t tv_sec; uint32_t tv_usec; uint32_t id2; }; ``` Update the header to the new format, with a Kconfig option to fall back to the previous header definition. The response decoding was testd with a nRF7002 client and `iperf-2.2.1-win64.exe` server, with the output statistics struct now containing the same information as reported on the PC server. Signed-off-by: Jordan Yates <jordan@embeint.com>
1 parent 5f20f41 commit 5c8b7cd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

subsys/net/lib/zperf/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ menuconfig NET_ZPERF
1313

1414
if NET_ZPERF
1515

16+
config NET_ZPERF_LEGACY_HEADER_COMPAT
17+
bool "Legacy iperf UDP header format"
18+
help
19+
iperf 2.0.10 (2017) updated the UDP header format in a
20+
backwards incompatible manner that cannot be automatically
21+
detected. This option reverts the header format for use with
22+
iperf version 2.0.9 and earlier.
23+
1624
config ZPERF_WORK_Q_THREAD_PRIORITY
1725
int "zperf work queue thread priority"
1826
default NUM_PREEMPT_PRIORITIES

subsys/net/lib/zperf/zperf_internal.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@
5454
#define ZPERF_VERSION "1.1"
5555

5656
struct zperf_udp_datagram {
57-
int32_t id;
57+
uint32_t id;
5858
uint32_t tv_sec;
5959
uint32_t tv_usec;
60+
#ifndef CONFIG_NET_ZPERF_LEGACY_HEADER_COMPAT
61+
uint32_t id2;
62+
#endif
6063
} __packed;
6164

6265
BUILD_ASSERT(sizeof(struct zperf_udp_datagram) <= PACKET_SIZE_MAX, "Invalid PACKET_SIZE_MAX");

0 commit comments

Comments
 (0)