Browse Source

net-snmp: bump to 5.9

Neither the configure option nor configure variable to disable linking
against PCRE seem to work anymore, so simply drop both and add a
dependency on libpcre. As net-snmp is unlikely to fit on devices with
small flash anyway, the extra size requirement shouldn't be a problem.
If it is, feel free to submit a patch to fix the broken upstream
behaviour.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Stijn Tintel 10 months ago
parent
commit
4cdbe799b1

+ 14 - 0
net/net-snmp/Config.in.wut

@@ -0,0 +1,14 @@
+menu "Configuration"
+        depends on PACKAGE_libnetsnmp 
+
+config SNMP_WITH_PERL_EMBEDDED
+	bool
+	default n
+	prompt "Enable embedded perl in the SNMP agent and snmptrapd."
+
+config SNMP_WITH_PERL_MODULES
+	bool
+	default n
+	prompt "Install perl modules"
+
+endmenu

+ 4 - 5
net/net-snmp/Makefile

@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=net-snmp
-PKG_VERSION:=5.8
-PKG_RELEASE:=2
+PKG_VERSION:=5.9
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/net-snmp
-PKG_HASH:=b2fc3500840ebe532734c4786b0da4ef0a5f67e51ef4c86b3345d697e4976adf
+PKG_HASH:=04303a66f85d6d8b16d3cc53bde50428877c82ab524e17591dfceaeb94df6071
 PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
 PKG_LICENSE:=MIT BSD-3-Clause-Clear
 PKG_CPE_ID:=cpe:/a:net-snmp:net-snmp
@@ -41,7 +41,7 @@ define Package/libnetsnmp
 $(call Package/net-snmp/Default)
   SECTION:=libs
   CATEGORY:=Libraries
-  DEPENDS:=+libnl-tiny +libpci
+  DEPENDS:=+libnl-tiny +libpci +libpcre
   TITLE:=Open source SNMP implementation (libraries)
 endef
 
@@ -216,7 +216,6 @@ CONFIGURE_ARGS += \
 
 CONFIGURE_VARS += \
 	ac_cv_header_netlink_netlink_h=yes \
-	ac_cv_header_pcre_h=no \
 	netsnmp_cv_func_nl_connect_LIBS=-lnl-tiny \
 
 ifeq ($(CONFIG_IPV6),y)

+ 2 - 2
net/net-snmp/patches/000-cross-compile.patch

@@ -15,7 +15,7 @@ link tests to fail due to a stray "no" word getting passed to the linker.
 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
 --- a/configure.d/config_os_libs2
 +++ b/configure.d/config_os_libs2
-@@ -254,14 +254,22 @@ if test "x$with_nl" != "xno"; then
+@@ -247,14 +247,22 @@ if test "x$with_nl" != "xno"; then
          )
  
          netsnmp_save_CPPFLAGS="$CPPFLAGS"
@@ -23,7 +23,7 @@ Signed-off-by: Jo-Philipp Wich <jo@mein.io>
 -        NETSNMP_SEARCH_LIBS(nl_connect, nl-3,
 -            [AC_CHECK_HEADERS(netlink/netlink.h)
 -            EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES ${LIBNL3_CFLAGS}"],
--            [CPPFLAGS="$netsnmp_save_CPPFLAGS"], [], [], [LMIBLIBS])
+-            [CPPFLAGS="$netsnmp_save_CPPFLAGS"], [], [LMIBLIBS])
 +        netsnmp_netlink_include_flags=""
          if test "x$ac_cv_header_netlink_netlink_h" != xyes; then
 -            NETSNMP_SEARCH_LIBS(nl_connect, nl, [

+ 34 - 0
net/net-snmp/patches/010-HOST-MIB-hr_filesys-fix-compile-error.patch

@@ -0,0 +1,34 @@
+From 9588b5c9c27239b1f8c02f0bf417f13735e93225 Mon Sep 17 00:00:00 2001
+From: Stijn Tintel <stijn@linux-ipv6.be>
+Date: Sat, 26 Sep 2020 04:34:18 +0300
+Subject: [PATCH] HOST-MIB, hr_filesys: fix compile error
+
+On non-AIX systems without getfsstat, a variable is being declared right
+after a label. This is a violation of the C language standard, and
+causes the following compile error:
+
+host/hr_filesys.c: In function 'Get_Next_HR_FileSys':
+host/hr_filesys.c:752:5: error: a label can only be part of a statement and a declaration is not a statement
+     const char    **cpp;
+          ^~~~~
+
+Fix the problem by adding an empty statement after the label.
+
+Fixes: 22e1371bb1fd ("HOST-MIB, hr_filesys: Convert recursion into iteration")
+
+Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
+---
+ agent/mibgroup/host/hr_filesys.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/agent/mibgroup/host/hr_filesys.c
++++ b/agent/mibgroup/host/hr_filesys.c
+@@ -718,7 +718,7 @@ static const char *HRFS_ignores[] = {
+ int
+ Get_Next_HR_FileSys(void)
+ {
+-next:
++next: ;
+ #if HAVE_GETFSSTAT
+     if (HRFS_index >= fscount)
+         return -1;

+ 2 - 2
net/net-snmp/patches/100-debian-statistics.patch

@@ -1,6 +1,6 @@
 --- a/agent/mibgroup/mibII/interfaces.c
 +++ b/agent/mibgroup/mibII/interfaces.c
-@@ -1588,6 +1588,10 @@ Interface_Scan_Init(void)
+@@ -1579,6 +1579,10 @@ Interface_Scan_Init(void)
          struct ifnet   *nnew;
          char           *stats, *ifstart = line;
  
@@ -11,7 +11,7 @@
          if (line[strlen(line) - 1] == '\n')
              line[strlen(line) - 1] = '\0';
  
-@@ -1620,7 +1624,7 @@ Interface_Scan_Init(void)
+@@ -1611,7 +1615,7 @@ Interface_Scan_Init(void)
                                                 &coll) != 5)) {
              if ((scan_line_to_use == scan_line_2_2)
                  && !strstr(line, "No statistics available"))

+ 3 - 3
net/net-snmp/patches/160-no_ldconfig.patch

@@ -1,9 +1,9 @@
 --- a/configure
 +++ b/configure
-@@ -15097,7 +15097,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+@@ -15602,7 +15602,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu
    need_version=no
-   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-   soname_spec='${libname}${release}${shared_ext}$major'
+   library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+   soname_spec='$libname$release$shared_ext$major'
 -  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
 +  finish_cmds=''
    shlibpath_var=LD_LIBRARY_PATH

+ 1 - 1
net/net-snmp/patches/170-ldflags.patch

@@ -1,6 +1,6 @@
 --- a/Makefile.top
 +++ b/Makefile.top
-@@ -87,7 +87,7 @@ LIBCURRENT  = 35
+@@ -87,7 +87,7 @@ LIBCURRENT  = 40
  LIBAGE      = 0
  LIBREVISION = 0
  

+ 0 - 143
net/net-snmp/patches/910-signal.patch

@@ -1,143 +0,0 @@
-From 1ee70571e0cae37f155f59d4382bc7109138cf09 Mon Sep 17 00:00:00 2001
-From: Bart Van Assche <bvanassche@acm.org>
-Date: Sat, 15 Aug 2020 17:29:25 -0700
-Subject: [PATCH] apps/snmpnetstat: Stop using obsolete signal functions
-
-This was reported by Rosen Penev. See also
-https://github.com/net-snmp/net-snmp/pull/162.
----
- apps/snmpnetstat/if.c | 111 +++++++++++-------------------------------
- 1 file changed, 28 insertions(+), 83 deletions(-)
- mode change 100644 => 100755 apps/snmpnetstat/if.c
-
---- a/apps/snmpnetstat/if.c
-+++ b/apps/snmpnetstat/if.c
-@@ -64,8 +64,6 @@ static char *rcsid = "$OpenBSD: if.c,v 1
- #define	NO	0
- 
- static void sidewaysintpr(u_int);
--static void timerSet(int interval_seconds);
--static void timerPause(void);
- 
-     struct _if_info {
-         char            name[128];
-@@ -92,6 +90,34 @@ static void timerPause(void);
-     };
- 
- 
-+static struct timeval deadline;
-+
-+static void
-+timerSet(int interval_seconds)
-+{
-+    const struct timeval interval = { interval_seconds, 0 };
-+
-+    netsnmp_get_monotonic_clock(&deadline);
-+    NETSNMP_TIMERADD(&deadline, &interval, &deadline);
-+}
-+
-+static void
-+timerPause(void)
-+{
-+    struct timeval now, delta;
-+
-+    netsnmp_get_monotonic_clock(&now);
-+    NETSNMP_TIMERSUB(&deadline, &now, &delta);
-+    if (delta.tv_sec < 0)
-+        return;
-+#ifdef WIN32
-+    Sleep(delta.tv_sec * 1000 + delta.tv_usec / 1000);
-+#else
-+    if (select(0, NULL, NULL, NULL, &delta) < 0)
-+        snmp_perror("select");
-+#endif
-+}
-+
- /*
-  * Retrieve the interface addressing information
-  * XXX - This could also be extended to handle non-IP interfaces
-@@ -845,84 +871,3 @@ loop:
-     	goto loop;
-     /*NOTREACHED*/
- }
--
--
--/*
-- * timerSet sets or resets the timer to fire in "interval" seconds.
-- * timerPause waits only if the timer has not fired.
-- * timing precision is not considered important.
-- */
--
--#if (defined(WIN32) || defined(cygwin))
--static int      sav_int;
--static time_t   timezup;
--static void
--timerSet(int interval_seconds)
--{
--    sav_int = interval_seconds;
--    timezup = time(0) + interval_seconds;
--}
--
--/*
-- * you can do better than this ! 
-- */
--static void
--timerPause(void)
--{
--    time_t          now;
--    while (time(&now) < timezup)
--#ifdef WIN32
--        Sleep(400);
--#else
--    {
--        struct timeval  tx;
--        tx.tv_sec = 0;
--        tx.tv_usec = 400 * 1000;        /* 400 milliseconds */
--        select(0, 0, 0, 0, &tx);
--    }
--#endif
--}
--
--#else
--
--/*
-- * Called if an interval expires before sidewaysintpr has completed a loop.
-- * Sets a flag to not wait for the alarm.
-- */
--RETSIGTYPE
--catchalarm(int sig)
--{
--    signalled = YES;
--}
--
--static void
--timerSet(int interval_seconds)
--{
--#ifdef HAVE_SIGSET
--    (void) sigset(SIGALRM, catchalarm);
--#else
--    (void) signal(SIGALRM, catchalarm);
--#endif
--    signalled = NO;
--    (void) alarm(interval_seconds);
--}
--
--static void
--timerPause(void)
--{
--#ifdef HAVE_SIGHOLD
--    sighold(SIGALRM);
--    if (!signalled) {
--        sigpause(SIGALRM);
--    }
--#else
--    int             oldmask;
--    oldmask = sigblock(sigmask(SIGALRM));
--    if (!signalled) {
--        sigpause(0);
--    }
--    sigsetmask(oldmask);
--#endif
--}
--
--#endif                          /* !WIN32 && !cygwin */