From efe9a18fdc3542b6c33ae2f1406e5ddb470fc208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0afr=C3=A1nek?= Date: Tue, 29 Sep 2009 15:23:38 +0000 Subject: [PATCH] - update to Net-SNMP 5.5 - remove static libraries from -devel subpackage - rediff all patches to 5.5, remove unused/obsolete patches --- .cvsignore | 2 +- net-snmp-5.1.2-dir-fix.patch | 14 - net-snmp-5.2.1-file_offset.patch | 24 - net-snmp-5.3.1-multilib.patch | 21 - net-snmp-5.4.1-config_libdir.patch | 101 -- net-snmp-5.4.1-libwrap.patch | 25 - net-snmp-5.4.1-sensors3.patch | 1310 -------------------------- net-snmp-5.4.1-shared-ip.patch | 116 --- net-snmp-5.4.1-strange_libpath.patch | 60 -- net-snmp-5.4.1-xen-crash.patch | 154 --- net-snmp-5.4.2.1-proc-div0.patch | 21 - net-snmp-5.5-dir-fix.patch | 14 + net-snmp-5.5-multilib.patch | 47 + net-snmp-5.5-sensors3.patch | 14 + net-snmp.spec | 42 +- sources | 2 +- 16 files changed, 93 insertions(+), 1874 deletions(-) delete mode 100644 net-snmp-5.1.2-dir-fix.patch delete mode 100644 net-snmp-5.2.1-file_offset.patch delete mode 100644 net-snmp-5.3.1-multilib.patch delete mode 100644 net-snmp-5.4.1-config_libdir.patch delete mode 100644 net-snmp-5.4.1-libwrap.patch delete mode 100644 net-snmp-5.4.1-sensors3.patch delete mode 100644 net-snmp-5.4.1-shared-ip.patch delete mode 100644 net-snmp-5.4.1-strange_libpath.patch delete mode 100644 net-snmp-5.4.1-xen-crash.patch delete mode 100644 net-snmp-5.4.2.1-proc-div0.patch create mode 100644 net-snmp-5.5-dir-fix.patch create mode 100644 net-snmp-5.5-multilib.patch create mode 100644 net-snmp-5.5-sensors3.patch diff --git a/.cvsignore b/.cvsignore index f561c87..3833e52 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -net-snmp-5.4.2.1.tar.gz +net-snmp-5.5.tar.gz diff --git a/net-snmp-5.1.2-dir-fix.patch b/net-snmp-5.1.2-dir-fix.patch deleted file mode 100644 index 403b04e..0000000 --- a/net-snmp-5.1.2-dir-fix.patch +++ /dev/null @@ -1,14 +0,0 @@ -Assume that the configuration is in /etc/snmp, instead of /usr/share/snmp - -diff -up net-snmp-5.4.1/net-snmp-config.in.backup_patch_6 net-snmp-5.4.1/net-snmp-config.in ---- net-snmp-5.4.1/net-snmp-config.in.backup_patch_6 2007-06-30 00:18:27.000000000 +0200 -+++ net-snmp-5.4.1/net-snmp-config.in 2008-07-25 12:53:19.000000000 +0200 -@@ -302,7 +302,7 @@ else - fi - echo $line >> $outfile - -- outfile="@datadir@/snmp/snmpd.conf" -+ outfile="/etc/snmp/snmpd.conf" - line="$token $user" - echo "adding the following line to $outfile:" - echo " " $line diff --git a/net-snmp-5.2.1-file_offset.patch b/net-snmp-5.2.1-file_offset.patch deleted file mode 100644 index d326a4b..0000000 --- a/net-snmp-5.2.1-file_offset.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -up net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.c.file_offset net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.c ---- net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.c.file_offset 2004-06-19 15:34:11.000000000 +0200 -+++ net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.c 2009-01-22 14:42:26.000000000 +0100 -@@ -783,7 +783,7 @@ Get_FSIndex(char *dev) - return 0; - } - --long -+fsblkcnt_t - Get_FSSize(char *dev) - { - struct HRFS_statfs statfs_buf; -diff -up net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.h.file_offset net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.h ---- net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.h.file_offset 2002-07-04 14:56:35.000000000 +0200 -+++ net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.h 2009-01-22 14:42:26.000000000 +0100 -@@ -12,7 +12,7 @@ extern int Get_Next_HR_FileSys(void - extern int Check_HR_FileSys_NFS(void); - - extern int Get_FSIndex(char *); --extern long Get_FSSize(char *); /* Temporary */ -+extern fsblkcnt_t Get_FSSize(char *); /* Temporary */ - - - #endif /* _MIBGROUP_HRFSYS_H */ diff --git a/net-snmp-5.3.1-multilib.patch b/net-snmp-5.3.1-multilib.patch deleted file mode 100644 index 89dc83a..0000000 --- a/net-snmp-5.3.1-multilib.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -up net-snmp-5.4.1/man/read_config.3.def.backup_patch_8 net-snmp-5.4.1/man/read_config.3.def ---- net-snmp-5.4.1/man/read_config.3.def.backup_patch_8 2003-04-25 16:02:55.000000000 +0200 -+++ net-snmp-5.4.1/man/read_config.3.def 2008-07-25 12:53:34.000000000 +0200 -@@ -257,7 +257,7 @@ The configuration files read are found b - .I SNMPCONFPATH - environment variable (or its default value, which will be - SYSCONFDIR/snmp, followed by --DATADIR/snmp, followed by LIBDIR/snmp, followed by $HOME/.snmp) and -+DATADIR/snmp, followed by /usr/lib/snmp (or /usr/lib64/snmp), followed by $HOME/.snmp) and - reading in the files found that match both the prefix registered and - the two suffixes - .I .conf -@@ -285,7 +285,7 @@ function that it should abort the operat - SNMPCONFPATH - A colon separated list of directories to search for configuration - files in. --Default: SYSCONFDIR/snmp:DATADIR/snmp:LIBDIR/snmp:$HOME/.snmp -+Default: SYSCONFDIR/snmp:DATADIR/snmp:/usr/lib(64)/snmp:$HOME/.snmp - .SH "SEE ALSO" - .BR mib_api "(3), " snmp_api (3) - .\" Local Variables: diff --git a/net-snmp-5.4.1-config_libdir.patch b/net-snmp-5.4.1-config_libdir.patch deleted file mode 100644 index a1d1ec6..0000000 --- a/net-snmp-5.4.1-config_libdir.patch +++ /dev/null @@ -1,101 +0,0 @@ -diff -up net-snmp-5.4.1/configure.backup_patch_9 net-snmp-5.4.1/configure ---- net-snmp-5.4.1/configure.backup_patch_9 2008-07-25 12:52:01.000000000 +0200 -+++ net-snmp-5.4.1/configure 2008-07-25 12:53:35.000000000 +0200 -@@ -5252,7 +5252,7 @@ freebsd* | dragonfly*) - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file -- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` -+ lt_cv_file_magic_test_file=`echo $LIBDIR/libc.so.*` - ;; - esac - else -@@ -5269,15 +5269,15 @@ hpux10.20* | hpux11*) - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' -- lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so -+ lt_cv_file_magic_test_file=$LIBDIR/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' -- lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl -+ lt_cv_file_magic_test_file=$LIBDIR/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' -- lt_cv_file_magic_test_file=/usr/lib/libc.sl -+ lt_cv_file_magic_test_file=$LIBDIR/libc.sl - ;; - esac - ;; -@@ -5313,7 +5313,7 @@ netbsd*) - newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file -- lt_cv_file_magic_test_file=/usr/lib/libnls.so -+ lt_cv_file_magic_test_file=$LIBDIR/libnls.so - ;; - - nto-qnx*) -@@ -5344,7 +5344,7 @@ sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' -- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` -+ lt_cv_file_magic_test_file=`echo $LIBDIR/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all -@@ -8905,13 +8905,13 @@ sed 's/^/| /' conftest.$ac_ext >&5 - fi - rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext --if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -+if test -z "$aix_libpath"; then aix_libpath="$LIBDIR:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then -- hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' -+ hardcode_libdir_flag_spec='${wl}-R $libdir:$LIBDIR:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else -@@ -8973,7 +8973,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 - fi - rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext --if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -+if test -z "$aix_libpath"; then aix_libpath="$LIBDIR:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, -@@ -9087,7 +9087,7 @@ if test -z "$aix_libpath"; then aix_libp - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) -- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' -+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags $LIBDIR/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no -@@ -9504,7 +9504,7 @@ shlibpath_var= - shlibpath_overrides_runpath=unknown - version_type=none - dynamic_linker="$host_os ld.so" --sys_lib_dlsearch_path_spec="/lib /usr/lib" -+sys_lib_dlsearch_path_spec="/lib $LIBDIR" - - if test "$GCC" = yes; then - case $host_os in -@@ -9555,7 +9555,7 @@ BEGIN {RS=" "; FS="/|\n";} { - }'` - sys_lib_search_path_spec=`echo $lt_search_path_spec` - else -- sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -+ sys_lib_search_path_spec="/lib $LIBDIR /usr/local/lib" - fi - need_lib_prefix=unknown - hardcode_into_libs=no diff --git a/net-snmp-5.4.1-libwrap.patch b/net-snmp-5.4.1-libwrap.patch deleted file mode 100644 index a754571..0000000 --- a/net-snmp-5.4.1-libwrap.patch +++ /dev/null @@ -1,25 +0,0 @@ -CVE-2008-6123: snmp queries allowed from each remote host regardless of -/etc/hosts.allow configuration - -Source: upstream, SVN rev. 17367 - -diff -up net-snmp-5.4.2.1/snmplib/snmpUDPDomain.c.libwrap net-snmp-5.4.2.1/snmplib/snmpUDPDomain.c ---- net-snmp-5.4.2.1/snmplib/snmpUDPDomain.c.libwrap 2007-10-11 22:46:30.000000000 +0200 -+++ net-snmp-5.4.2.1/snmplib/snmpUDPDomain.c 2009-02-16 11:57:19.000000000 +0100 -@@ -104,12 +104,12 @@ netsnmp_udp_fmtaddr(netsnmp_transport *t - char tmp[64]; - to = (struct sockaddr_in *) &(addr_pair->remote_addr); - if (to == NULL) { -- sprintf(tmp, "UDP: [%s]->unknown", -+ sprintf(tmp, "UDP: unknown->[%s]", - inet_ntoa(addr_pair->local_addr)); - } else { -- sprintf(tmp, "UDP: [%s]->", inet_ntoa(addr_pair->local_addr)); -- sprintf(tmp + strlen(tmp), "[%s]:%hd", -- inet_ntoa(to->sin_addr), ntohs(to->sin_port)); -+ sprintf(tmp, "UDP: [%s]:%hu->", -+ inet_ntoa(to->sin_addr), ntohs(to->sin_port)); -+ sprintf(tmp + strlen(tmp), "[%s]", inet_ntoa(addr_pair->local_addr)); - } - return strdup(tmp); - } diff --git a/net-snmp-5.4.1-sensors3.patch b/net-snmp-5.4.1-sensors3.patch deleted file mode 100644 index 2a33b8a..0000000 --- a/net-snmp-5.4.1-sensors3.patch +++ /dev/null @@ -1,1310 +0,0 @@ -351991: Port net-snmp to lm_sensors-3.x.x -Source: upstream, svn diff -r 16736:16739 -Reviewed-By: Jan Safranek - -Index: configure -=================================================================== -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/dummy_sensors.c ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/dummy_sensors.c 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1,60 @@ -+#include -+#include -+#include -+#include -+ -+ -+void netsnmp_sensor_arch_init( void ) { -+ /* Nothing to do */ -+ DEBUGMSGTL(("sensors:arch", "Initialise Dummy Sensors module\n")); -+} -+ -+int -+netsnmp_sensor_arch_load(netsnmp_cache *cache, void *vp) { -+ time_t now; -+ struct tm *tm; -+ netsnmp_sensor_info *sp; -+ -+ time(&now); -+ tm = localtime(&now); -+ -+ DEBUGMSGTL(("sensors:arch", "Reload Dummy Sensors module\n")); -+ -+ /* First pseudo-sensor - slowly-rising temperature */ -+ sp = sensor_by_name( "minute", NETSNMP_SENSOR_TYPE_TEMPERATURE ); -+ sp->value = tm->tm_min; -+ snprintf( sp->descr, 256, "Minute-based pseudo-sensor - slowly-rising temperature" ); -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ -+ /* Second pseudo-sensor - quickly-rising temperature */ -+ sp = sensor_by_name( "second", NETSNMP_SENSOR_TYPE_TEMPERATURE ); -+ sp->value = tm->tm_sec; -+ snprintf( sp->descr, 256, "Second-based pseudo-sensor - quickly-rising temperature" ); -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ -+ /* Third pseudo-sensor - annual fan speed */ -+ sp = sensor_by_name( "year", NETSNMP_SENSOR_TYPE_RPM ); -+ sp->value = tm->tm_year + 1900; -+ snprintf( sp->descr, 256, "RPM pseudo-sensor - annual fan speed" ); -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ -+ /* Fourth pseudo-sensor - daily voltage */ -+ sp = sensor_by_name( "day", NETSNMP_SENSOR_TYPE_VOLTAGE_DC ); -+ sp->value = tm->tm_mday-20; -+ snprintf( sp->descr, 256, "Day-based pseudo-sensor - positive or negative voltage" ); -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ -+ /* Fifth pseudo-sensor - monthly voltage */ -+ sp = sensor_by_name( "month", NETSNMP_SENSOR_TYPE_VOLTAGE_DC ); -+ sp->value = tm->tm_mon; -+ snprintf( sp->descr, 256, "Month-based pseudo-sensor - positive voltage" ); -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ -+ /* Sixth pseudo-sensor - annual daily something */ -+ sp = sensor_by_name( "yday", NETSNMP_SENSOR_TYPE_OTHER ); -+ sp->value = tm->tm_yday; -+ snprintf( sp->descr, 256, "Day-based pseudo-sensor - annual something" ); -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ -+ return 0; -+} -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/dummy_sensors.h ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/dummy_sensors.h 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1 @@ -+config_require(hardware/sensors/hw_sensors) -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors.h ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors.h 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1,13 @@ -+config_require(hardware/sensors/hw_sensors) -+ -+#if defined(solaris) -+# if defined(HAVE_PICL_H) -+config_require(hardware/sensors/picld_sensors) -+# else -+config_require(hardware/sensors/kstat_sensors) -+# endif -+#else -+config_require(hardware/sensors/lmsensors_v3) -+#endif -+ -+//config_require(hardware/sensors/dummy_sensors) -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/hw_sensors.c ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/hw_sensors.c 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1,183 @@ -+#include -+#include -+#include -+#include -+ -+ -+extern NetsnmpCacheLoad netsnmp_sensor_arch_load; -+extern void netsnmp_sensor_arch_init( void ); -+static int _sensor_load( void ); -+static void _sensor_free( void ); -+ -+static int _sensorAutoUpdate = 0; /* 0 means on-demand caching */ -+static void _sensor_update_stats( unsigned int, void* ); -+ -+netsnmp_cache *_sensor_cache = NULL; -+netsnmp_container *_sensor_container = NULL; -+static int _sensor_idx = 0; -+ -+void init_hw_sensors( void ) { -+ -+ if ( _sensor_container ) -+ return; /* Already initialised */ -+ -+ DEBUGMSGTL(("sensors", "Initialise Hardware Sensors module\n")); -+ -+ /* -+ * Define a container to hold the basic list of sensors -+ * The four LM-SENSOR-MIB containers will be created in -+ * the relevant initialisation routine(s) -+ */ -+ _sensor_container = netsnmp_container_find("sensorTable:table_container"); -+ if ( NULL == _sensor_container ) { -+ snmp_log( LOG_ERR, "failed to create container for sensorTable"); -+ return; -+ } -+ netsnmp_sensor_arch_init( ); -+ -+ /* -+ * If we're sampling the sensor information automatically, -+ * then arrange for this to be triggered regularly. -+ * -+ * If we're not sampling these values regularly, -+ * create a suitable cache handler instead. -+ */ -+ if ( _sensorAutoUpdate ) { -+ DEBUGMSGTL(("sensors", "Reloading Hardware Sensors automatically (%d)\n", -+ _sensorAutoUpdate)); -+ snmp_alarm_register( _sensorAutoUpdate, SA_REPEAT, -+ _sensor_update_stats, NULL ); -+ } -+ else { -+ _sensor_cache = netsnmp_cache_create( 5, netsnmp_sensor_load, -+ netsnmp_sensor_free, NULL, 0 ); -+ DEBUGMSGTL(("sensors", "Reloading Hardware Sensors on-demand (%p)\n", -+ _sensor_cache)); -+ } -+} -+ -+void shutdown_hw_sensors( void ) { -+ _sensor_free(); -+} -+ -+/* -+ * Return the main sensor container -+ */ -+netsnmp_container *get_sensor_container( void ) { return _sensor_container; } -+ -+/* -+ * Return the main sensor cache control structure (if defined) -+ */ -+netsnmp_cache *get_sensor_cache( void ) { return _sensor_cache; } -+ -+ -+/* -+ * Wrapper routine for automatically updating sensor statistics -+ */ -+void -+_sensor_update_stats( unsigned int clientreg, void *data ) -+{ -+ _sensor_free(); -+ _sensor_load(); -+} -+ -+/* -+ * Wrapper routine for re-loading sensor statistics on demand -+ */ -+int -+netsnmp_sensor_load( netsnmp_cache *cache, void *data ) -+{ -+ return _sensor_load(); -+} -+ -+/* -+ * Wrapper routine for releasing expired sensor statistics -+ */ -+void -+netsnmp_sensor_free( netsnmp_cache *cache, void *data ) -+{ -+ _sensor_free(); -+} -+ -+ -+/* -+ * Architecture-independent processing of loading sensor statistics -+ */ -+static int -+_sensor_load( void ) -+{ -+ netsnmp_sensor_arch_load( NULL, NULL ); -+} -+ -+/* -+ * Architecture-independent release of sensor statistics -+ */ -+static void -+_sensor_free( void ) -+{ -+ netsnmp_sensor_info *sp; -+ -+ for (sp = CONTAINER_FIRST( _sensor_container ); -+ sp; -+ sp = CONTAINER_NEXT( _sensor_container, sp )) { -+ -+ sp->flags &= ~ NETSNMP_SENSOR_FLAG_ACTIVE; -+ } -+} -+ -+ -+/* -+ * Retrieve a sensor entry by name, -+ * or (optionally) insert a new one into the container -+ */ -+netsnmp_sensor_info * -+sensor_by_name( char *name, int create_type ) -+{ -+ netsnmp_sensor_info *sp; -+ -+ DEBUGMSGTL(("sensors:name", "Get sensor entry (%s)\n", name)); -+ -+ /* -+ * Look through the list for a matching entry -+ */ -+ /* .. or use a secondary index container ?? */ -+ for (sp = CONTAINER_FIRST( _sensor_container ); -+ sp; -+ sp = CONTAINER_NEXT( _sensor_container, sp )) { -+ -+ if ( !strcmp( name, sp->name )) -+ return sp; -+ } -+ -+ /* -+ * Not found... -+ */ -+ if ( create_type == NETSNMP_SENSOR_FIND_EXIST ) { -+ DEBUGMSGTL(("sensors:name", "No such sensor entry\n")); -+ return NULL; -+ } -+ -+ /* -+ * ... so let's create a new one, using the type supplied -+ */ -+ sp = SNMP_MALLOC_TYPEDEF( netsnmp_sensor_info ); -+ if ( sp ) { -+ strcpy( sp->name, name ); -+ sp->type = create_type; -+ /* -+ * Set up the index value. -+ * -+ * All this trouble, just for a simple integer. -+ * Surely there must be a better way? -+ */ -+ sp->idx.len = 1; -+ sp->idx.oids = SNMP_MALLOC_TYPEDEF( oid ); -+ sp->idx.oids[0] = ++_sensor_idx; -+ } -+ -+ DEBUGMSGTL(("sensors:name", "Create sensor entry (type = %d, index = %d\n", -+ create_type, _sensor_idx)); -+ CONTAINER_INSERT( _sensor_container, sp ); -+ return sp; -+} -+ -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/hw_sensors.h ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/hw_sensors.h 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1 @@ -+void init_hw_sensors( void ); -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/kstat_sensors.c ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/kstat_sensors.c 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1,161 @@ -+#include -+#include -+#include -+#include -+ -+#include "util_funcs.h" -+#include -+ -+#include -+#include -+ -+void netsnmp_sensor_arch_init( void ) { -+ DEBUGMSGTL(("sensors:arch", "Initialise KStat Sensors module\n")); -+} -+ -+ -+int -+netsnmp_sensor_arch_load(netsnmp_cache *cache, void *vp) { -+ netsnmp_sensor_info *sp; -+ -+ int i; -+ const char *fantypes[]={"CPU","PWR","AFB"}; -+ char name[ 256 ]; -+ -+ kstat_ctl_t *kc; -+ kstat_t *kp; -+ envctrl_fan_t *fan_info; -+ envctrl_ps_t *power_info; -+ envctrl_encl_t *enc_info; -+ -+ -+ DEBUGMSGTL(("sensors:arch", "Reload KStat Sensors module\n")); -+ -+ kc = kstat_open(); -+ if ( kc == 0) { -+ DEBUGMSGTL(("sensors:arch", "Couldn't open kstat\n")); -+ return 1; -+ } -+ -+ -+ /* -+ * Retrieve fan information -+ */ -+ kp = kstat_lookup( kc, ENVCTRL_MODULE_NAME, 0, ENVCTRL_KSTAT_FANSTAT); -+ if (( kp == 0 ) || (kstat_read( kc, kp, 0 ) == -1 )) { -+ DEBUGMSGTL(("sensors:arch", "No fan information\n")); -+ } else { -+ fan_info = (envctrl_fan_t *)kp->ks_data; -+ for (i=0; iks_ndata; i++) { -+ memset( name, 0, 256 ); -+ snprintf( name, 255, "%s%d", fantypes[fan_info->type], fan_info->instance ); -+ -+ sp = sensor_by_name( name, NETSNMP_SENSOR_TYPE_RPM ); -+ if ( sp ) { -+ sp->value = fan_info->fanspeed; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ snprintf( sp->descr, 255, "fan type %s number %d", -+ fantypes[fan_info->type], fan_info->instance ); -+ } -+ -+ fan_info++; -+ } -+ } -+ -+ -+ /* -+ * Retrieve Power Supply information -+ */ -+ kp = kstat_lookup( kc, ENVCTRL_MODULE_NAME, 0, ENVCTRL_KSTAT_PSNAME); -+ if (( kp == 0 ) || (kstat_read( kc, kp, 0 ) == -1 )) { -+ DEBUGMSGTL(("sensors:arch", "No PSU information\n")); -+ } else { -+ power_info = (envctrl_ps_t *)kp->ks_data; -+ for (i=0; iks_ndata; i++) { -+ memset( name, 0, 256 ); -+ snprintf( name, 255, "PSU%d", power_info->instance ); -+ -+ sp = sensor_by_name( name, NETSNMP_SENSOR_TYPE_TEMPERATURE); -+ if ( sp ) { -+ sp->value = power_info->ps_tempr; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ snprintf( sp->descr, 255, "power supply %d", power_info->instance ); -+ } -+ -+ power_info++; -+ } -+ } -+ -+ -+ /* -+ * Retrieve Enclosure information -+ */ -+ kp = kstat_lookup( kc, ENVCTRL_MODULE_NAME, 0, ENVCTRL_KSTAT_ENCL); -+ if (( kp == 0 ) || (kstat_read( kc, kp, 0 ) == -1 )) { -+ DEBUGMSGTL(("sensors:arch", "No enclosure information\n")); -+ } else { -+ enc_info = (envctrl_encl_t *)kp->ks_data; -+ for (i=0; iks_ndata; i++) { -+ /* -+ * The enclosure information covers several different types of sensor -+ */ -+ switch ( enc_info->type ) { -+ case ENVCTRL_ENCL_FSP: -+ DEBUGMSGTL(("sensors:arch:detail", "Enclosure Front Panel\n")); -+ sp = sensor_by_name( "FSP", NETSNMP_SENSOR_TYPE_OTHER); -+ if ( sp ) { -+ sp->value = enc_info->value; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ } -+ break; -+ -+ case ENVCTRL_ENCL_AMBTEMPR: -+ DEBUGMSGTL(("sensors:arch:detail", "Enclosure Ambient Temperature\n")); -+ sp = sensor_by_name( "Ambient", NETSNMP_SENSOR_TYPE_TEMPERATURE); -+ if ( sp ) { -+ sp->value = enc_info->value; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ } -+ break; -+ -+ case ENVCTRL_ENCL_CPUTEMPR: -+ DEBUGMSGTL(("sensors:arch:detail", "Enclosure CPU Temperature\n")); -+ memset( name, 0, 256 ); -+ snprintf( name, 255, "CPU%d", enc_info->instance ); -+ sp = sensor_by_name( name, NETSNMP_SENSOR_TYPE_TEMPERATURE); -+ if ( sp ) { -+ sp->value = enc_info->value; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ snprintf( sp->descr, 255, "CPU%d temperature", enc_info->instance ); -+ } -+ break; -+ -+ case ENVCTRL_ENCL_BACKPLANE4: -+ DEBUGMSGTL(("sensors:arch:detail", "Enclosure Backplane4\n")); -+ sp = sensor_by_name( "Backplane4", NETSNMP_SENSOR_TYPE_OTHER); -+ if ( sp ) { -+ sp->value = enc_info->value; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ } -+ break; -+ -+ case ENVCTRL_ENCL_BACKPLANE8: -+ DEBUGMSGTL(("sensors:arch:detail", "Enclosure Backplane4\n")); -+ sp = sensor_by_name( "Backplane4", NETSNMP_SENSOR_TYPE_OTHER); -+ if ( sp ) { -+ sp->value = enc_info->value; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ } -+ break; -+ -+ default: -+ DEBUGMSGTL(("sensors:arch:detail", "Unrecognised Enclosure entry (%d)n", -+ enc_info->type)); -+ } -+ -+ enc_info++; -+ } -+ } -+ -+ return 0; -+} -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/kstat_sensors.h ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/kstat_sensors.h 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1 @@ -+config_require(hardware/sensors/hw_sensors) -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/lmsensors_v2.c ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/lmsensors_v2.c 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1,75 @@ -+#include -+#include -+#include -+#include -+ -+#include "util_funcs.h" -+#include -+#include -+ -+void netsnmp_sensor_arch_init( void ) { -+ FILE *fp = fopen("/etc/sensors.conf", "r"); -+ DEBUGMSGTL(("sensors:arch", "Initialise LM Sensors module\n")); -+ sensors_init( fp ); -+} -+ -+int -+netsnmp_sensor_arch_load(netsnmp_cache *cache, void *vp) { -+ netsnmp_sensor_info *sp; -+ const sensors_chip_name *chip; -+ const sensors_feature_data *data; -+ int chip_nr = 0; -+ -+ DEBUGMSGTL(("sensors:arch", "Reload LM Sensors module\n")); -+ while ((chip = sensors_get_detected_chips(&chip_nr))) { -+ int a = 0; -+ int b = 0; -+ -+ while ((data = sensors_get_all_features(*chip, &a, &b))) { -+ DEBUGMSGTL(("sensors:arch:detail", "get_all_features (%d, %d)\n", a, b)); -+ char *label = NULL; -+ double val; -+ int type = NETSNMP_SENSOR_TYPE_OTHER; -+ -+ if ((data->mode & SENSORS_MODE_R) && -+ (data->mapping == SENSORS_NO_MAPPING) && -+ !sensors_get_label(*chip, data->number, &label) && -+ !sensors_get_feature(*chip, data->number, &val)) { -+ -+ DEBUGMSGTL(("sensors:arch:detail", "%s = %f\n", label, val)); -+ /* -+ * Determine the type of sensor from the description. -+ * -+ * If the text being looked for below is not in the label of a -+ * given sensor (e.g., the temp1 sensor has been labeled 'CPU' -+ * rather than 'CPU temp') it will be categorised as OTHER. -+ */ -+ if (strstr(label, "V")) { -+ type = NETSNMP_SENSOR_TYPE_VOLTAGE_DC; -+ } -+ if (strstr(label, "fan") || strstr(label, "Fan")) { -+ type = NETSNMP_SENSOR_TYPE_RPM; -+ } -+ if (strstr(label, "temp") || strstr(label, "Temp")) { -+ type = NETSNMP_SENSOR_TYPE_TEMPERATURE; -+ } -+ -+ /* -+ * Use this type to create a new sensor entry -+ * (inserting it in the appropriate sub-containers) -+ */ -+ sp = sensor_by_name( label, type ); -+ if ( sp ) { -+ sp->value = val; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ } -+ } -+ if (label) { -+ free(label); -+ label = NULL; -+ } -+ } /* end while data */ -+ } /* end while chip */ -+ -+ return 0; -+} -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/lmsensors_v2.h ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/lmsensors_v2.h 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1 @@ -+config_require(hardware/sensors/hw_sensors) -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/lmsensors_v3.c ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/lmsensors_v3.c 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1,101 @@ -+#include -+#include -+#include -+#include -+ -+#include "util_funcs.h" -+#include -+#include -+ -+ -+void netsnmp_sensor_arch_init( void ) { -+ FILE *fp = fopen("/etc/sensors.conf", "r"); -+ DEBUGMSGTL(("sensors:arch", "Initialise v3 LM Sensors module\n")); -+ sensors_init( fp ); -+} -+ -+int -+netsnmp_sensor_arch_load(netsnmp_cache *cache, void *vp) { -+ netsnmp_sensor_info *sp; -+ const sensors_chip_name *chip; -+ const sensors_feature *data; -+ const sensors_subfeature *data2; -+ int chip_nr = 0; -+ -+ DEBUGMSGTL(("sensors:arch", "Reload v3 LM Sensors module\n")); -+ while ((chip = sensors_get_detected_chips( NULL, &chip_nr))) { -+ int a = 0; -+ -+ while ((data = sensors_get_features( chip, &a))) { -+ DEBUGMSGTL(("sensors:arch:detail", "get_features (%s, %d)\n", data->name, data->number)); -+ int b = 0; -+ -+ -+ while ((data2 = sensors_get_all_subfeatures( chip, data, &b))) { -+ char *label = NULL; -+ double val; -+ int type = NETSNMP_SENSOR_TYPE_OTHER; -+ -+ DEBUGMSGTL(("sensors:arch:detail", " get_subfeatures (%s, %d)\n", data2->name, data2->number)); -+ /* -+ * Check the type of this subfeature, -+ * concentrating on the main "input" measurements. -+ */ -+ switch ( data2->type ) { -+ case SENSORS_SUBFEATURE_IN_INPUT: -+ type = NETSNMP_SENSOR_TYPE_VOLTAGE_DC; -+ break; -+ case SENSORS_SUBFEATURE_FAN_INPUT: -+ type = NETSNMP_SENSOR_TYPE_RPM; -+ break; -+ case SENSORS_SUBFEATURE_TEMP_INPUT: -+ type = NETSNMP_SENSOR_TYPE_TEMPERATURE; -+ break; -+ case SENSORS_SUBFEATURE_VID: -+ type = NETSNMP_SENSOR_TYPE_VOLTAGE_DC; -+ break; -+ default: -+ /* Skip everything other than these basic sensor features - ??? */ -+ DEBUGMSGTL(("sensors:arch:detail", " Skip type %x\n", data2->type)); -+ continue; -+ } -+ -+ /* -+ * Get the name and value of this subfeature -+ */ -+/* -+ if (!(label = sensors_get_label(chip, data))) { -+ DEBUGMSGTL(("sensors:arch:detail", " Can't get name (%s)\n", label)); -+ continue; -+ } -+ if (sensors_get_value(chip, data2->number, &val) < 0) { -+ DEBUGMSGTL(("sensors:arch:detail", " Can't get value (%f)\n", val)); -+ continue; -+ } -+*/ -+ if (!(label = sensors_get_label(chip, data)) || -+ (sensors_get_value(chip, data2->number, &val) < 0)) { -+ DEBUGMSGTL(("sensors:arch:detail", " Can't get name/value (%s, %f)\n", label, val)); -+ continue; -+ } -+ DEBUGMSGTL(("sensors:arch:detail", "%s = %f\n", label, val)); -+ -+ /* -+ * Use this type to create a new sensor entry -+ * (inserting it in the appropriate sub-containers) -+ */ -+ sp = sensor_by_name( label, type ); -+ if ( sp ) { -+ sp->value = val; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ } -+ if (label) { -+ free(label); -+ label = NULL; -+ } -+ } /* end while data2 */ -+ } /* end while data */ -+ } /* end while chip */ -+ -+ return 0; -+} -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/lmsensors_v3.h ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/lmsensors_v3.h 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1 @@ -+config_require(hardware/sensors/hw_sensors) -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/picld_sensors.c ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/picld_sensors.c 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1,341 @@ -+#include -+#include -+#include -+#include -+ -+#include "util_funcs.h" -+#include -+ -+#include -+#include -+ -+void netsnmp_sensor_arch_init( void ) { -+ DEBUGMSGTL(("sensors:arch", "Initialise PICLd Sensors module\n")); -+ picl_initialize(); -+} -+ -+ -+/* -+ * Handle a numeric-valued sensor -+ */ -+static int -+read_num_sensor( picl_nodehdl_t childh, char *propval, float *value ) -+{ -+ picl_nodehdl_t sensorh; -+ picl_propinfo_t sensor_info; -+ picl_errno_t error_code; -+ -+ union valu { -+ char buf[PICL_PROPSIZE_MAX]; -+ uint32_t us4; -+ uint16_t us2; -+ int32_t is4; -+ int16_t is2; -+ float f; -+ } val; -+ -+ /* -+ * Retrieve the specified sensor information and value -+ */ -+ error_code = picl_get_propinfo_by_name(childh, propval, &sensor_info, &sensorh); -+ if ( error_code != PICL_SUCCESS ) { -+ DEBUGMSGTL(("sensors:arch:detail", "sensor info lookup failed (%d)\n", -+ error_code)); -+ return( error_code ); -+ } -+ -+ error_code = picl_get_propval(sensorh, &val.buf, sensor_info.size); -+ if ( error_code != PICL_SUCCESS ) { -+ DEBUGMSGTL(("sensors:arch:detail", "sensor value lookup failed (%d)\n", -+ error_code)); -+ return( error_code ); -+ } -+ -+ /* -+ * Check the validity (type and size) of this value -+ */ -+ if ( sensor_info.type == PICL_PTYPE_FLOAT ) { -+ *value = val.f; -+ } else if ( sensor_info.type == PICL_PTYPE_UNSIGNED_INT ) { -+ /* 16-bit or 32-bit unsigned integers */ -+ if ( sensor_info.size == 2 ) { -+ *value = val.us2; -+ } else if ( sensor_info.size == 4 ) { -+ *value = val.us4; -+ } else { -+ DEBUGMSGTL(("sensors:arch:detail", "unsigned integer (%d bit)\n", -+ sensor_info.size * 8)); -+ return PICL_FAILURE; -+ } -+ } else if ( sensor_info.type == PICL_PTYPE_INT ) { -+ /* 16-bit or 32-bit signed integers */ -+ if ( sensor_info.size == 2 ) { -+ *value = val.is2; -+ } else if ( sensor_info.size == 4 ) { -+ *value = val.is4; -+ } else { -+ DEBUGMSGTL(("sensors:arch:detail", "signed integer (%d bit)\n", -+ sensor_info.size * 8)); -+ return PICL_FAILURE; -+ } -+ } else { -+ DEBUGMSGTL(("sensors:arch:detail", "unrecognised type (%d)\n", -+ sensor_info.type)); -+ return PICL_FAILURE; -+ } -+ -+ return error_code; -+} -+ -+static int -+process_num_sensor( picl_nodehdl_t childh, char *propname, char *propval, int typ ) -+{ -+ netsnmp_sensor_info *sp; -+ float value; -+ picl_errno_t error_code; -+ -+ sp = sensor_by_name( propname, typ ); -+ if ( !sp ) { -+ return -1; -+ } -+ -+ error_code = read_num_sensor( childh, propval, &value ); -+ if ( error_code == PICL_SUCCESS ) { -+ sp->value = value; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ } else { -+ DEBUGMSGTL(("sensors:arch:detail", "Failed to read %s sensor value (%d)\n", -+ propname, error_code)); -+ return -1; -+ } -+ return 0; -+} -+ -+ -+ -+/* -+ * Handle an enumeration-valued sensor -+ */ -+char *switch_settings[] = { "OFF","ON","NORMAL","LOCKED", -+ "UNKNOWN","DIAG","SECURE", -+ NULL }; -+char *led_settings[] = { "OFF","ON","BLINK", -+ NULL }; -+char *i2c_settings[] = { "OK", -+ NULL }; -+ -+static int -+read_enum_sensor( picl_nodehdl_t childh, float *value, char **options ) -+{ -+ picl_nodehdl_t sensorh; -+ picl_propinfo_t sensor_info; -+ picl_errno_t error_code; -+ char state[PICL_PROPSIZE_MAX]; -+ int i; -+ -+ /* -+ * Retrieve the specified sensor information and value -+ */ -+ error_code = picl_get_propinfo_by_name(childh, "State", &sensor_info, &sensorh); -+ if ( error_code != PICL_SUCCESS ) { -+ DEBUGMSGTL(("sensors:arch:detail", "sensor info lookup failed (%d)\n", -+ error_code)); -+ return( error_code ); -+ } -+ -+ error_code = picl_get_propval(sensorh, state, sensor_info.size); -+ if ( error_code != PICL_SUCCESS ) { -+ DEBUGMSGTL(("sensors:arch:detail", "sensor value lookup failed (%d)\n", -+ error_code)); -+ return( error_code ); -+ } -+ -+ /* -+ * Try to find a matching entry in the list of options. -+ * Note that some platforms may use upper or lower case -+ * versions of these enumeration values -+ * (so the checks are case insensitive) -+ */ -+ *value = 99; /* Dummy value */ -+ for ( i=0; options[i] != NULL; i++ ) { -+ if (strncasecmp(state, options[i], strlen(options[i])) == 0) { -+ *value = i; -+ return 0; -+ } -+ } -+ -+ DEBUGMSGTL(("sensors:arch:detail", "Enumeration state %s not matched\n", -+ state)); -+ return 0; /* Or an error ? */ -+} -+ -+static int -+process_enum_sensor( picl_nodehdl_t childh, char *propname, int typ, char **options ) -+{ -+ netsnmp_sensor_info *sp; -+ float value; -+ picl_errno_t error_code; -+ -+ sp = sensor_by_name( propname, typ ); -+ if ( !sp ) { -+ return -1; -+ } -+ -+ error_code = read_enum_sensor( childh, &value, options ); -+ if ( error_code == PICL_SUCCESS ) { -+ sp->value = value; -+ sp->flags|= NETSNMP_SENSOR_FLAG_ACTIVE; -+ } else { -+ DEBUGMSGTL(("sensors:arch:detail", "Failed to read %s sensor value (%d)\n", -+ propname, error_code)); -+ return -1; -+ } -+ return 0; -+} -+static int -+process_enum_sensor( picl_nodehdl_t childh, char *propname, int typ, char **options ) -+{ -+ return 0; -+} -+ -+ -+ -+/* -+ * Recursively walk through the tree of sensors -+ */ -+static int -+process_sensors( int level, picl_nodehdl_t nodeh ) { -+ picl_nodehdl_t childh, nexth; -+ char propname[ PICL_PROPNAMELEN_MAX ]; -+ char propclass[ PICL_CLASSNAMELEN_MAX ]; -+ picl_errno_t error_code; -+ -+ level++; -+ DEBUGMSGTL(("sensors:arch:detail", "process_sensors - level %d\n", level)); -+ -+ /* Look up the first child node at this level */ -+ error_code = pick_get_propval_by_name( nodeh, PICL_PROP_CHILD, -+ &childh, sizeof(childh)); -+ if ( error_code != PICL_SUCCESS ) { -+ DEBUGMSGTL(("sensors:arch:detail", "Failed to get first child node (%d)\n", -+ error_code)); -+ return( error_code ); -+ } -+ -+ /* Step through the child nodes, retrieving the name and class of each one */ -+ while ( error_code == PICL_SUCCESS ) { -+ error_code = pick_get_propval_by_name( childh, PICL_PROP_NAME, -+ propname, sizeof(propname)-1); -+ if ( error_code != PICL_SUCCESS ) { -+ /* The Node With No Name */ -+ DEBUGMSGTL(("sensors:arch:detail", "get property name failed (%d)\n", -+ error_code)); -+ return( error_code ); -+ } -+ -+ error_code = pick_get_propval_by_name( childh, PICL_PROP_CLASSNAME, -+ propclass, sizeof(propclass)-1); -+ if ( error_code != PICL_SUCCESS ) { -+ /* The Classless Society */ -+ DEBUGMSGTL(("sensors:arch:detail", "get property class failed (%d)\n", -+ error_code)); -+ return( error_code ); -+ } -+ -+ DEBUGMSGTL(("sensors:arch:detail", "Name: %s, Class %s\n", -+ propname, propclass )); -+ -+ -+ /* -+ * Three classes represent further groups of sensors, etc. -+ * Call 'process_sensors' recursively to handle this next level -+ */ -+ if (( strstr( propclass, "picl" )) || -+ ( strstr( propclass, "frutree" )) || -+ ( strstr( propclass, "obp" ))) { -+ process_sensors( level, childh ); -+ } -+ /* -+ * Otherwise retrieve the value appropriately based on the -+ * class of the sensor. -+ * -+ * We need to specify the name of the PICL property to retrieve -+ * for this class of sensor, and the Net-SNMP sensor type. -+ */ -+ else if ( strstr( propclass, "fan-tachometer" )) { -+ process_num_sensor( childh, propname, "AtoDSensorValue", -+ NETSNMP_SENSOR_TYPE_RPM ); -+ } else if ( strstr( propclass, "fan" )) { -+ process_num_sensor( childh, propname, "Speed", -+ NETSNMP_SENSOR_TYPE_RPM ); -+ } else if ( strstr( propclass, "temperature-sensor" )) { -+ process_num_sensor( childh, propname, "Temperature", -+ NETSNMP_SENSOR_TYPE_TEMPERATURE ); -+ } else if ( strstr( propclass, "voltage-sensor" )) { -+ process_num_sensor( childh, propname, "Voltage", -+ /* ?? */ NETSNMP_SENSOR_TYPE_VOLTAGE_DC ); -+ } else if ( strstr( propclass, "digital-sensor" )) { -+ process_num_sensor( childh, propname, "AtoDSensorValue", -+ /* ?? */ NETSNMP_SENSOR_TYPE_VOLTAGE_DC ); -+ /* -+ * Enumeration-valued sensors use a fixed PICL property ("State"), -+ * but take a list of the values appropriate for that sensor, -+ * as well as the Net-SNMP sensor type. -+ */ -+ } else if ( strstr( propclass, "switch" )) { -+ process_enum_sensor( childh, propname, NETSNMP_SENSOR_TYPE_OTHER, -+ switch_settings ); -+ } else if ( strstr( propclass, "led" )) { -+ process_enum_sensor( childh, propname, NETSNMP_SENSOR_TYPE_OTHER, -+ led_settings ); -+ } else if ( strstr( propclass, "i2c" )) { -+ process_enum_sensor( childh, propname, NETSNMP_SENSOR_TYPE_BOOLEAN, /* ?? */ -+ i2c_settings ); -+ } else { -+ /* Skip other classes of sensor */ -+ DEBUGMSGTL(("sensors:arch:detail", "Skipping class %s\n", propclass )); -+ } -+ -+ /* -+ * Move on to the next child node at the current level (if any) -+ */ -+ error_code = pick_get_propval_by_name( childh, PICL_PROP_PEER, -+ &nexth, sizeof(nexth)); -+ if ( error_code != PICL_SUCCESS ) { -+ /* That's All Folks! */ -+ return (( error_code == PICL_PROPNOTFOUND ) -+ ? PICL_SUCCESS : error_code ); -+ } -+ childh = nexth; -+ } -+ -+ return error_code; -+} -+ -+ -+int -+netsnmp_sensor_arch_load(netsnmp_cache *cache, void *vp) { -+ int error_code; -+ picl_nodehdl_t rooth; -+ -+ DEBUGMSGTL(("sensors:arch", "Reload PICLd Sensors module\n")); -+ -+ error_code = picl_get_root(&rooth); -+ if ( error_code != PICL_SUCCESS) { -+ DEBUGMSGTL(("sensors:arch", "Couldn't get root node (error %d)\n", error_code)); -+ return 1; -+ } -+ -+ error_code = process_sensors(0, rooth); -+ if ( error_code != 255 ) -+ if ( error_code != 7 ) /* ignore PICL_PROPNOTFOUND error */ -+ DEBUGMSGTL(("sensors:arch", "Internal PICLd problem (error %d)\n", error_code)); -+ -+ return 0; -+} -+ -+void netsnmp_sensor_arch_shutdown( void ) { -+ DEBUGMSGTL(("sensors:arch", "Shutdown PicLD Sensors module\n")); -+ picl_shutdown(); -+} -+ -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/hardware/sensors/picld_sensors.h ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/hardware/sensors/picld_sensors.h 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1 @@ -+config_require(hardware/sensors/hw_sensors) -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/ucd-snmp/lmsensorsMib.c ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/ucd-snmp/lmsensorsMib.c 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1,205 @@ -+#include -+#include -+#include -+#include -+#include "ucd-snmp/lmsensorsMib.h" -+ -+netsnmp_container *sensorContainer = NULL; -+ -+void initialize_lmSensorsTable(const char *tableName, oid *tableOID, -+ netsnmp_container_op *filter, int mult ); -+ -+int _sensor_filter_temp( netsnmp_container *c, const void *v ); -+int _sensor_filter_fan( netsnmp_container *c, const void *v ); -+int _sensor_filter_volt( netsnmp_container *c, const void *v ); -+int _sensor_filter_misc( netsnmp_container *c, const void *v ); -+ -+static oid lmTempSensorsTable_oid[] = {1,3,6,1,4,1,2021,13,16,2}; -+static oid lmFanSensorsTable_oid[] = {1,3,6,1,4,1,2021,13,16,3}; -+static oid lmVoltSensorsTable_oid[] = {1,3,6,1,4,1,2021,13,16,4}; -+static oid lmMiscSensorsTable_oid[] = {1,3,6,1,4,1,2021,13,16,5}; -+ /* All the tables have the same length root OID */ -+size_t lmSensorsTables_oid_len = OID_LENGTH(lmMiscSensorsTable_oid); -+ -+ -+/* Initialise the LM Sensors MIB module */ -+void -+init_lmsensorsMib(void) -+{ -+ DEBUGMSGTL(("ucd-snmp/lmsensorsMib","Initializing LM-SENSORS-MIB tables\n")); -+ -+ /* -+ * Initialise the four LM-SENSORS-MIB tables -+ * -+ * They are almost identical, so we can use the same registration code. -+ */ -+ initialize_lmSensorsTable( "lmTempSensorsTable", lmTempSensorsTable_oid, -+ _sensor_filter_temp, 1000 ); /* MIB asks for mC */ -+ initialize_lmSensorsTable( "lmFanSensorsTable", lmFanSensorsTable_oid, -+ _sensor_filter_fan, 1); -+ initialize_lmSensorsTable( "lmVoltSensorsTable", lmVoltSensorsTable_oid, -+ _sensor_filter_volt, 1000 ); /* MIB asks for mV */ -+ initialize_lmSensorsTable( "lmMiscSensorsTable", lmMiscSensorsTable_oid, -+ _sensor_filter_misc, 1 ); -+} -+ -+/* -+ * Common initialisation code, used for setting up all four tables -+ */ -+void -+initialize_lmSensorsTable(const char *tableName, oid *tableOID, -+ netsnmp_container_op *filter, int mult ) -+{ -+ netsnmp_handler_registration *reg; -+ netsnmp_table_registration_info *table_info; -+ netsnmp_cache *cache; -+ netsnmp_container *container; -+ -+ /* -+ * Ensure the HAL sensors module has been initialised, -+ * and retrieve the main sensors container. -+ * This table will then be registered using a filter on this container. -+ */ -+ sensorContainer = get_sensor_container(); -+ if ( !sensorContainer ) { -+ init_hw_sensors( ); -+ sensorContainer = get_sensor_container(); -+ } -+ container = netsnmp_container_find("sensorTable:table_container"); -+ container->insert_filter = filter; -+ netsnmp_container_add_index( sensorContainer, container ); -+ -+ -+ /* -+ * Create a basic registration structure for the table -+ */ -+ reg = netsnmp_create_handler_registration( -+ tableName, lmSensorsTables_handler, -+ tableOID, lmSensorsTables_oid_len, HANDLER_CAN_RONLY -+ ); -+ -+ /* -+ * Register the table using the filtered container -+ * Include an indicator of any scaling to be applied to the sensor value -+ */ -+ reg->my_reg_void = (void *)mult; -+ table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info ); -+ netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER, 0); -+ table_info->min_column = COLUMN_LMSENSORS_INDEX; -+ table_info->max_column = COLUMN_LMSENSORS_VALUE; -+ netsnmp_container_table_register( reg, table_info, container, 0 ); -+ -+ /* -+ * If the HAL sensors module was configured as an on-demand caching -+ * module (rather than being automatically loaded regularly), -+ * then ensure this table makes use of that cache. -+ */ -+ cache = get_sensor_cache(); -+ if ( cache ) { -+ netsnmp_inject_handler_before( reg, netsnmp_cache_handler_get( cache ), -+ "table_container"); -+ } -+ -+} -+ -+ -+/* -+ * Container filters for the four tables -+ * -+ * Used to ensure that sensor entries appear in the appropriate table. -+ */ -+int _sensor_filter_temp( netsnmp_container *c, const void *v ) { -+ const netsnmp_sensor_info *sp = (const netsnmp_sensor_info *)v; -+ /* Only matches temperature sensors */ -+ return (( sp->type == NETSNMP_SENSOR_TYPE_TEMPERATURE ) ? 0 : 1 ); -+} -+ -+int _sensor_filter_fan( netsnmp_container *c, const void *v ) { -+ const netsnmp_sensor_info *sp = (const netsnmp_sensor_info *)v; -+ /* Only matches fan sensors */ -+ return (( sp->type == NETSNMP_SENSOR_TYPE_RPM ) ? 0 : 1 ); -+} -+ -+int _sensor_filter_volt( netsnmp_container *c, const void *v ) { -+ const netsnmp_sensor_info *sp = (const netsnmp_sensor_info *)v; -+ /* Only matches voltage sensors (AC or DC) */ -+ return ((( sp->type == NETSNMP_SENSOR_TYPE_VOLTAGE_DC ) || -+ ( sp->type == NETSNMP_SENSOR_TYPE_VOLTAGE_AC )) ? 0 : 1 ); -+} -+ -+int _sensor_filter_misc( netsnmp_container *c, const void *v ) { -+ const netsnmp_sensor_info *sp = (const netsnmp_sensor_info *)v; -+ /* Matches everything except temperature, fan or voltage sensors */ -+ return ((( sp->type == NETSNMP_SENSOR_TYPE_TEMPERATURE ) || -+ ( sp->type == NETSNMP_SENSOR_TYPE_RPM ) || -+ ( sp->type == NETSNMP_SENSOR_TYPE_VOLTAGE_DC ) || -+ ( sp->type == NETSNMP_SENSOR_TYPE_VOLTAGE_AC )) ? 1 : 0 ); -+} -+ -+ -+/* -+ * Handle requests for any of the four lmXxxxSensorsTables -+ * -+ * This is possible because all the table share the -+ * same structure and behaviour. -+ */ -+int -+lmSensorsTables_handler( -+ netsnmp_mib_handler *handler, -+ netsnmp_handler_registration *reginfo, -+ netsnmp_agent_request_info *reqinfo, -+ netsnmp_request_info *requests) { -+ -+ netsnmp_request_info *request; -+ netsnmp_table_request_info *table_info; -+ netsnmp_sensor_info *sensor_info; -+ int mult = (int)reginfo->my_reg_void; -+ -+ DEBUGMSGTL(( "ucd-snmp/lmsensorsMib","lmSensorsTables_handler - root: ")); -+ DEBUGMSGOID(("ucd-snmp/lmsensorsMib", reginfo->rootoid, reginfo->rootoid_len)); -+ DEBUGMSG(( "ucd-snmp/lmsensorsMib",", mode %d\n", reqinfo->mode )); -+ /* -+ * This is a read-only table, so we only need to handle GET requests. -+ * (The container helper converts GETNEXT->GET requests automatically). -+ */ -+ switch (reqinfo->mode) { -+ case MODE_GET: -+ for (request=requests; request; request=request->next) { -+ sensor_info = (netsnmp_sensor_info *) -+ netsnmp_container_table_extract_context(request); -+ if ( !sensor_info ) { -+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE); -+ continue; -+ } -+ -+ table_info = netsnmp_extract_table_info(request); -+ switch (table_info->colnum) { -+ case COLUMN_LMSENSORS_INDEX: -+ snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER, -+ sensor_info->idx.oids[0]); -+ break; -+ case COLUMN_LMSENSORS_DEVICE: -+ if ( sensor_info->descr[0] != '\0' ) { -+ snmp_set_var_typed_value( request->requestvb, ASN_OCTET_STR, -+ sensor_info->descr, strlen(sensor_info->descr)); -+ } else { -+ snmp_set_var_typed_value( request->requestvb, ASN_OCTET_STR, -+ sensor_info->name, strlen(sensor_info->name)); -+ } -+ break; -+ case COLUMN_LMSENSORS_VALUE: -+ /* Multiply the value by the appropriate scaling factor for this table */ -+ snmp_set_var_typed_integer( request->requestvb, ASN_GAUGE, -+ (int)(mult*sensor_info->value)); -+ break; -+ default: -+ netsnmp_set_request_error(reqinfo, request, -+ SNMP_NOSUCHOBJECT); -+ break; -+ } -+ } -+ break; -+ -+ } -+ return SNMP_ERR_NOERROR; -+} -diff -up /dev/null net-snmp-5.4.1/agent/mibgroup/ucd-snmp/lmsensorsMib.h ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/ucd-snmp/lmsensorsMib.h 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1,23 @@ -+#ifndef LM_SENSORS_MIB_H -+#define LM_SENSORS_MIB_H -+ -+config_require(hardware/sensors) -+config_add_mib(LM-SENSORS-MIB) -+ -+/* function declarations */ -+void init_lmsensorsMib(void); -+ -+/* -+ * Handler and Column definitions for lmXxxxSensorsTable -+ * -+ * Note that the same handler (and hence the same -+ * column identifiers) are used for all four tables. -+ * This is possible because all the table share the -+ * same structure and behaviour. -+ */ -+Netsnmp_Node_Handler lmSensorsTables_handler; -+#define COLUMN_LMSENSORS_INDEX 1 -+#define COLUMN_LMSENSORS_DEVICE 2 -+#define COLUMN_LMSENSORS_VALUE 3 -+ -+#endif /* LM_SENSORS_MIB_H */ -diff -up net-snmp-5.4.1/configure.backup_patch_15 net-snmp-5.4.1/configure ---- net-snmp-5.4.1/configure.backup_patch_15 2008-07-25 12:53:39.000000000 +0200 -+++ net-snmp-5.4.1/configure 2008-07-25 12:53:46.000000000 +0200 -@@ -31030,7 +31030,7 @@ fi - fi - - # LM-SENSORS-MIB support --echo " $module_list " | grep " ucd-snmp/lmSensors " > /dev/null -+echo " $module_list " | $GREP -i "ucd-snmp/lmsensor" > /dev/null - if test $? -eq 0 ; then - echo "$as_me:$LINENO: checking for sensors support" >&5 - echo $ECHO_N "checking for sensors support... $ECHO_C" >&6 -diff -up net-snmp-5.4.1/configure.in.backup_patch_15 net-snmp-5.4.1/configure.in ---- net-snmp-5.4.1/configure.in.backup_patch_15 2008-07-25 12:53:39.000000000 +0200 -+++ net-snmp-5.4.1/configure.in 2008-07-25 12:53:46.000000000 +0200 -@@ -2880,7 +2880,7 @@ if test $? -eq 0 ; then - fi - - # LM-SENSORS-MIB support --echo " $module_list " | grep " ucd-snmp/lmSensors " > /dev/null -+echo " $module_list " | $GREP -i "ucd-snmp/lmsensor" > /dev/null - if test $? -eq 0 ; then - AC_MSG_CHECKING([for sensors support]) - case $target_os in -diff -up /dev/null net-snmp-5.4.1/include/net-snmp/agent/hardware/sensors.h ---- /dev/null 2008-07-23 14:59:56.660004489 +0200 -+++ net-snmp-5.4.1/include/net-snmp/agent/hardware/sensors.h 2008-07-25 12:53:46.000000000 +0200 -@@ -0,0 +1,48 @@ -+/* -+ * Hardware Abstraction Layer - Sensors module -+ * -+ * Public interface -+ */ -+ -+#define NETSNMP_SENSOR_TYPE_OTHER 1 -+#define NETSNMP_SENSOR_TYPE_VOLTAGE_AC 3 -+#define NETSNMP_SENSOR_TYPE_VOLTAGE_DC 4 -+#define NETSNMP_SENSOR_TYPE_CURRENT 5 -+#define NETSNMP_SENSOR_TYPE_POWER 6 -+#define NETSNMP_SENSOR_TYPE_FREQUENCY 7 -+#define NETSNMP_SENSOR_TYPE_TEMPERATURE 8 -+#define NETSNMP_SENSOR_TYPE_HUMIDITY 9 -+#define NETSNMP_SENSOR_TYPE_RPM 10 -+#define NETSNMP_SENSOR_TYPE_VOLUME 11 -+#define NETSNMP_SENSOR_TYPE_BOOLEAN 12 -+ -+ -+#define NETSNMP_SENSOR_FLAG_ACTIVE 0x01 -+#define NETSNMP_SENSOR_FLAG_NAVAIL 0x02 -+#define NETSNMP_SENSOR_FLAG_BROKEN 0x04 -+#define NETSNMP_SENSOR_FLAG_DISABLE 0x08 -+ -+#define NETSNMP_SENSOR_MASK_STATUS 0x06 /* NAVAIL|BROKEN */ -+ -+ -+#define NETSNMP_SENSOR_FIND_CREATE 1 /* or use one of the sensor type values */ -+#define NETSNMP_SENSOR_FIND_EXIST 0 -+ -+typedef struct netsnmp_sensor_info_s netsnmp_sensor_info; -+struct netsnmp_sensor_info_s { -+ -+ netsnmp_index idx; -+ /* int idx; */ -+ char name[256]; -+ -+ int type; -+ float value; -+ char descr[256]; -+ long flags; -+}; -+ -+netsnmp_container *get_sensor_container( void ); -+netsnmp_cache *get_sensor_cache( void ); -+netsnmp_sensor_info *sensor_by_name( char *, int ); -+NetsnmpCacheLoad netsnmp_sensor_load; -+NetsnmpCacheFree netsnmp_sensor_free; diff --git a/net-snmp-5.4.1-shared-ip.patch b/net-snmp-5.4.1-shared-ip.patch deleted file mode 100644 index 9d7138a..0000000 --- a/net-snmp-5.4.1-shared-ip.patch +++ /dev/null @@ -1,116 +0,0 @@ -TODO: remove with 5.4.3 - another approach is implemented upstream - -diff -up net-snmp-5.4.2/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c.shared-ip net-snmp-5.4.2/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c ---- net-snmp-5.4.2/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c.shared-ip 2008-01-17 01:09:33.000000000 +0100 -+++ net-snmp-5.4.2/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c 2008-09-17 16:43:18.000000000 +0200 -@@ -279,11 +279,15 @@ _netsnmp_ioctl_ipaddress_container_load_ - /* - * add entry to container - */ -- if (CONTAINER_INSERT(container, entry) < 0) -- { -- DEBUGMSGTL(("access:ipaddress:container","error with ipaddress_entry: insert into container failed.\n")); -+ rc = CONTAINER_TRY_INSERT(container, entry); -+ if (rc < 0) { -+ static int logged = 0; -+ if (!logged) { -+ snmp_log(LOG_NOTICE, "Duplicate IP address detected, some interfaces may not be visible in IP-MIB\n"); -+ logged = 1; -+ } -+ rc = 0; - netsnmp_access_ipaddress_entry_free(entry); -- continue; - } - } - -diff -up net-snmp-5.4.2/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c.shared-ip net-snmp-5.4.2/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c ---- net-snmp-5.4.2/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c.shared-ip 2008-08-13 15:02:12.000000000 +0200 -+++ net-snmp-5.4.2/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c 2008-09-17 16:43:18.000000000 +0200 -@@ -325,7 +325,16 @@ _load_v6(netsnmp_container *container, i - /* - * add entry to container - */ -- CONTAINER_INSERT(container, entry); -+ rc = CONTAINER_TRY_INSERT(container, entry); -+ if (rc < 0) { -+ static int logged = 0; -+ if (!logged) { -+ snmp_log(LOG_NOTICE, "Duplicate IP address detected, some interfaces may not be visible in IP-MIB\n"); -+ logged = 1; -+ } -+ netsnmp_access_ipaddress_entry_free(entry); -+ } -+ - } - - fclose(in); -diff -up net-snmp-5.4.2/include/net-snmp/library/container.h.shared-ip net-snmp-5.4.2/include/net-snmp/library/container.h ---- net-snmp-5.4.2/include/net-snmp/library/container.h.shared-ip 2008-02-14 00:37:48.000000000 +0100 -+++ net-snmp-5.4.2/include/net-snmp/library/container.h 2008-09-17 16:43:18.000000000 +0200 -@@ -406,8 +406,32 @@ extern "C" { - - } - return rc; -+ } -+ -+ NETSNMP_STATIC_INLINE -+ int CONTAINER_TRY_INSERT(netsnmp_container *x, const void *k) -+ { -+ const void *res = NULL; -+ -+ netsnmp_container *start; -+ /** start at first container */ -+ while(x->prev) -+ x = x->prev; -+ -+ start = x; -+ -+ for(; x; x = x->next) { -+ if ((NULL != x->insert_filter) && -+ (x->insert_filter(x,k) == 1)) -+ continue; -+ res = x->find(x,k); -+ if (res) { -+ return -1; -+ } -+ } -+ return CONTAINER_INSERT(start, k); - } -- -+ - /*------------------------------------------------------------------ - * These functions should EXACTLY match the function version in - * container.c. If you change one, change them both. -diff -up net-snmp-5.4.2/snmplib/container.c.shared-ip net-snmp-5.4.2/snmplib/container.c ---- net-snmp-5.4.2/snmplib/container.c.shared-ip 2008-02-14 00:37:48.000000000 +0100 -+++ net-snmp-5.4.2/snmplib/container.c 2008-09-17 16:43:18.000000000 +0200 -@@ -323,6 +323,29 @@ int CONTAINER_REMOVE(netsnmp_container * - return rc; - } - -+int CONTAINER_TRY_INSERT(netsnmp_container *x, const void *k) -+{ -+ const void *res = NULL; -+ -+ netsnmp_container *start; -+ /** start at first container */ -+ while(x->prev) -+ x = x->prev; -+ -+ start = x; -+ -+ for(; x; x = x->next) { -+ if ((NULL != x->insert_filter) && -+ (x->insert_filter(x,k) == 1)) -+ continue; -+ res = x->find(x,k); -+ if (res) { -+ return -1; -+ } -+ } -+ return CONTAINER_INSERT(start, k); -+} -+ - /*------------------------------------------------------------------ - * These functions should EXACTLY match the inline version in - * container.h. If you change one, change them both. diff --git a/net-snmp-5.4.1-strange_libpath.patch b/net-snmp-5.4.1-strange_libpath.patch deleted file mode 100644 index 1ef9e1c..0000000 --- a/net-snmp-5.4.1-strange_libpath.patch +++ /dev/null @@ -1,60 +0,0 @@ -diff -up net-snmp-5.4.1/configure.backup_patch_11 net-snmp-5.4.1/configure ---- net-snmp-5.4.1/configure.backup_patch_11 2008-07-25 12:53:35.000000000 +0200 -+++ net-snmp-5.4.1/configure 2008-07-25 12:53:39.000000000 +0200 -@@ -27922,7 +27922,7 @@ if test "${with_libwrap+set}" = set; the - if test "$with_libwrap" != "no"; then - if test "$with_libwrap" != "yes"; then - CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include" -- LDFLAGS="${LDFLAGS} -L$with_libwrap/lib" -+ LDFLAGS="${LDFLAGS} -L$with_libwrap" - fi - - _libs=${LIBS} -@@ -28126,7 +28126,7 @@ echo "${ECHO_T}yes" >&6 - #define NETSNMP_USE_LIBWRAP 1 - _ACEOF - -- test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib" -+ test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap" - _wraplibs="$_wraplibs -lwrap" - else - echo "$as_me: failed program was:" >&5 -@@ -28354,7 +28354,7 @@ echo "${ECHO_T}yes" >&6 - #define NETSNMP_USE_LIBWRAP 1 - _ACEOF - -- test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib" -+ test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap" - _wraplibs="$_wraplibs -lwrap -lnsl" - else - echo "$as_me: failed program was:" >&5 -diff -up net-snmp-5.4.1/configure.in.backup_patch_11 net-snmp-5.4.1/configure.in ---- net-snmp-5.4.1/configure.in.backup_patch_11 2007-07-27 19:02:00.000000000 +0200 -+++ net-snmp-5.4.1/configure.in 2008-07-25 12:53:39.000000000 +0200 -@@ -2714,7 +2714,7 @@ AC_ARG_WITH(libwrap, - if test "$with_libwrap" != "no"; then - if test "$with_libwrap" != "yes"; then - CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include" -- LDFLAGS="${LDFLAGS} -L$with_libwrap/lib" -+ LDFLAGS="${LDFLAGS} -L$with_libwrap" - fi - - _libs=${LIBS} -@@ -2732,7 +2732,7 @@ AC_ARG_WITH(libwrap, - - AC_MSG_RESULT([yes]) - AC_DEFINE(NETSNMP_USE_LIBWRAP) -- test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib" -+ test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap" - _wraplibs="$_wraplibs -lwrap"], - [ - AC_MSG_RESULT([no]) -@@ -2748,7 +2748,7 @@ AC_ARG_WITH(libwrap, - - AC_MSG_RESULT(yes) - AC_DEFINE(NETSNMP_USE_LIBWRAP) -- test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib" -+ test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap" - _wraplibs="$_wraplibs -lwrap -lnsl", - - AC_MSG_RESULT(no) diff --git a/net-snmp-5.4.1-xen-crash.patch b/net-snmp-5.4.1-xen-crash.patch deleted file mode 100644 index b01d28d..0000000 --- a/net-snmp-5.4.1-xen-crash.patch +++ /dev/null @@ -1,154 +0,0 @@ -386611: snmpd segfaults on xen network interfaces -Source: http://sourceforge.net/tracker/index.php?func=detail&aid=1794532&group_id=12694&atid=112694 -Reviewed-By: Jan Safranek - -Index: agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c -=================================================================== -diff -up net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_common.c.backup_patch_16 net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_common.c ---- net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_common.c.backup_patch_16 2007-07-17 01:59:44.000000000 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_common.c 2008-07-25 12:53:57.000000000 +0200 -@@ -411,6 +411,7 @@ static int _access_ipaddress_entry_compa - { - const netsnmp_ipaddress_entry *lh = (const netsnmp_ipaddress_entry *)lhs; - const netsnmp_ipaddress_entry *rh = (const netsnmp_ipaddress_entry *)rhs; -+ int rc; - - netsnmp_assert(NULL != lhs); - netsnmp_assert(NULL != rhs); -@@ -426,5 +427,17 @@ static int _access_ipaddress_entry_compa - /* - * length equal, compare address - */ -- return memcmp(lh->ia_address, rh->ia_address, lh->ia_address_len); -+ rc = memcmp(lh->ia_address, rh->ia_address, lh->ia_address_len); -+ if (rc) -+ return rc; -+ -+ /* -+ * address same, compare ifIndex -+ */ -+ if (lh->if_index < rh->if_index) -+ return -1; -+ else if (lh->if_index > rh->if_index) -+ return 1; -+ -+ return 0; - } -diff -up net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c.backup_patch_16 net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c ---- net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c.backup_patch_16 2006-12-06 16:10:40.000000000 +0100 -+++ net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c 2008-07-25 12:53:57.000000000 +0200 -@@ -348,10 +348,18 @@ ipAddressAddrType_map(u_long * mib_ipAdd - *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV4; - break; - -+ case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4Z: -+ *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV4Z; -+ break; -+ - case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6: - *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV6; - break; - -+ case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6Z: -+ *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV6Z; -+ break; -+ - default: - snmp_log(LOG_ERR, "couldn't map value %ld for ipAddressAddrType\n", - raw_ipAddressAddrType_val); -@@ -382,8 +390,11 @@ int - ipAddressTable_indexes_set_tbl_idx(ipAddressTable_mib_index * tbl_idx, - u_long ipAddressAddrType_val, - char *ipAddressAddr_val_ptr, -- size_t ipAddressAddr_val_ptr_len) -+ size_t ipAddressAddr_val_ptr_len, -+ u_long ipAddressAddr_ifIndex) - { -+ uint32_t zone = htonl(ipAddressAddr_ifIndex); -+ - DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_indexes_set_tbl_idx", "called\n")); - - /* -@@ -409,6 +420,11 @@ ipAddressTable_indexes_set_tbl_idx(ipAdd - memcpy(tbl_idx->ipAddressAddr, ipAddressAddr_val_ptr, - ipAddressAddr_val_ptr_len * sizeof(ipAddressAddr_val_ptr[0])); - -+ /** zone */ -+ tbl_idx->ipAddressAddr_len += sizeof(zone); -+ memcpy(&tbl_idx->ipAddressAddr[ipAddressAddr_val_ptr_len * -+ sizeof(ipAddressAddr_val_ptr[0])], -+ &zone, sizeof(zone)); - - return MFD_SUCCESS; - } /* ipAddressTable_indexes_set_tbl_idx */ -@@ -430,7 +446,8 @@ int - ipAddressTable_indexes_set(ipAddressTable_rowreq_ctx * rowreq_ctx, - u_long ipAddressAddrType_val, - char *ipAddressAddr_val_ptr, -- size_t ipAddressAddr_val_ptr_len) -+ size_t ipAddressAddr_val_ptr_len, -+ u_long ipAddressAddr_ifIndex) - { - DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_indexes_set", - "called\n")); -@@ -439,7 +456,8 @@ ipAddressTable_indexes_set(ipAddressTabl - ipAddressTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, - ipAddressAddrType_val, - ipAddressAddr_val_ptr, -- ipAddressAddr_val_ptr_len)) -+ ipAddressAddr_val_ptr_len, -+ ipAddressAddr_ifIndex)) - return MFD_ERROR; - - /* -diff -up net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h.backup_patch_16 net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h ---- net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h.backup_patch_16 2005-12-01 18:00:57.000000000 +0100 -+++ net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h 2008-07-25 12:53:57.000000000 +0200 -@@ -106,7 +106,9 @@ extern "C" { - * simplistic map of address length to type - */ - #define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4 4 -+#define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4Z 5 - #define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6 16 -+#define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6Z 17 - - - /************************************************************* -diff -up net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c.backup_patch_16 net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c ---- net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c.backup_patch_16 2007-05-17 23:53:28.000000000 +0200 -+++ net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c 2008-07-25 12:53:57.000000000 +0200 -@@ -258,9 +258,10 @@ _add_new_entry(netsnmp_ipaddress_entry * - if ((NULL != rowreq_ctx) && - (MFD_SUCCESS == - ipAddressTable_indexes_set(rowreq_ctx, -- ipaddress_entry->ia_address_len, -+ ipaddress_entry->ia_address_len + 1, - ipaddress_entry->ia_address, -- ipaddress_entry->ia_address_len))) { -+ ipaddress_entry->ia_address_len, -+ ipaddress_entry->if_index))) { - if (CONTAINER_INSERT(container, rowreq_ctx) < 0) { - DEBUGMSGTL (("ipAddressTable:access","container insert failed for new entry\n")); - ipAddressTable_release_rowreq_ctx(rowreq_ctx); -diff -up net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h.backup_patch_16 net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h ---- net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h.backup_patch_16 2006-01-25 17:28:12.000000000 +0100 -+++ net-snmp-5.4.1/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h 2008-07-25 12:53:57.000000000 +0200 -@@ -273,14 +273,16 @@ config_require(ip-mib/ipAddressTable/ipA - u_long ipAddressAddrType_val, - char *ipAddressAddr_val_ptr, - size_t -- ipAddressAddr_val_ptr_len); -+ ipAddressAddr_val_ptr_len, -+ u_long ipAddressAddr_ifIndex); - int ipAddressTable_indexes_set(ipAddressTable_rowreq_ctx * - rowreq_ctx, - u_long - ipAddressAddrType_val, - char *ipAddressAddr_val_ptr, - size_t -- ipAddressAddr_val_ptr_len); -+ ipAddressAddr_val_ptr_len, -+ u_long ipAddressAddr_ifIndex); - - - diff --git a/net-snmp-5.4.2.1-proc-div0.patch b/net-snmp-5.4.2.1-proc-div0.patch deleted file mode 100644 index 695afd1..0000000 --- a/net-snmp-5.4.2.1-proc-div0.patch +++ /dev/null @@ -1,21 +0,0 @@ -501210: net-snmp SIGFPE 0x00002aaaab37744a in var_hrproc (vp=0x7fffffffbf50) - -Author: Jan Safranek -Upstream as SVN rev. 17616. - -Index: net-snmp/agent/mibgroup/host/hr_proc.c -=================================================================== ---- net-snmp/agent/mibgroup/host/hr_proc.c (revision 17615) -+++ net-snmp/agent/mibgroup/host/hr_proc.c (working copy) -@@ -182,7 +182,10 @@ - return NULL; - - long_return = (cpu->idle_ticks - cpu->history[0].idle_hist)*100; -- long_return /= (cpu->total_ticks - cpu->history[0].total_hist); -+ if (cpu->total_ticks > cpu->history[0].total_hist) /* avoid div. by 0 */ -+ long_return /= (cpu->total_ticks - cpu->history[0].total_hist); -+ else -+ long_return = 0; - long_return = 100 - long_return; - if (long_return < 0) - long_return = 0; diff --git a/net-snmp-5.5-dir-fix.patch b/net-snmp-5.5-dir-fix.patch new file mode 100644 index 0000000..b726c47 --- /dev/null +++ b/net-snmp-5.5-dir-fix.patch @@ -0,0 +1,14 @@ +Let net-snmp-create-v3-user save settings into /etc/ instead of /usr/ + +diff -up net-snmp-5.5/net-snmp-create-v3-user.in.orig net-snmp-5.5/net-snmp-create-v3-user.in +--- net-snmp-5.5/net-snmp-create-v3-user.in.orig 2008-07-22 16:33:25.000000000 +0200 ++++ net-snmp-5.5/net-snmp-create-v3-user.in 2009-09-29 16:30:36.000000000 +0200 +@@ -158,7 +158,7 @@ if test ! -d $outfile ; then + touch $outfile + fi + echo $line >> $outfile +-outfile="@datadir@/snmp/snmpd.conf" ++outfile="/etc/snmp/snmpd.conf" + line="$token $user" + echo "adding the following line to $outfile:" + echo " " $line diff --git a/net-snmp-5.5-multilib.patch b/net-snmp-5.5-multilib.patch new file mode 100644 index 0000000..dd46e9d --- /dev/null +++ b/net-snmp-5.5-multilib.patch @@ -0,0 +1,47 @@ +Make the man pages multilib safe. + +diff -up net-snmp-5.5/man/config_api.3.def.orig net-snmp-5.5/man/config_api.3.def +--- net-snmp-5.5/man/config_api.3.def.orig 2009-04-21 11:36:52.000000000 +0200 ++++ net-snmp-5.5/man/config_api.3.def 2009-09-29 11:45:44.000000000 +0200 +@@ -256,7 +256,7 @@ machines and the second file can be used + for one particular machine. + .PP + The default list of directories to search is +-SYSCONFDIR/snmp, followed by DATADIR/snmp, followed by LIBDIR/snmp, ++SYSCONFDIR/snmp, followed by DATADIR/snmp, followed by /usr/lib(64)/snmp, + followed by $HOME/.snmp. + This list can be changed by setting the environmental variable + .I SNMPCONFPATH +@@ -326,7 +326,7 @@ function that it should abort the operat + SNMPCONFPATH + A colon separated list of directories to search for configuration + files in. +-Default: SYSCONFDIR/snmp:DATADIR/snmp:LIBDIR/snmp:$HOME/.snmp ++Default: SYSCONFDIR/snmp:DATADIR/snmp:/usr/lib(64)/snmp:$HOME/.snmp + .SH "SEE ALSO" + .BR mib_api "(3), " snmp_api (3) + .\" Local Variables: +diff -up net-snmp-5.5/man/snmp_config.5.def.orig net-snmp-5.5/man/snmp_config.5.def +--- net-snmp-5.5/man/snmp_config.5.def.orig 2007-06-18 23:17:15.000000000 +0200 ++++ net-snmp-5.5/man/snmp_config.5.def 2009-09-29 11:45:22.000000000 +0200 +@@ -11,7 +11,7 @@ First off, there are numerous places tha + found and read from. By default, the applications look for + configuration files in the following 4 directories, in order: + SYSCONFDIR/snmp, +-DATADIR/snmp, LIBDIR/snmp, and $HOME/.snmp. In each of these ++DATADIR/snmp, /usr/lib(64)/snmp, and $HOME/.snmp. In each of these + directories, it looks for files with the extension of both + .IR conf " and " local.conf + (reading the second ones last). In this manner, there are +diff -up net-snmp-5.5/man/snmpd.conf.5.def.orig net-snmp-5.5/man/snmpd.conf.5.def +--- net-snmp-5.5/man/snmpd.conf.5.def.orig 2009-06-01 17:53:30.000000000 +0200 ++++ net-snmp-5.5/man/snmpd.conf.5.def 2009-09-29 11:44:59.000000000 +0200 +@@ -1272,7 +1272,7 @@ filename), and call the initialisation r + .RS + .IP "Note:" + If the specified PATH is not a fully qualified filename, it will +-be interpreted relative to LIBDIR/snmp/dlmod, and \fC.so\fR ++be interpreted relative to /usr/lib(64)/snmp/dlmod, and \fC.so\fR + will be appended to the filename. + .RE + .PP diff --git a/net-snmp-5.5-sensors3.patch b/net-snmp-5.5-sensors3.patch new file mode 100644 index 0000000..db10381 --- /dev/null +++ b/net-snmp-5.5-sensors3.patch @@ -0,0 +1,14 @@ +Compile with lm_sensors3. + +diff -up net-snmp-5.5/agent/mibgroup/hardware/sensors.h.orig net-snmp-5.5/agent/mibgroup/hardware/sensors.h +--- net-snmp-5.5/agent/mibgroup/hardware/sensors.h.orig 2009-04-24 00:53:26.000000000 +0200 ++++ net-snmp-5.5/agent/mibgroup/hardware/sensors.h 2009-09-29 12:00:18.000000000 +0200 +@@ -7,7 +7,7 @@ config_require(hardware/sensors/picld_se + config_require(hardware/sensors/kstat_sensors) + # endif + #else +-config_require(hardware/sensors/lmsensors_v2) ++config_require(hardware/sensors/lmsensors_v3) + #endif + + /* config_require(hardware/sensors/dummy_sensors) */ diff --git a/net-snmp.spec b/net-snmp.spec index 530585b..a57729f 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -3,12 +3,12 @@ # Arches on which we need to prevent arch conflicts on net-snmp-config.h %define multilib_arches %{ix86} ia64 ppc ppc64 s390 s390x x86_64 sparc sparcv9 sparc64 -%define major_ver 5.4.2.1 +%define major_ver 5.5 Summary: A collection of SNMP protocol tools and libraries Name: net-snmp Version: %{major_ver} -Release: 17%{?dist} +Release: 1%{?dist} Epoch: 1 License: BSD and MIT @@ -25,16 +25,9 @@ Source7: net-snmp-config Source8: net-snmp-trapd.redhat.conf Source9: net-snmpd.sysconfig Patch1: net-snmp-5.4.1-pie.patch -Patch2: net-snmp-5.1.2-dir-fix.patch -Patch3: net-snmp-5.2.1-file_offset.patch -Patch4: net-snmp-5.3.1-multilib.patch -Patch5: net-snmp-5.4.1-config_libdir.patch -Patch6: net-snmp-5.4.1-strange_libpath.patch -Patch7: net-snmp-5.4.1-shared-ip.patch -Patch8: net-snmp-5.4.1-sensors3.patch -Patch9: net-snmp-5.4.1-xen-crash.patch -Patch10: net-snmp-5.4.1-libwrap.patch -Patch11: net-snmp-5.4.2.1-proc-div0.patch +Patch2: net-snmp-5.5-dir-fix.patch +Patch3: net-snmp-5.5-multilib.patch +Patch4: net-snmp-5.5-sensors3.patch Requires(pre): chkconfig Requires(post): chkconfig @@ -166,15 +159,8 @@ Net-SNMP toolkit library. %endif %patch2 -p1 -b .dir-fix -%patch3 -p1 -b .file_offset -%patch4 -p1 -b .multilib -%patch5 -p1 -b .libdir -%patch6 -p1 -b .libpath -%patch7 -p1 -b .shared-ip -%patch8 -p1 -b .sensors -%patch9 -p1 -b .xen-crash -%patch10 -p1 -b .libwrap -%patch11 -p1 -b .proc-div0 +%patch3 -p1 -b .multilib +%patch4 -p1 -b .sensors # Do this patch with a perl hack... perl -pi -e "s|'\\\$install_libdir'|'%{_libdir}'|" ltmain.sh @@ -194,7 +180,7 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib" %endif %configure \ - --enable-static --enable-shared \ + --disable-static --enable-shared \ --with-cflags="$RPM_OPT_FLAGS -D_RPM_4_4_COMPAT" \ %ifnarch s390 s390x --with-ldflags="$LDFLAGS -lcrypto -lsensors" \ @@ -206,7 +192,7 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib" --with-persistent-directory="/var/lib/net-snmp" \ --with-mib-modules="$MIBS" \ %if %{tcp_wrappers} - --with-libwrap=%{_libdir} \ + --with-libwrap=yes \ %endif --sysconfdir=%{_sysconfdir} \ --enable-ipv6 \ @@ -219,9 +205,8 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib" --with-sys-contact="root@localhost" < 5.5-1 +- update to Net-SNMP 5.5 +- remove static libraries from -devel subpackage + * Mon Sep 14 2009 Jan Safranek 1:5.4.2.1-17 - implement force-reload command in initscripts (#523126) diff --git a/sources b/sources index 1489520..17cf2e2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -984932520143f0c8bf7b7ce1fc9e1da1 net-snmp-5.4.2.1.tar.gz +5b2551e7bd024fbbee84dca22a5f13a1 net-snmp-5.5.tar.gz