package/netsnmp: add upstream patches to fix musl build

The bump of netsnmp to version 5.9.4 with buildroot commit
1799cfebfd broke musl builds:

../include/net-snmp/net-snmp-config.h:1614:30: error: unknown type name 'unknown'; did you mean 'union'?

due to broken detection of __fd_mask introduced in 5.9.4 by upstream
commit 97df191ff8

Added two upstream patches for __fd_mask detection to fix musl builds.

Fixes:
https://autobuild.buildroot.net/results/9d7/9d75061ca917689381c3b32f3e01640701d833a7/

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Bernd Kuhls
2025-10-26 16:48:40 +01:00
committed by Julien Olivain
parent 70fdbeb647
commit fe01d702a1
2 changed files with 120 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
From af1b7f77975bbb2fcbdb3f005f8cb010d1d33cd3 Mon Sep 17 00:00:00 2001
From: Adam Gajda <adgajda@users.noreply.github.com>
Date: Mon, 2 Oct 2023 16:40:31 +0200
Subject: [PATCH] Fix configuration of NETSNMP_FD_MASK_TYPE
Upstream: https://github.com/net-snmp/net-snmp/commit/af1b7f77975bbb2fcbdb3f005f8cb010d1d33cd3
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
configure | 2 +-
configure.d/config_project_types | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 50522690f5..5512349926 100755
--- a/configure
+++ b/configure
@@ -31577,7 +31577,7 @@ CFLAGS="$CFLAGS -Werror"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the type of fd_set::fds_bits" >&5
printf %s "checking for the type of fd_set::fds_bits... " >&6; }
-for type in __fd_mask __int32_t unknown; do
+for type in __fd_mask __int32_t long\ int unknown; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
diff --git a/configure.d/config_project_types b/configure.d/config_project_types
index 1b4c66b95e..a78e8ebb06 100644
--- a/configure.d/config_project_types
+++ b/configure.d/config_project_types
@@ -66,7 +66,7 @@ netsnmp_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror"
AC_MSG_CHECKING([for the type of fd_set::fds_bits])
-for type in __fd_mask __int32_t unknown; do
+for type in __fd_mask __int32_t long\ int unknown; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <sys/select.h>
#include <stddef.h>

View File

@@ -0,0 +1,81 @@
From b4598662a39ff6974119c900ea56a4d020eac366 Mon Sep 17 00:00:00 2001
From: Bart Van Assche <bvanassche@acm.org>
Date: Wed, 20 Dec 2023 13:08:06 -0800
Subject: [PATCH] Android: Fix the build
Include <sys/select.h> for the fd_set type. In the configure script,
check whether 'unsigned long' is the underlying type of fd_set. Use
u_long instead of ulong.
Upstream: https://github.com/net-snmp/net-snmp/commit/b4598662a39ff6974119c900ea56a4d020eac366
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
agent/mibgroup/ip-mib/data_access/ipaddress_linux.c | 4 ++--
configure | 2 +-
configure.d/config_project_types | 2 +-
include/net-snmp/types.h | 3 +++
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
index b38beb57dd..232202d0f9 100644
--- a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
+++ b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
@@ -50,7 +50,7 @@ int _load_v6(netsnmp_container *container, int idx_offset);
int
netsnmp_access_ipaddress_extra_prefix_info(int index,
u_long *preferedlt,
- ulong *validlt,
+ u_long *validlt,
char *addr);
#endif
@@ -523,7 +523,7 @@ netsnmp_access_other_info_get(int index, int family)
int
netsnmp_access_ipaddress_extra_prefix_info(int index, u_long *preferedlt,
- ulong *validlt, char *addr)
+ u_long *validlt, char *addr)
{
struct {
diff --git a/configure b/configure
index e7bf859bba..48abcbab11 100755
--- a/configure
+++ b/configure
@@ -31577,7 +31577,7 @@ CFLAGS="$CFLAGS -Werror"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the type of fd_set::fds_bits" >&5
printf %s "checking for the type of fd_set::fds_bits... " >&6; }
-for type in __fd_mask __int32_t long\ int unknown; do
+for type in __fd_mask __int32_t long 'unsigned long' unknown; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
diff --git a/configure.d/config_project_types b/configure.d/config_project_types
index a78e8ebb06..ac958d6712 100644
--- a/configure.d/config_project_types
+++ b/configure.d/config_project_types
@@ -66,7 +66,7 @@ netsnmp_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror"
AC_MSG_CHECKING([for the type of fd_set::fds_bits])
-for type in __fd_mask __int32_t long\ int unknown; do
+for type in __fd_mask __int32_t long 'unsigned long' unknown; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <sys/select.h>
#include <stddef.h>
diff --git a/include/net-snmp/types.h b/include/net-snmp/types.h
index b78f53ffd7..6228170e5f 100644
--- a/include/net-snmp/types.h
+++ b/include/net-snmp/types.h
@@ -23,6 +23,9 @@
#endif
#include <sys/types.h>
+#ifdef __ANDROID__
+#include <sys/select.h>
+#endif
#if defined(WIN32) && !defined(cygwin)
typedef HANDLE netsnmp_pid_t;