iperf2: Add _GNU_SOURCE in checksums.c

glibc defines struct udphdr as a union where members have aliased names

uh_sport -> source
uh_dport -> uh_dport
uh_dport -> len
check -> check

But musl only defines the aliases if _GNU_SOURCE is defined, ideally
iperf2 should be using uh_* names of the members so it is portable across
musl and glibc but thats for upstream to consider.

Fixes
| ../../iperf-2.2.1/src/checksums.c:175:19: error: no member named 'check' in 'struct udphdr'
|   175 |     if (!udp_hdr->check) {
|       |          ~~~~~~~  ^
| 1 error generated.
| make[2]: *** [Makefile:539: checksums.o] Error 1

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Randy MacLeod <Randy.MacLeod@windriver.com>
This commit is contained in:
Khem Raj 2025-03-28 19:12:41 -07:00
parent 7f8c99bacf
commit e9567c58f8
No known key found for this signature in database
GPG Key ID: BB053355919D3314
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,26 @@
From a25566dd66fb0ca951b3b6f6fa5a4bfaac276c71 Mon Sep 17 00:00:00 2001
From: Robert McMahon <rjmcmahon@rjmcmahon.com>
Date: Tue, 12 Nov 2024 12:06:54 -0800
Subject: [PATCH] fix for buildroot linux breakage, ticket 342
Upstream-Status: Backport [https://sourceforge.net/p/iperf2/code/ci/a25566dd66fb0ca951b3b6f6fa5a4bfaac276c71/]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/checksums.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/checksums.c b/src/checksums.c
index 852f1952..d7a8109e 100644
--- a/src/checksums.c
+++ b/src/checksums.c
@@ -47,6 +47,9 @@
* by Robert J. McMahon (rjmcmahon@rjmcmahon.com, bob.mcmahon@broadcom.com)
* -------------------------------------------------------------------
*/
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
#include "headers.h"
/*

View File

@ -5,6 +5,7 @@ LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=e136a7b2560d80bcbf0d9b3e1356ecff"
SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/iperf-${PV}.tar.gz \
file://0001-fix-for-buildroot-linux-breakage-ticket-342.patch \
"
SRC_URI[sha256sum] = "754ab0a7e28033dbea81308ef424bc7df4d6e2fe31b60cc536b61b51fefbd8fb"