From 936e0f15edde978af27d8339ac382671c94c116e Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 10 2018 05:44:02 +0000 Subject: import net-snmp-5.7.2-32.el7 --- diff --git a/SOURCES/net-snmp-5.5-SCTP-parser.patch b/SOURCES/net-snmp-5.5-SCTP-parser.patch new file mode 100644 index 0000000..53b8f21 --- /dev/null +++ b/SOURCES/net-snmp-5.5-SCTP-parser.patch @@ -0,0 +1,74 @@ +diff -urNp orig/agent/mibgroup/sctp-mib/sctpScalars_linux.c new/agent/mibgroup/sctp-mib/sctpScalars_linux.c +--- orig/agent/mibgroup/sctp-mib/sctpScalars_linux.c 2016-08-25 09:18:55.239801239 +0200 ++++ new/agent/mibgroup/sctp-mib/sctpScalars_linux.c 2016-08-25 10:37:02.416999975 +0200 +@@ -84,17 +84,17 @@ netsnmp_access_sctp_stats_arch_load(nets + return -1; + } + +- if (line[6] == 'r') ++ if (line[4] == 'C' && line[8] == 'E') + sctp_stats->curr_estab = value; +- else if (line[5] == 'c') ++ else if (line[4] == 'A' && line[10] == 'E') + sctp_stats->active_estabs = value; +- else if (line[4] == 'P') ++ else if (line[4] == 'P' && line[11] == 'E') + sctp_stats->passive_estabs = value; +- else if (line[5] == 'b') ++ else if (line[4] == 'a' && line[5] == 'b') + sctp_stats->aborteds = value; +- else if (line[4] == 'S') ++ else if (line[4] == 'S' && line[5] == 'h') + sctp_stats->shutdowns = value; +- else if (line[8] == 'f') ++ else if (line[4] == 'O' && line[9] == 'B') + sctp_stats->out_of_blues = value; + else if (line[6] == 'e') + sctp_stats->checksum_errors = value; +@@ -113,7 +113,7 @@ netsnmp_access_sctp_stats_arch_load(nets + sctp_stats->out_sctp_packs.high = value >> 32; + } else + ret = -1; +- } else { ++ } else if (line[4] == 'I'){ + if (line[6] == 'C') { + sctp_stats->in_ctrl_chunks.low = value & 0xffffffff; + sctp_stats->in_ctrl_chunks.high = value >> 32; +@@ -123,24 +123,27 @@ netsnmp_access_sctp_stats_arch_load(nets + } else if (line[6] == 'U') { + sctp_stats->in_unorder_chunks.low = value & 0xffffffff; + sctp_stats->in_unorder_chunks.high = value >> 32; +- } else if (line[4] == 'F') { +- sctp_stats->frag_usr_msgs.low = value & 0xffffffff; +- sctp_stats->frag_usr_msgs.high = value >> 32; +- } else if (line[4] == 'R') { +- sctp_stats->reasm_usr_msgs.low = value & 0xffffffff; +- sctp_stats->reasm_usr_msgs.high = value >> 32; + } else if (line[6] == 'S') { + sctp_stats->in_sctp_packs.low = value & 0xffffffff; + sctp_stats->in_sctp_packs.high = value >> 32; +- } else ++ } else { + ret = -1; ++ } ++ } else if (line[4] == 'F' && line[8] == 'U') { ++ sctp_stats->frag_usr_msgs.low = value & 0xffffffff; ++ sctp_stats->frag_usr_msgs.high = value >> 32; ++ } else if (line[4] == 'R') { ++ sctp_stats->reasm_usr_msgs.low = value & 0xffffffff; ++ sctp_stats->reasm_usr_msgs.high = value >> 32; ++ } else if (line[4] == 'T') { ++ } else { ++ ret = -1; + } + + if (ret < 0) { + DEBUGMSGTL(("sctp:scalars:stats:arch_load", +- "Unknown entry!'\n")); +- fclose(f); +- return ret; ++ "Unknown entry: %s\n", line)); ++ ret = 0; + } + } + diff --git a/SOURCES/net-snmp-5.7.2-autofs.patch b/SOURCES/net-snmp-5.7.2-autofs.patch new file mode 100644 index 0000000..266de77 --- /dev/null +++ b/SOURCES/net-snmp-5.7.2-autofs.patch @@ -0,0 +1,199 @@ +diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c nnew/agent/mibgroup/hardware/fsys/fsys_mntctl.c +--- oold/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2012-10-10 00:28:58.000000000 +0200 ++++ nnew/agent/mibgroup/hardware/fsys/fsys_mntctl.c 2017-10-31 10:21:53.433280099 +0100 +@@ -43,8 +43,9 @@ _fsys_type( int type) + + case MNT_NFS: + case MNT_NFS3: +- case MNT_AUTOFS: + return NETSNMP_FS_TYPE_NFS; ++ case MNT_AUTOFS: ++ return NETSNMP_FS_TYPE_AUTOFS; + + /* + * The following code covers selected filesystems +@@ -153,10 +154,12 @@ netsnmp_fsys_arch_load( void ) + + /* + * Optionally skip retrieving statistics for remote mounts ++ * AUTOFS is skipped by default + */ +- if ( (entry->flags & NETSNMP_FS_FLAG_REMOTE) && ++ if ( ((entry->flags & NETSNMP_FS_FLAG_REMOTE) && + netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, +- NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES)) ++ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES)) || ++ entry->type == (NETSNMP_FS_TYPE_AUTOFS)) + continue; + + if ( statfs( entry->path, &stat_buf ) < 0 ) { +diff -urNp oold/agent/mibgroup/hardware/fsys/fsys_mntent.c nnew/agent/mibgroup/hardware/fsys/fsys_mntent.c +--- oold/agent/mibgroup/hardware/fsys/fsys_mntent.c 2017-10-30 14:50:41.784743150 +0100 ++++ nnew/agent/mibgroup/hardware/fsys/fsys_mntent.c 2017-10-31 08:59:08.953114110 +0100 +@@ -145,6 +145,13 @@ _fsys_type( char *typename ) + !strcmp(typename, MNTTYPE_LOFS)) + return NETSNMP_FS_TYPE_OTHER; + ++ /* Detection of AUTOFS. ++ * This file system will be ignored by default ++ */ ++ else if ( !strcmp(typename, MNTTYPE_AUTOFS)) ++ return NETSNMP_FS_TYPE_AUTOFS; ++ ++ + /* + * All other types are silently skipped + */ +@@ -239,6 +246,10 @@ netsnmp_fsys_arch_load( void ) + NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES)) + continue; + ++ /* Skip AUTOFS enteries */ ++ if ( entry->type == (NETSNMP_FS_TYPE_AUTOFS)) ++ continue; ++ + #ifdef irix6 + if ( NSFS_STATFS( entry->path, &stat_buf, sizeof(struct statfs), 0) < 0 ) + #else +diff -urNp oold/agent/mibgroup/hardware/fsys/mnttypes.h nnew/agent/mibgroup/hardware/fsys/mnttypes.h +--- oold/agent/mibgroup/hardware/fsys/mnttypes.h 2017-10-30 14:50:41.741743139 +0100 ++++ nnew/agent/mibgroup/hardware/fsys/mnttypes.h 2017-10-31 09:01:40.462427047 +0100 +@@ -159,6 +159,9 @@ + #ifndef MNTTYPE_APP + #define MNTTYPE_APP "app" + #endif ++#ifndef MNTTYPE_AUTOFS ++#define MNTTYPE_AUTOFS "autofs" ++#endif + #ifndef MNTTYPE_DEVPTS + #define MNTTYPE_DEVPTS "devpts" + #endif +diff -urNp oold/agent/mibgroup/host/hr_filesys.c nnew/agent/mibgroup/host/hr_filesys.c +--- oold/agent/mibgroup/host/hr_filesys.c 2012-10-10 00:28:58.000000000 +0200 ++++ nnew/agent/mibgroup/host/hr_filesys.c 2017-10-31 09:28:46.926093897 +0100 +@@ -839,6 +839,27 @@ Check_HR_FileSys_NFS (void) + return 0; /* no NFS file system */ + } + ++/* This function checks whether current file system is an AutoFs ++ * HRFS_entry must be valid prior to calling this function ++ * return 1 if AutoFs, 0 otherwise ++ */ ++int ++Check_HR_FileSys_AutoFs (void) ++{ ++#if HAVE_GETFSSTAT ++ if ( HRFS_entry->HRFS_type != NULL && ++#if defined(MNTTYPE_AUTOFS) ++ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_AUTOFS) ++#else ++ !strcmp( HRFS_entry->HRFS_type, "autofs") ++#endif ++ ) ++#endif /* HAVE_GETFSSTAT */ ++ return 1; /* AUTOFS */ ++ ++ return 0; /* no AUTOFS */ ++} ++ + void + End_HR_FileSys(void) + { +diff -urNp oold/agent/mibgroup/host/hr_filesys.h nnew/agent/mibgroup/host/hr_filesys.h +--- oold/agent/mibgroup/host/hr_filesys.h 2012-10-10 00:28:58.000000000 +0200 ++++ nnew/agent/mibgroup/host/hr_filesys.h 2017-10-31 09:29:44.541837515 +0100 +@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void); + extern FindVarMethod var_hrfilesys; + extern int Get_Next_HR_FileSys(void); + extern int Check_HR_FileSys_NFS(void); ++extern int Check_HR_FileSys_AutoFs(void); + + extern int Get_FSIndex(char *); + extern long Get_FSSize(char *); /* Temporary */ +diff -urNp oold/agent/mibgroup/host/hrh_filesys.c nnew/agent/mibgroup/host/hrh_filesys.c +--- oold/agent/mibgroup/host/hrh_filesys.c 2012-10-10 00:28:58.000000000 +0200 ++++ nnew/agent/mibgroup/host/hrh_filesys.c 2017-10-31 09:37:36.787634605 +0100 +@@ -427,3 +427,9 @@ Check_HR_FileSys_NFS (void) + { + return (HRFS_entry->flags & NETSNMP_FS_FLAG_REMOTE) ? 1 : 0; + } ++ ++int ++Check_HR_FileSys_AutoFs (void) ++{ ++ return (HRFS_entry->type == (NETSNMP_FS_TYPE_AUTOFS)) ? 1 : 0; ++} +diff -urNp oold/agent/mibgroup/host/hrh_filesys.h nnew/agent/mibgroup/host/hrh_filesys.h +--- oold/agent/mibgroup/host/hrh_filesys.h 2012-10-10 00:28:58.000000000 +0200 ++++ nnew/agent/mibgroup/host/hrh_filesys.h 2017-10-31 09:38:00.644616572 +0100 +@@ -10,6 +10,7 @@ extern void Init_HR_FileSys(void); + extern FindVarMethod var_hrhfilesys; + extern int Get_Next_HR_FileSys(void); + extern int Check_HR_FileSys_NFS(void); ++extern int Check_HR_FileSys_AutoFs(void); + + extern int Get_FSIndex(char *); + extern long Get_FSSize(char *); /* Temporary */ +diff -urNp oold/agent/mibgroup/host/hrh_storage.c nnew/agent/mibgroup/host/hrh_storage.c +--- oold/agent/mibgroup/host/hrh_storage.c 2017-10-30 14:50:41.766743146 +0100 ++++ nnew/agent/mibgroup/host/hrh_storage.c 2017-10-31 10:08:25.482217951 +0100 +@@ -368,9 +368,10 @@ really_try_next: + store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ]; + if (HRFS_entry && + store_idx > NETSNMP_MEM_TYPE_MAX && +- netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, ++ ((netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, + NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) && +- Check_HR_FileSys_NFS()) ++ Check_HR_FileSys_NFS()) || ++ Check_HR_FileSys_AutoFs())) + return NULL; + if (store_idx <= NETSNMP_MEM_TYPE_MAX ) { + mem = (netsnmp_memory_info*)ptr; +@@ -509,7 +510,8 @@ Get_Next_HR_Store(void) + if (HRS_index >= 0) { + if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, + NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) && +- Check_HR_FileSys_NFS())) { ++ Check_HR_FileSys_NFS()) && ++ !Check_HR_FileSys_AutoFs()) { + return HRS_index + NETSNMP_MEM_TYPE_MAX; + } + } else { +diff -urNp oold/agent/mibgroup/host/hr_storage.c nnew/agent/mibgroup/host/hr_storage.c +--- oold/agent/mibgroup/host/hr_storage.c 2012-10-10 00:28:58.000000000 +0200 ++++ nnew/agent/mibgroup/host/hr_storage.c 2017-10-31 10:11:41.161064352 +0100 +@@ -545,9 +545,10 @@ really_try_next: + + store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ]; + if (store_idx > NETSNMP_MEM_TYPE_MAX ) { +- if ( netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, ++ if ( (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, + NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) && +- Check_HR_FileSys_NFS()) ++ Check_HR_FileSys_NFS()) || ++ Check_HR_FileSys_AutoFs()) + return NULL; /* or goto try_next; */ + if (HRFS_statfs(HRFS_entry->HRFS_mount, &stat_buf) < 0) { + snmp_log_perror(HRFS_entry->HRFS_mount); +@@ -688,7 +689,8 @@ Get_Next_HR_Store(void) + if (HRS_index >= 0) { + if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, + NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) && +- Check_HR_FileSys_NFS())) { ++ Check_HR_FileSys_NFS()) && ++ !Check_HR_FileSys_AutoFs()) { + return HRS_index + NETSNMP_MEM_TYPE_MAX; + } + } else { +diff -urNp oold/include/net-snmp/agent/hardware/fsys.h nnew/include/net-snmp/agent/hardware/fsys.h +--- oold/include/net-snmp/agent/hardware/fsys.h 2012-10-10 00:28:58.000000000 +0200 ++++ nnew/include/net-snmp/agent/hardware/fsys.h 2017-10-31 10:14:59.560581680 +0100 +@@ -41,6 +41,7 @@ typedef struct netsnmp_fsys_info_s netsn + #define NETSNMP_FS_TYPE_SYSFS 4 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT + #define NETSNMP_FS_TYPE_TMPFS 5 | _NETSNMP_FS_TYPE_LOCAL + #define NETSNMP_FS_TYPE_USBFS 6 | _NETSNMP_FS_TYPE_LOCAL ++#define NETSNMP_FS_TYPE_AUTOFS 7 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT + + #define NETSNMP_FS_FLAG_ACTIVE 0x01 + #define NETSNMP_FS_FLAG_REMOTE 0x02 diff --git a/SOURCES/net-snmp-5.7.2-documentation.patch b/SOURCES/net-snmp-5.7.2-documentation.patch new file mode 100644 index 0000000..664b5da --- /dev/null +++ b/SOURCES/net-snmp-5.7.2-documentation.patch @@ -0,0 +1,39 @@ +diff -urNp a/man/snmp_config.5.def b/man/snmp_config.5.def +--- a/man/snmp_config.5.def 2017-06-26 11:30:42.728527539 +0200 ++++ b/man/snmp_config.5.def 2017-06-26 11:33:19.766436329 +0200 +@@ -179,14 +179,28 @@ during normal configuration file process + .RS + .nf + # include site specific config +-include site.conf ++includeFile site.conf + .RE + .PP +-This will search every directory in the configuration path for files +-named site.conf, and will process those files before returning to the +-processing of the original file. Note that if '.conf' is omitted, +-it will be appended. That is, all configuration files must end +-in '.conf'. ++This will load the specified configuration file. The ++path to file must be either absolute, starting with '/', ++or relative. The relative path is then relative to the directory ++where the parent file with 'includeFile' directive resides. ++.PP ++The included file name does not need to have '.conf' suffix. ++.PP ++.RS ++.nf ++# include a all *.conf files in a directory ++includeDir /etc/snmp/config.d ++.RE ++.PP ++This will search specified directory for all files with '.conf' ++suffix and process them as if they were included using includeFile ++directive. The configuration files are not processed in any particular ++order. ++.PP ++The specified directory must be absolute directory path. + .SH "API INTERFACE" + .PP + Information about writing C code that makes use of this system in + diff --git a/SOURCES/net-snmp-5.7.2-iterator-fix.patch b/SOURCES/net-snmp-5.7.2-iterator-fix.patch new file mode 100644 index 0000000..fb34caf --- /dev/null +++ b/SOURCES/net-snmp-5.7.2-iterator-fix.patch @@ -0,0 +1,14 @@ +diff -urNp old/agent/mibgroup/host/data_access/swrun.c new/agent/mibgroup/host/data_access/swrun.c +--- old/agent/mibgroup/host/data_access/swrun.c 2017-07-18 09:44:00.626109526 +0200 ++++ new/agent/mibgroup/host/data_access/swrun.c 2017-07-19 15:27:50.452255836 +0200 +@@ -102,6 +102,10 @@ swrun_count_processes_by_name( char *nam + return 0; /* or -1 */ + + it = CONTAINER_ITERATOR( swrun_container ); ++ if((entry = (netsnmp_swrun_entry*)ITERATOR_FIRST( it )) != NULL) { ++ if (0 == strcmp( entry->hrSWRunName, name )) ++ i++; ++ } + while ((entry = (netsnmp_swrun_entry*)ITERATOR_NEXT( it )) != NULL) { + if (0 == strcmp( entry->hrSWRunName, name )) + i++; diff --git a/SPECS/net-snmp.spec b/SPECS/net-snmp.spec index 8ccf217..7f7cd47 100644 --- a/SPECS/net-snmp.spec +++ b/SPECS/net-snmp.spec @@ -11,7 +11,7 @@ Summary: A collection of SNMP protocol tools and libraries Name: net-snmp Version: 5.7.2 -Release: 28%{?dist}.1 +Release: 32%{?dist} Epoch: 1 License: BSD @@ -96,7 +96,11 @@ Patch59: net-snmp-5.7.2-client-udp6.patch Patch60: net-snmp-5.7.2-ipAddress-faster-load.patch Patch61: net-snmp-5.7.2-large-fdset.patch Patch62: net-snmp-5.7.2-duplicate-ipAddress.patch -Patch63: net-snmp-5.7.2-strstr.patch +Patch63: net-snmp-5.5-SCTP-parser.patch +Patch64: net-snmp-5.7.2-strstr.patch +Patch66: net-snmp-5.7.2-documentation.patch +Patch67: net-snmp-5.7.2-iterator-fix.patch +Patch68: net-snmp-5.7.2-autofs.patch Requires(post): chkconfig Requires(preun): chkconfig @@ -158,6 +162,7 @@ package. %package devel Group: Development/Libraries Summary: The development environment for the NET-SNMP project +Requires: %{name} = %{epoch}:%{version}-%{release} Requires: %{name}-libs = %{epoch}:%{version}-%{release} Requires: %{name}-agent-libs = %{epoch}:%{version}-%{release} Requires: elfutils-devel, rpm-devel, elfutils-libelf-devel, openssl-devel @@ -183,9 +188,9 @@ packages installed. %package perl Group: Development/Libraries Summary: The perl NET-SNMP module and the mib2c tool +Requires: %{name} = %{epoch}:%{version}-%{release} Requires: %{name}-libs = %{epoch}:%{version}-%{release}, perl Requires: %{name}-agent-libs = %{epoch}:%{version}-%{release} -Requires: %{name}-devel = %{epoch}:%{version}-%{release} BuildRequires: perl %description perl @@ -312,7 +317,11 @@ The net-snmp-sysvinit package provides SysV init scripts for Net-SNMP daemons. %patch60 -p1 -b .ipAddress-faster-load %patch61 -p1 -b .large-fdset %patch62 -p1 -b .duplicate-ipAddress -%patch63 -p1 -b .strstr.patch +%patch63 -p1 -b .SCTP-parser.patch +%patch64 -p1 -b .strstr.patch +%patch66 -p1 -b .documentation +%patch67 -p1 -b .iteratorpatch +%patch68 -p1 -b .autofspatch %ifarch sparc64 s390 s390x # disable failing test - see https://bugzilla.redhat.com/show_bug.cgi?id=680697 @@ -545,6 +554,8 @@ rm -rf ${RPM_BUILD_ROOT} %{_unitdir}/snmp* %config(noreplace) %{_sysconfdir}/sysconfig/snmpd %config(noreplace) %{_sysconfdir}/sysconfig/snmptrapd +%attr(0755,root,root) %{_bindir}/net-snmp-config* +%attr(0644,root,root) %{_mandir}/man1/net-snmp-config*.1.* %files utils %{_bindir}/encode_keychange @@ -559,8 +570,6 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/lib*.so /usr/include/* %attr(0644,root,root) %{_mandir}/man3/*.3.* -%attr(0755,root,root) %{_bindir}/net-snmp-config* -%attr(0644,root,root) %{_mandir}/man1/net-snmp-config*.1.* %files perl %{_bindir}/mib2c-update @@ -608,8 +617,23 @@ rm -rf ${RPM_BUILD_ROOT} %{_initrddir}/snmptrapd %changelog -* Wed Dec 13 2017 Pavel Zhukov - 1:5.7.2-28.1 -- Resolves: #1525421 - fix strstr() crash +* Wed Jan 24 2018 Josef Ridky - 1:5.7.2-32 +- Add net-snmp as requirement of net-snmp-devel + +* Tue Dec 05 2017 Josef Ridky - 1:5.7.2-31 +- Add missing dependency for net-snmp-perl package + +* Thu Nov 30 2017 Josef Ridky - 1:5.7.2-30 +- Revert #1448082 due QA Fail and upstream nonacceptance + +* Wed Nov 01 2017 Josef Ridky - 1:5.7.2-29 +- Move net-snmp-config from devel package to general package (#1486733) +- Fix SCTP parser (#1329338) +- Fix strstr() crash (#1428609) +- Add support for TCP and UDP 64 bit counters (#1448082) +- Fix documentation lack for includeFile, includeDir and includeSearch options (#1464485) +- Fix wrong usage of structure iterator (#1461666) +- Fix issue with statistics from autofs (#1501144) * Wed Apr 26 2017 Josef Ridky - 1:5.7.2-28 - Restored message about duplicate IP address (#1442962)