From aa008d13dcbfe7bb980f54ffeb573ab9711d06d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Sun, 28 Feb 2021 14:31:04 +0100 Subject: [PATCH] - rel 3; rediff patches --- net-snmp-logging.patch | 67 +++++++++---------- net-snmp-manpage.patch | 11 ++-- net-snmp-use-rpm-hrmib.patch | 121 ++++++++++++++++++----------------- net-snmp.spec | 2 +- 4 files changed, 104 insertions(+), 97 deletions(-) diff --git a/net-snmp-logging.patch b/net-snmp-logging.patch index 26337b0..aa0e68d 100644 --- a/net-snmp-logging.patch +++ b/net-snmp-logging.patch @@ -1,11 +1,11 @@ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=475158 snmpd: keeps complaining on missing /proc/ stats inside vserver flooding syslog -diff -r -u net-snmp-5.4.1~dfsg/agent/mibgroup/hardware/cpu/cpu_linux.c net-snmp-5.4.1~dfsg.puck/agent/mibgroup/hardware/cpu/cpu_linux.c ---- net-snmp-5.4.1~dfsg/agent/mibgroup/hardware/cpu/cpu_linux.c 2007-02-16 00:09:45.000000000 +1300 -+++ net-snmp-5.4.1~dfsg.puck/agent/mibgroup/hardware/cpu/cpu_linux.c 2009-05-04 14:35:53.000000000 +1200 -@@ -249,7 +249,7 @@ - cpu->pageOut = (unsigned long)pout; +diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/hardware/cpu/cpu_linux.c net-snmp-5.9/agent/mibgroup/hardware/cpu/cpu_linux.c +--- net-snmp-5.9.org/agent/mibgroup/hardware/cpu/cpu_linux.c 2020-08-14 23:41:47.000000000 +0200 ++++ net-snmp-5.9/agent/mibgroup/hardware/cpu/cpu_linux.c 2021-02-28 14:29:33.661445570 +0100 +@@ -309,7 +309,7 @@ void _cpu_load_swap_etc( char *buff, net + cpu->pageOut = (unsigned long long)pout; } else { if (first) - snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE); @@ -13,8 +13,8 @@ diff -r -u net-snmp-5.4.1~dfsg/agent/mibgroup/hardware/cpu/cpu_linux.c net-snmp- cpu->pageIn = cpu->pageOut = 0; } b = strstr(buff, "swap "); -@@ -259,7 +259,7 @@ - cpu->swapOut = (unsigned long)swpout; +@@ -319,7 +319,7 @@ void _cpu_load_swap_etc( char *buff, net + cpu->swapOut = (unsigned long long)swpout; } else { if (first) - snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE); @@ -22,31 +22,11 @@ diff -r -u net-snmp-5.4.1~dfsg/agent/mibgroup/hardware/cpu/cpu_linux.c net-snmp- cpu->swapIn = cpu->swapOut = 0; } } -diff -r -u net-snmp-5.4.1~dfsg/agent/mibgroup/ucd-snmp/vmstat_linux.c net-snmp-5.4.1~dfsg.puck/agent/mibgroup/ucd-snmp/vmstat_linux.c ---- net-snmp-5.4.1~dfsg/agent/mibgroup/ucd-snmp/vmstat_linux.c 2006-09-15 12:48:50.000000000 +1200 -+++ net-snmp-5.4.1~dfsg.puck/agent/mibgroup/ucd-snmp/vmstat_linux.c 2009-05-04 14:35:32.000000000 +1200 -@@ -316,7 +316,7 @@ - sscanf(b, "page %u %u", pin, pout); - else { - if (first) -- snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE); -+ snmp_log(LOG_INFO, "No page line in %s\n", STAT_FILE); - *pin = *pout = 0; - } - b = strstr(buff, "swap "); -@@ -324,7 +324,7 @@ - sscanf(b, "swap %u %u", swpin, swpout); - else { - if (first) -- snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE); -+ snmp_log(LOG_INFO, "No swap line in %s\n", STAT_FILE); - *swpin = *swpout = 0; - } - } ---- net-snmp-5.7.1/./agent/mibgroup/ucd-snmp/diskio.c~ 2011-09-28 07:53:47.000000000 +0300 -+++ net-snmp-5.7.1/./agent/mibgroup/ucd-snmp/diskio.c 2011-12-27 16:33:10.128099629 +0200 -@@ -979,7 +979,8 @@ - { +diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/ucd-snmp/diskio.c net-snmp-5.9/agent/mibgroup/ucd-snmp/diskio.c +--- net-snmp-5.9.org/agent/mibgroup/ucd-snmp/diskio.c 2020-08-14 23:41:47.000000000 +0200 ++++ net-snmp-5.9/agent/mibgroup/ucd-snmp/diskio.c 2021-02-28 14:29:33.661445570 +0100 +@@ -1367,7 +1367,8 @@ getstats(void) + struct stat stbuf; FILE* parts; time_t now; - @@ -55,7 +35,7 @@ diff -r -u net-snmp-5.4.1~dfsg/agent/mibgroup/ucd-snmp/vmstat_linux.c net-snmp-5 now = time(NULL); if (cache_time + CACHE_TIMEOUT > now) { return 0; -@@ -1024,7 +1025,11 @@ +@@ -1423,7 +1424,11 @@ getstats(void) int rc; parts = fopen("/proc/partitions", "r"); if (!parts) { @@ -68,3 +48,24 @@ diff -r -u net-snmp-5.4.1~dfsg/agent/mibgroup/ucd-snmp/vmstat_linux.c net-snmp-5 return 1; } +diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/ucd-snmp/vmstat_linux.c net-snmp-5.9/agent/mibgroup/ucd-snmp/vmstat_linux.c +--- net-snmp-5.9.org/agent/mibgroup/ucd-snmp/vmstat_linux.c 2020-08-14 23:41:47.000000000 +0200 ++++ net-snmp-5.9/agent/mibgroup/ucd-snmp/vmstat_linux.c 2021-02-28 14:29:33.661445570 +0100 +@@ -337,7 +337,7 @@ getstat(unsigned long *cuse, unsigned lo + sscanf(b, "page %u %u", pin, pout); + else { + if (first) +- snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE); ++ snmp_log(LOG_INFO, "No page line in %s\n", STAT_FILE); + *pin = *pout = 0; + } + b = strstr(buff, "swap "); +@@ -345,7 +345,7 @@ getstat(unsigned long *cuse, unsigned lo + sscanf(b, "swap %u %u", swpin, swpout); + else { + if (first) +- snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE); ++ snmp_log(LOG_INFO, "No swap line in %s\n", STAT_FILE); + *swpin = *swpout = 0; + } + } diff --git a/net-snmp-manpage.patch b/net-snmp-manpage.patch index 156477e..dc8f692 100644 --- a/net-snmp-manpage.patch +++ b/net-snmp-manpage.patch @@ -1,11 +1,12 @@ ---- net-snmp-5.0.8/man/mib2c.1.def.orig 2003-02-25 19:20:33.000000000 +0100 -+++ net-snmp-5.0.8/man/mib2c.1.def 2003-05-17 17:40:02.000000000 +0200 -@@ -35,7 +35,7 @@ +diff -urNp -x '*.orig' net-snmp-5.9.org/man/mib2c.1.def net-snmp-5.9/man/mib2c.1.def +--- net-snmp-5.9.org/man/mib2c.1.def 2020-08-14 23:41:47.000000000 +0200 ++++ net-snmp-5.9/man/mib2c.1.def 2021-02-28 14:28:48.770042705 +0100 +@@ -71,7 +71,7 @@ Display a help message. .TP .BI -c " CONFIGFILE" Use CONFIGFILE when generating code. These files will be searched for -first in the current directory and then in the DATADIR directory +first in the current directory and then in the DATADIR/snmp directory (which is where the default mib2c configuration files can be found). - .TP - .BI -f " OUTNAME" + Running mib2c without the -c CONFIGFILE option will display + a description of the valid values for CONFIGFILE, that is, diff --git a/net-snmp-use-rpm-hrmib.patch b/net-snmp-use-rpm-hrmib.patch index cf3e667..7ea8776 100644 --- a/net-snmp-use-rpm-hrmib.patch +++ b/net-snmp-use-rpm-hrmib.patch @@ -1,7 +1,43 @@ ---- net-snmp-5.4.1/agent/mibgroup/host/hr_swinst.c 2008-05-15 13:05:07.575307614 +0300 -+++ net-snmp-5.4.1.hrmib/agent/mibgroup/host/hr_swinst.c 2008-05-15 13:04:24.676830108 +0300 -@@ -183,6 +183,10 @@ - #define _PATH_HRSW_directory "/var/db/pkg" +diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst.h net-snmp-5.9/agent/mibgroup/host/data_access/swinst.h +--- net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst.h 2020-08-14 23:41:47.000000000 +0200 ++++ net-snmp-5.9/agent/mibgroup/host/data_access/swinst.h 2021-02-28 14:29:14.950860864 +0100 +@@ -11,6 +11,10 @@ + #ifndef NETSNMP_ACCESS_SWINST_CONFIG_H + #define NETSNMP_ACCESS_SWINST_CONFIG_H + ++// quick fix: this file is consulted before RPM_HRMIB_PATH check is made in configure, hardcode a define for now ++#define RPM_HRMIB_PATH "/var/cache/hrmib" ++ ++ + /* + * all platforms use this generic code + */ +@@ -25,7 +29,7 @@ config_exclude(host/hr_swinst) + config_require(host/data_access/swinst_apt) + #elif defined( HAVE_LIBRPM ) && defined( linux ) + config_require(host/data_access/swinst_rpm) +-#elif defined( HAVE_PKGLOCS_H ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd ) ++#elif defined( HAVE_PKGLOCS_H ) || defined( RPM_HRMIB_PATH ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd ) + config_require(host/data_access/swinst_pkginfo) + #else + config_warning(This platform does not yet support hrSWInstalledTable rewrites) +diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst_pkginfo.c net-snmp-5.9/agent/mibgroup/host/data_access/swinst_pkginfo.c +--- net-snmp-5.9.org/agent/mibgroup/host/data_access/swinst_pkginfo.c 2020-08-14 23:41:47.000000000 +0200 ++++ net-snmp-5.9/agent/mibgroup/host/data_access/swinst_pkginfo.c 2021-02-28 14:29:14.950860864 +0100 +@@ -61,6 +61,8 @@ netsnmp_swinst_arch_init(void) + { + #if defined(PKGLOC) + snprintf( pkg_directory, SNMP_MAXPATH, "%s", PKGLOC ); ++#elif defined(RPM_HRMIB_PATH) ++ snprintf( pkg_directory, SNMP_MAXPATH, "%s", RPM_HRMIB_PATH); + #elif defined(hpux9) + snprintf( pkg_directory, SNMP_MAXPATH, "/system" ); + #elif defined(hpux10) || defined(hpux11) +diff -urNp -x '*.orig' net-snmp-5.9.org/agent/mibgroup/host/hr_swinst.c net-snmp-5.9/agent/mibgroup/host/hr_swinst.c +--- net-snmp-5.9.org/agent/mibgroup/host/hr_swinst.c 2021-02-28 14:29:14.640851176 +0100 ++++ net-snmp-5.9/agent/mibgroup/host/hr_swinst.c 2021-02-28 14:29:14.950860864 +0100 +@@ -196,6 +196,10 @@ oid hrswinst_variables_oid[] + #define _PATH_HRSW_directory "/var/cache/hrmib" #endif +#if defined(RPM_HRMIB_PATH) @@ -11,8 +47,28 @@ void init_hr_swinst(void) { ---- net-snmp-5.8/configure.d/config_os_libs1.orig 2018-08-25 22:50:35.841023154 +0200 -+++ net-snmp-5.8/configure.d/config_os_libs1 2018-08-26 08:07:04.487308581 +0200 +diff -urNp -x '*.orig' net-snmp-5.9.org/configure.d/config_os_functions net-snmp-5.9/configure.d/config_os_functions +--- net-snmp-5.9.org/configure.d/config_os_functions 2020-08-14 23:41:47.000000000 +0200 ++++ net-snmp-5.9/configure.d/config_os_functions 2021-02-28 14:29:14.950860864 +0100 +@@ -188,15 +188,6 @@ AC_CHECK_FUNCS([if_freenameindex + # (Agent) + ## + +-# rpmGetPath check needs clean LIBS environment (Linux) +-# +-if test "x$with_rpm" != "xno"; then +- OLDLIBS=$LIBS +- LIBS=$LMIBLIBS +- AC_CHECK_FUNCS(rpmGetPath) +- LIBS=$OLDLIBS +-fi +- + # statfs( char *, struct fs_data* ) (Ultrix) + # + AC_MSG_CHECKING([[for two-argument statfs with struct fs_data (Ultrix)]]) +diff -urNp -x '*.orig' net-snmp-5.9.org/configure.d/config_os_libs1 net-snmp-5.9/configure.d/config_os_libs1 +--- net-snmp-5.9.org/configure.d/config_os_libs1 2021-02-28 14:29:14.630850863 +0100 ++++ net-snmp-5.9/configure.d/config_os_libs1 2021-02-28 14:29:14.950860864 +0100 @@ -11,18 +11,33 @@ # RPM checks # @@ -57,7 +113,7 @@ # # rpm libraries only needed for the host resources mib software -@@ -46,6 +61,12 @@ +@@ -46,6 +61,12 @@ if test "x$with_rpm" != "xno"; then NETSNMP_SEARCH_LIBS(headerGet,, [ AC_DEFINE(HAVE_HEADERGET, 1, [Define to 1 if you have the headerGet function.])],, $LMIBLIBS) @@ -70,54 +126,3 @@ fi # ---- net-snmp-5.5/configure.d/config_os_functions~ 2009-07-26 20:20:55.000000000 +0200 -+++ net-snmp-5.5/configure.d/config_os_functions 2010-05-12 14:35:39.421276242 +0200 -@@ -114,15 +114,6 @@ - # (Agent) - ## - --# rpmGetPath check needs clean LIBS environment (Linux) --# --if test "x$with_rpm" != "xno"; then -- OLDLIBS=$LIBS -- LIBS=$LMIBLIBS -- AC_CHECK_FUNCS(rpmGetPath) -- LIBS=$OLDLIBS --fi -- - # statfs( char *, struct fs_data* ) (Ultrix) - # - AC_MSG_CHECKING([[for two-argument statfs with struct fs_data (Ultrix)]]) ---- net-snmp-5.6/agent/mibgroup/host/data_access/swinst_pkginfo.c~ 2010-01-26 23:24:14.000000000 +0200 -+++ net-snmp-5.6/agent/mibgroup/host/data_access/swinst_pkginfo.c 2010-12-16 00:13:22.027247692 +0200 -@@ -52,6 +52,8 @@ - { - #if defined(PKGLOC) - snprintf( pkg_directory, SNMP_MAXPATH, "%s", PKGLOC ); -+#elif defined(RPM_HRMIB_PATH) -+ snprintf( pkg_directory, SNMP_MAXPATH, "%s", RPM_HRMIB_PATH); - #elif defined(hpux9) - snprintf( pkg_directory, SNMP_MAXPATH, "/system" ); - #elif defined(hpux10) || defined(hpux11) ---- net-snmp-5.6/agent/mibgroup/host/data_access/swinst.h 2010-12-16 00:14:13.634392176 +0200 -+++ net-snmp-5.6/agent/mibgroup/host/data_access/swinst.h 2010-12-16 01:27:48.195543278 +0200 -@@ -11,6 +11,10 @@ - #ifndef NETSNMP_ACCESS_SWINST_CONFIG_H - #define NETSNMP_ACCESS_SWINST_CONFIG_H - -+// quick fix: this file is consulted before RPM_HRMIB_PATH check is made in configure, hardcode a define for now -+#define RPM_HRMIB_PATH "/var/cache/hrmib" -+ -+ - /* - * all platforms use this generic code - */ -@@ -29,7 +29,7 @@ - config_require(host/data_access/swinst_apt) - #elif defined( HAVE_LIBRPM ) && defined( linux ) - config_require(host/data_access/swinst_rpm) --#elif defined( HAVE_PKGLOCS_H ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd ) -+#elif defined( HAVE_PKGLOCS_H ) || defined( RPM_HRMIB_PATH ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd ) - config_require(host/data_access/swinst_pkginfo) - #else - config_warning(This platform does not yet support hrSWInstalledTable rewrites) diff --git a/net-snmp.spec b/net-snmp.spec index 465616a..25ef310 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -24,7 +24,7 @@ Summary(ru.UTF-8): Набор утилит для протокола SNMP от U Summary(uk.UTF-8): Набір утиліт для протоколу SNMP від UC-Davis Name: net-snmp Version: 5.9 -Release: 2 +Release: 3 License: BSD-like Group: Networking/Daemons Source0: http://downloads.sourceforge.net/net-snmp/%{name}-%{version}.tar.gz -- 2.44.0