diff options
author | Bertrand Jacquin <beber@meleeweb.net> | 2011-07-26 20:39:05 +0200 |
---|---|---|
committer | Bertrand Jacquin <beber@meleeweb.net> | 2011-07-26 20:39:05 +0200 |
commit | 643bcc4fcefe8c12468a35b04681c4297b4ba2b4 (patch) | |
tree | 0a13ff2adfa10a4b8ddd49ea6f7da10dd370d50c /net-analyzer | |
parent | dev-libs/openssl merge to vanilla (diff) | |
download | portage-643bcc4fcefe8c12468a35b04681c4297b4ba2b4.tar.xz |
net-analyser/net-snmp-5.4.2.1-r4: eprefixy
Diffstat (limited to 'net-analyzer')
-rw-r--r-- | net-analyzer/net-snmp/Manifest | 14 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/CVE-2008-6123.patch | 19 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/net-snmp-5.1.2-snmpconf-selinux.patch | 12 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/net-snmp-5.4.1-sensors3-version_detect.patch | 56 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/net-snmp-5.4.1-sensors3.patch | 1314 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/net-snmp-5.4.2.1-BJA-cross-net-snmp-config.diff | 11 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/net-snmp-5.4.2.1-perlcc-hppa.patch | 12 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/snmpd.init | 47 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/snmptrapd.init | 24 | ||||
-rw-r--r-- | net-analyzer/net-snmp/net-snmp-5.4.1-r1.ebuild | 202 | ||||
-rw-r--r-- | net-analyzer/net-snmp/net-snmp-5.4.2.1-r4.ebuild (renamed from net-analyzer/net-snmp/net-snmp-5.4.1.1.ebuild) | 182 |
11 files changed, 1605 insertions, 288 deletions
diff --git a/net-analyzer/net-snmp/Manifest b/net-analyzer/net-snmp/Manifest index ce39b9b4..ad45292f 100644 --- a/net-analyzer/net-snmp/Manifest +++ b/net-analyzer/net-snmp/Manifest @@ -1,4 +1,6 @@ +AUX CVE-2008-6123.patch 867 RMD160 1e8b6521ae0955681493c1ba594eb0344183e147 SHA1 3742c405fab9ac829acc93383bc39ba5b39962e9 SHA256 31a9b72b252582cd84e7f673b670ebbd2153dc719894aa668a48b24d6ba516f6 AUX multi-tun-segv.patch 7231 RMD160 d02666572b7691d9e279f2586820992b8394a2ef SHA1 c250eebb22385be994d9e7b67fbb67a0dec295ce SHA256 929cc61484fbf69134273acc3416f2644251d9a490850c901d8746b1d2f7c47a +AUX net-snmp-5.1.2-snmpconf-selinux.patch 286 RMD160 c78fd9d2a563ebafd21aa85a582b989a805eb645 SHA1 159990e855cfeb50ac3657d1b97eda181d4ffb9e SHA256 70b4bdaa243efd5ae5703b3272063314fc56b6e2333f7c650b635ddab141f874 AUX net-snmp-5.2.1-conf-elf-rpm-bz2.patch 4734 RMD160 904d195cafa4334f9d8116a3d13eff4181e06d3b SHA1 0101a446e217a95f621e634544b19490fa01c072 SHA256 893180ba84ef69381d270286f042852a200c35b7792f55fe23920a0bcb1d8fb9 AUX net-snmp-5.2.1-fix-64bit-interface-counters.diff 1195 RMD160 c11898fcfe7964f2263c64a164b5010741be3e8b SHA1 670a0d4c5de33d79fc026cb4190f8c7f55ac9d10 SHA256 0304fe236b335eab2a42c9009e66310c03c82b9ead9886d6f558fc245f83581c AUX net-snmp-5.2.1-fix-insecure-fixproc.diff 1639 RMD160 05b1099c32c2091e9606f167288a21503510cc20 SHA1 278b48283e536bc76935865ec227c402019e7df6 SHA256 100f18794f11c0d0fe43e9f50cec755158906268b4c2b560f45f8d7ff797422e @@ -14,16 +16,20 @@ AUX net-snmp-5.4.1-incorrect-hrFSStorageIndex.patch 16053 RMD160 1d33a23b165946f AUX net-snmp-5.4.1-ipAddressTable-crash-with-double-free.patch 4740 RMD160 305f962976c6afc39b0ee37706f34d05ea768874 SHA1 93b806c407048cba4f5c63137df1e819c83d0010 SHA256 0872a11f48106f1a2a9c4a8a894abe31b04ee607bdfd44b8207c8e659213ef31 AUX net-snmp-5.4.1-perl-asneeded.patch 1219 RMD160 caced600c35165603069e62a17a664d7a0180586 SHA1 89bedb2424d65176a9bfba8c9b318b1d50b5b3ed SHA256 42640b545363cd5c6c7eef6b17b10c1d256e189ceb7b7c874baa4041de24e151 AUX net-snmp-5.4.1-process-count-race.patch 1489 RMD160 221f218270b83afec95d1efd260109b8baf05626 SHA1 3986f4789c145dd7182bf5f7d94a1cda0504ce5c SHA256 74a6e001de7a855079be988dd0cb23190095082e1a9adaefb9a9cac677ffa116 +AUX net-snmp-5.4.1-sensors3-version_detect.patch 1391 RMD160 eba5c1cba2fc5d0484143eb4b41f656f5f72bee4 SHA1 8c8ebcc9e4725e91cc7b07cdd45cbcf6e2ed806e SHA256 e18f7bd358c4f587793f9e9250489200d2708b50529dfe222f04b71617fa1e59 +AUX net-snmp-5.4.1-sensors3.patch 48401 RMD160 9899c587eb252cf9edac758133a420ef0307c315 SHA1 cd5adc2fab5c1d58c8a318d34aa3fcd4fd25c455 SHA256 e74e06a5f23350a2851fdc9f419335767d898ec66dd809e1c0413e39034d6f53 AUX net-snmp-5.4.1-suppresssuppress-annoying.patch 800 RMD160 aa23a30241ae64aeed6a08a630326fd7c2e0f9fe SHA1 2b99c56d1f659f324c5676d48ab257ea3b55467f SHA256 f5249b782079be96256ab6e7a0d398c04dfbcabffa7f4c716fe1abd39897aabe +AUX net-snmp-5.4.2.1-BJA-cross-net-snmp-config.diff 265 RMD160 c4bc4d420087b06d3de8549f60d656600b65c6b6 SHA1 27854b0c0f3df8704708e5467a17a6ade5634743 SHA256 3350f601dfc5a005f528e51cc24e9db7d68999ccf5a004991594e95bec0b2811 +AUX net-snmp-5.4.2.1-perlcc-hppa.patch 644 RMD160 4200893069839a8168dc706c1d940a029e975f02 SHA1 118157050c5c0cfbdb5aeb08dc3f5f020c0ccd5e SHA256 54f3fdd3b62ee8ceca1bd61c4db4bca075619afc958d04ded6178380785a2fec AUX net-snmp-lm_sensors.patch 13686 RMD160 b2e67c6f5a5347442fbaa97c9ce209f1d9bed194 SHA1 3e795339fc93306a4d662feeaa16faca2509a058 SHA256 51dc2363a687d9f4e65b0a59e767b33129d07623a0b4da07b685e406d2576b86 AUX net-snmp-maxreps.patch 5495 RMD160 a1a958f292f780f5c4f8ec66a4ec350f261d3214 SHA1 2ed58bb7c1136452532909154a1cb2c2f322467d SHA256 5e37133da687d84cb06eea7899e1be23d9613be1d24f43e8e8555577f3d47da7 AUX snmpd-5.1.conf 606 RMD160 a243da5c9dfde4a5cfb16bd7d4491cedb7879620 SHA1 5c7c45a434cb566cfec678050384f9ab6af912a9 SHA256 f569766eb6ca203a0c9549b2592d6f36ae4999cfaabc423cad5a864201a86ac9 AUX snmpd-5.1.rc6 714 RMD160 1f7cef43888500044be0b0d4938574922b48bcfd SHA1 7468069b6e12b527f5a6a8026b67125f3545d243 SHA256 8f02a26a794a5c37e4cb4092ab61f82a6d7ec5876146738d4630ed147cc9ccf6 AUX snmpd.conf 598 RMD160 c72a20fe6d4682ceea533587762782d62906b630 SHA1 51ebdca93c68ca04b7f402fad4f504422ec2c6cf SHA256 1f4f07b831c3227588fd546423137ed5c60a602fbee13b0d66edd801e4e7d598 +AUX snmpd.init 1054 RMD160 6cc814d19524e1899b4bb9539ee9752304451bc9 SHA1 ed2b1a4bd7da84ca6294c0df66cace2e7c0ffe72 SHA256 824ae327db4d76fe4cdc882f06ac989e510ee1ee96c90137ab84bc18446ba8b6 AUX snmpd.rc7 706 RMD160 137d85e5f2b7cae62e214141aabcec495777007e SHA1 8d94d3bb2d3b43e20604030dc585c735685cf99b SHA256 93337ebeac92ec0073c896db0a4384beebf84ee17365bdc2594285fd33ac7dfe AUX snmptrapd.conf 635 RMD160 aba7b7196835bd359174156a527e13188f76e248 SHA1 0d296caa01c789455c3cd4c67cd81aca5547681d SHA256 902d73cb44446df060bf20e0c8ef0f8815d5b846f96d93894913d3309a3841b3 +AUX snmptrapd.init 624 RMD160 799faf488a62bc219d3765ed6d6283ca7764ad1c SHA1 1fdef5a0a29f181c2df31b9d7adc4d4ebb8b018c SHA256 0e6dae4ca0213be9f9311c8dacdf36e7fea05150db48d15660506d53abda5a39 AUX snmptrapd.rc7 557 RMD160 e67117fbcb0a6f8668cb1abbc8fcfcb548ebfdb5 SHA1 dcaac6c0f9e086e49f653f100e0c3f9a7f65db1d SHA256 3594345cdf3c9a5a04073ec11a54e4a19881b27288cdbf22874cca5d0a0f624c -DIST net-snmp-5.4.1.1.tar.gz 5123861 RMD160 870b6a3e4eb28df3cbdf0df34d23f46bd7de8961 SHA1 cfeef748f242a7b25ad8eea95977ff277984e368 SHA256 b22ecb5e7f0907c20cc7fc9f1e1f31b1b4b2dd81abdc3e2e0bfddf8d060008a2 -DIST net-snmp-5.4.1.tar.gz 5122455 RMD160 3723488dab8d164702a7d55c9c72eeaec07dd50c SHA1 ac5ba033c10d53d3057415121f8c4936c643c208 SHA256 0ea976722c993c87dede8eb6348e6feb059e3851bbef2de824bf18ac97cdb565 -EBUILD net-snmp-5.4.1-r1.ebuild 5715 RMD160 e4c073bcbcea5977fbd9789498ce956851cb50b6 SHA1 44c350833b0dd7d0ec586f40dfd46fb930a4f2da SHA256 687b4c47bf4e5e37fa284e7a1aa9f3cf7a057b61e152098aa39bd9a348a273e5 -EBUILD net-snmp-5.4.1.1.ebuild 6164 RMD160 c0c218a3b71babd4c1e0ff6699676a2ce9c3a181 SHA1 cb669a98b8ca529aff0e60240514e9bfd2f96db6 SHA256 59bf4e572d20dabd303390945231a41f7184bf1c52cec26965c891d56c1c64d1 +DIST net-snmp-5.4.2.1.tar.gz 5185390 RMD160 2148c42d486ed88f9cfc3ca1d50c68abcd7e3d63 SHA1 4f2df9ea62344fe840f493d0e08abe5de3697862 SHA256 11a8baf167f7bfff60d2590e050991400a3a082923dbcdbf85e0e0ce46eb247c +EBUILD net-snmp-5.4.2.1-r4.ebuild 6024 RMD160 c1bd78186aec9add484d3869ed840d3e9ddc6bc7 SHA1 7745b88dbb8faa555d8ff57fef81fb806a089b3b SHA256 a00279ab6a940bd7765299db14b2db5f302412d7229d1ea305379a21ccf5aa43 diff --git a/net-analyzer/net-snmp/files/CVE-2008-6123.patch b/net-analyzer/net-snmp/files/CVE-2008-6123.patch new file mode 100644 index 00000000..b4b06f63 --- /dev/null +++ b/net-analyzer/net-snmp/files/CVE-2008-6123.patch @@ -0,0 +1,19 @@ +diff -Naur snmplib.orig/snmpUDPDomain.c snmplib/snmpUDPDomain.c +--- snmplib.orig/snmpUDPDomain.c 2007-10-11 22:46:30.000000000 +0200 ++++ snmplib/snmpUDPDomain.c 2009-07-10 23:41:37.000000000 +0200 +@@ -104,12 +110,12 @@ + 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", ++ 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-analyzer/net-snmp/files/net-snmp-5.1.2-snmpconf-selinux.patch b/net-analyzer/net-snmp/files/net-snmp-5.1.2-snmpconf-selinux.patch new file mode 100644 index 00000000..9171b693 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.1.2-snmpconf-selinux.patch @@ -0,0 +1,12 @@ +https://bugzilla.redhat.com/show_bug.cgi?id=248329 + +--- net-snmp-5.1.2/local/snmpconf.orig 2004-04-20 16:20:51.000000000 +0200 ++++ net-snmp-5.1.2/local/snmpconf 2007-07-09 15:34:48.000000000 +0200 +@@ -585,6 +585,7 @@ + } + } + close(O); ++ system("restorecon $outputf"); + } + } + diff --git a/net-analyzer/net-snmp/files/net-snmp-5.4.1-sensors3-version_detect.patch b/net-analyzer/net-snmp/files/net-snmp-5.4.1-sensors3-version_detect.patch new file mode 100644 index 00000000..9159dd03 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.4.1-sensors3-version_detect.patch @@ -0,0 +1,56 @@ +From: Gordon Malm <gengor@gentoo.org> + +Detect lm_sensors version and build accordingly. + +--- a/agent/mibgroup/hardware/sensors.h ++++ b/agent/mibgroup/hardware/sensors.h +@@ -1,13 +1,21 @@ + 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 ++ ++# if defined(HAVE_LMSENSORS_V2) ++config_require(hardware/sensors/lmsensors_v2) ++# else + config_require(hardware/sensors/lmsensors_v3) ++# endif ++ + #endif + + //config_require(hardware/sensors/dummy_sensors) +--- a/configure.in ++++ b/configure.in +@@ -1909,6 +1909,25 @@ done + + AC_MSG_RESULT([$new_module_list.]) + ++echo " $new_module_list " | $GREP "ucd-snmp/lmsensorsMib" > /dev/null ++if test $? -eq 0 ; then ++ case $target_os in ++ linux*) ++ AC_CHECK_HEADER(sensors/sensors.h,,[AC_MSG_ERROR([asked to use lm_sensors but I couldn't find sensors/sensors.h])]) ++ ++ AC_MSG_CHECKING([lm_sensors version]) ++ AC_EGREP_CPP(lmsensors_v2,[ ++#include <sensors/sensors.h> ++#if SENSORS_API_VERSION < 0x400 ++lmsensors_v2 ++#endif ++ ], [AC_DEFINE([HAVE_LMSENSORS_V2], [1], [Define if lm_sensors version 2.x])] ++ have_lmsensors_ver="2.x", have_lmsensors_ver="3.x or higher") ++ AC_MSG_RESULT([$have_lmsensors_ver]) ++ ;; ++ esac ++fi ++ + #--------------------- + # loop over module list + # diff --git a/net-analyzer/net-snmp/files/net-snmp-5.4.1-sensors3.patch b/net-analyzer/net-snmp/files/net-snmp-5.4.1-sensors3.patch new file mode 100644 index 00000000..8e4b09ba --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.4.1-sensors3.patch @@ -0,0 +1,1314 @@ +Source: http://cvs.fedoraproject.org/viewvc/devel/net-snmp/net-snmp-5.4.1-sensors3.patch + +--- + +351991: Port net-snmp to lm_sensors-3.x.x +Source: upstream, svn diff -r 16736:16739 +Reviewed-By: Jan Safranek <jsafrane@redhat.com> + +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 <net-snmp/net-snmp-config.h> ++#include <net-snmp/net-snmp-includes.h> ++#include <net-snmp/agent/net-snmp-agent-includes.h> ++#include <net-snmp/agent/hardware/sensors.h> ++ ++ ++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 <net-snmp/net-snmp-config.h> ++#include <net-snmp/net-snmp-includes.h> ++#include <net-snmp/agent/net-snmp-agent-includes.h> ++#include <net-snmp/agent/hardware/sensors.h> ++ ++ ++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 <net-snmp/net-snmp-config.h> ++#include <net-snmp/net-snmp-includes.h> ++#include <net-snmp/agent/net-snmp-agent-includes.h> ++#include <net-snmp/agent/hardware/sensors.h> ++ ++#include "util_funcs.h" ++#include <time.h> ++ ++#include <kstat.h> ++#include </usr/platform/sun4u/include/sys/envctrl.h> ++ ++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; i<kp->ks_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; i<kp->ks_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; i<kp->ks_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 <net-snmp/net-snmp-config.h> ++#include <net-snmp/net-snmp-includes.h> ++#include <net-snmp/agent/net-snmp-agent-includes.h> ++#include <net-snmp/agent/hardware/sensors.h> ++ ++#include "util_funcs.h" ++#include <time.h> ++#include <sensors/sensors.h> ++ ++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 <net-snmp/net-snmp-config.h> ++#include <net-snmp/net-snmp-includes.h> ++#include <net-snmp/agent/net-snmp-agent-includes.h> ++#include <net-snmp/agent/hardware/sensors.h> ++ ++#include "util_funcs.h" ++#include <time.h> ++#include <sensors/sensors.h> ++ ++ ++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 <net-snmp/net-snmp-config.h> ++#include <net-snmp/net-snmp-includes.h> ++#include <net-snmp/agent/net-snmp-agent-includes.h> ++#include <net-snmp/agent/hardware/sensors.h> ++ ++#include "util_funcs.h" ++#include <time.h> ++ ++#include <picl.h> ++#include </usr/platform/sun4u/include/sys/envctrl.h> ++ ++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 <net-snmp/net-snmp-config.h> ++#include <net-snmp/net-snmp-includes.h> ++#include <net-snmp/agent/net-snmp-agent-includes.h> ++#include <net-snmp/agent/hardware/sensors.h> ++#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-analyzer/net-snmp/files/net-snmp-5.4.2.1-BJA-cross-net-snmp-config.diff b/net-analyzer/net-snmp/files/net-snmp-5.4.2.1-BJA-cross-net-snmp-config.diff new file mode 100644 index 00000000..6cf86e07 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.4.2.1-BJA-cross-net-snmp-config.diff @@ -0,0 +1,11 @@ +--- net-snmp-config.in.ori 2011-05-31 23:38:58.918259036 +0200 ++++ net-snmp-config.in 2011-05-31 23:40:34.627769905 +0200 +@@ -27,7 +27,7 @@ + fi + } + +-prefix=@prefix@ ++prefix=${ROOT}@prefix@ + exec_prefix=@exec_prefix@ + includedir=@includedir@ + libdir=@libdir@ diff --git a/net-analyzer/net-snmp/files/net-snmp-5.4.2.1-perlcc-hppa.patch b/net-analyzer/net-snmp/files/net-snmp-5.4.2.1-perlcc-hppa.patch new file mode 100644 index 00000000..40a0d1bb --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.4.2.1-perlcc-hppa.patch @@ -0,0 +1,12 @@ +diff -uNr net-snmp-5.4.2.1.orig/configure.in net-snmp-5.4.2.1/configure.in +--- net-snmp-5.4.2.1.orig/configure.in 2010-07-29 12:05:12.619347954 +0200 ++++ net-snmp-5.4.2.1/configure.in 2010-07-29 12:05:38.358857068 +0200 +@@ -2986,7 +2986,7 @@ + if test "xenable_perl_cc_checks" != "xno" ; then + AC_MSG_CHECKING([for Perl cc]) + changequote(, ) +- PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/]+).;\s*/$1/);'` ++ PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/\.]+).;\s*/$1/);'` + changequote([, ]) + if test "x$PERLCC" != "x" ; then + AC_MSG_RESULT([$PERLCC]) diff --git a/net-analyzer/net-snmp/files/snmpd.init b/net-analyzer/net-snmp/files/snmpd.init new file mode 100644 index 00000000..d8419eaa --- /dev/null +++ b/net-analyzer/net-snmp/files/snmpd.init @@ -0,0 +1,47 @@ +#!/sbin/runscript +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmpd.init,v 1.1 2009/10/16 08:51:05 gengor Exp $ + +opts="${opts} reload" + +depend() { + use logger + need net +} + +SNMPD_PIDFILE="${SNMPD_PIDFILE:-/var/run/snmpd.pid}" + +checkconfig() { + if [ ! -e /etc/snmp/snmpd.conf ] ; then + eerror "${SVCNAME} requires an /etc/snmp/snmpd.conf configuration file" + return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --quiet --exec /usr/sbin/snmpd \ + -- -p ${SNMPD_PIDFILE} ${SNMPD_FLAGS} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --quiet --pidfile ${SNMPD_PIDFILE} + eend $? +} + +reload() { + checkconfig || return 1 + if [ ! -f ${SNMPD_PIDFILE} ]; then + eerror "Cannot reload configuration, ${SVCNAME} is not running" + eend 1 + return 1 + fi + + ebegin "Reloading ${SVCNAME} configuration" + kill -HUP $(< ${SNMPD_PIDFILE}) &>/dev/null + eend $? +} diff --git a/net-analyzer/net-snmp/files/snmptrapd.init b/net-analyzer/net-snmp/files/snmptrapd.init new file mode 100644 index 00000000..7a311f95 --- /dev/null +++ b/net-analyzer/net-snmp/files/snmptrapd.init @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/files/snmptrapd.init,v 1.1 2009/10/16 08:51:05 gengor Exp $ + +depend() { + use logger + need net +} + +SNMPTRAPD_PIDFILE="${SNMPTRAPD_PIDFILE:-/var/run/snmptrapd.pid}" + +start() { + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --quiet --exec /usr/sbin/snmptrapd \ + -- -p ${SNMPTRAPD_PIDFILE} ${SNMPTRAPD_FLAGS} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --quiet --pidfile ${SNMPTRAPD_PIDFILE} + eend $? +} diff --git a/net-analyzer/net-snmp/net-snmp-5.4.1-r1.ebuild b/net-analyzer/net-snmp/net-snmp-5.4.1-r1.ebuild deleted file mode 100644 index 8b190b40..00000000 --- a/net-analyzer/net-snmp/net-snmp-5.4.1-r1.ebuild +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright 1999-2007 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/net-snmp-5.4.1-r1.ebuild,v 1.9 2007/11/19 06:16:52 kumba Exp $ - -inherit fixheadtails flag-o-matic perl-module python - -DESCRIPTION="Software for generating and retrieving SNMP data" -HOMEPAGE="http://net-snmp.sourceforge.net/" -SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" - -LICENSE="as-is BSD" -SLOT="0" -KEYWORDS="alpha amd64 ~arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86" -IUSE="diskio doc elf ipv6 lm_sensors mfd-rewrites minimal perl python rpm selinux smux ssl tcpd X sendmail" - -DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d ) - tcpd? ( >=sys-apps/tcp-wrappers-7.6 ) - rpm? ( - app-arch/rpm - dev-libs/popt - app-arch/bzip2 - >=sys-libs/zlib-1.1.4 - ) - elf? ( dev-libs/elfutils ) - lm_sensors? ( sys-apps/lm_sensors ) - python? ( dev-python/setuptools )" - -RDEPEND="${DEPEND} - perl? ( - X? ( dev-perl/perl-tk ) - !minimal? ( dev-perl/TermReadKey ) - ) - selinux? ( sec-policy/selinux-snmpd )" - -DEPEND="${DEPEND} - >=sys-apps/sed-4 - doc? ( app-doc/doxygen )" - -src_unpack() { - unpack ${A} - cd "${S}" - -# The lm_sensors patch has a memory leak -# If you can help, please attach a patch to bug 109785 - -# if use lm_sensors; then -# if use x86 || use amd64; then -# epatch "${FILESDIR}"/${PN}-lm_sensors.patch -# else -# eerror "Unfortunatly you are trying to enable lm_sensors support for an unsupported arch." -# eerror "please check the availability of sys-apps/lm_sensors - if it is available on" -# eerror "your arch, please file a bug about this." -# die "lm_sensors patch error: unsupported arch." -# fi -# fi - - # fix access violation in make check - sed -i -e 's/\(snmpd.*\)-Lf/\1-l/' testing/eval_tools.sh || \ - die "sed eval_tools.sh failed" - # fix path in fixproc - sed -i -e 's|\(database_file =.*\)/local\(.*\)$|\1\2|' local/fixproc || \ - die "sed fixproc failed" - - if use python ; then - python_version - PYTHON_MODNAME="netsnmp" - PYTHON_DIR=/usr/$(get_libdir)/python${PYVER}/site-packages - sed -i -e "s:\(install --basedir=\$\$dir\):\1 --root='${D}':" Makefile.in || die "sed python failed" - fi - - # Fix usage of clientaddr - EPATCH_OPTS="-p1" epatch "${FILESDIR}"/${PN}-5.4.1-clientaddr-fix.patch - - epatch "${FILESDIR}/multi-tun-segv.patch" - - ht_fix_all -} - -src_compile() { - local mibs - - strip-flags - - # filter for bug #145960 - # as it seems that the option is not enough - filter-ldflags -Wl,--as-needed - - mibs="host ucd-snmp/dlmod" - use smux && mibs="${mibs} smux" - use sendmail && mibs="${mibs} mibII/mta_sendmail" - use lm_sensors && mibs="${mibs} ucd-snmp/lmSensors" - use diskio && mibs="${mibs} ucd-snmp/diskio" - - econf \ - --with-install-prefix="${D}" \ - --with-sys-location="Unknown" \ - --with-sys-contact="root@Unknown" \ - --with-default-snmp-version="3" \ - --with-mib-modules="${mibs}" \ - --with-logfile="/var/log/net-snmpd.log" \ - --with-persistent-directory="/var/lib/net-snmp" \ - --enable-ucd-snmp-compatibility \ - --enable-shared \ - --enable-as-needed \ - $(use_enable mfd-rewrites) \ - $(use_enable perl embedded-perl) \ - $(use_enable ipv6) \ - $(use_enable !ssl internal-md5) \ - $(use_with ssl openssl) \ - $(use_with tcpd libwrap) \ - $(use_with rpm) \ - $(use_with rpm bzip2) \ - $(use_with rpm zlib) \ - $(use_with elf) \ - $(use_with python python-modules) \ - || die "econf failed" - - emake -j1 || die "emake failed" - - if use perl ; then - emake perlmodules || die "compile perl modules problem" - fi - - if use python ; then - emake pythonmodules || die "compile python modules problem" - fi - - if use doc ; then - einfo "Building HTML Documentation" - make docsdox || die "failed to build docs" - fi -} - -src_test() { - cd testing - if ! make test ; then - echo - einfo "Don't be alarmed if a few tests FAIL." - einfo "This could happen for several reasons:" - einfo " - You don't already have a working configuration." - einfo " - Your ethernet interface isn't properly configured." - echo - fi -} - -src_install () { - - make DESTDIR="${D}" install || die "make install failed" - - if use perl ; then - make DESTDIR="${D}" perlinstall || die "make perlinstall failed" - fixlocalpod - - use X || rm -f "${D}/usr/bin/tkmib" - else - rm -f "${D}/usr/bin/mib2c" "${D}/usr/bin/tkmib" "${D}/usr/bin/snmpcheck" - fi - - if use python ; then - mkdir -p "${D}/${PYTHON_DIR}" || die "Couldn't make $PYTHON_DIR" - make pythoninstall || die "make pythoninstall failed" - fi - - dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO - newdoc EXAMPLE.conf.def EXAMPLE.conf - - use doc && dohtml docs/html/* - - keepdir /etc/snmp /var/lib/net-snmp - - newinitd "${FILESDIR}"/snmpd.rc7 snmpd - newconfd "${FILESDIR}"/snmpd.conf snmpd - - newinitd "${FILESDIR}"/snmptrapd.rc7 snmptrapd - newconfd "${FILESDIR}"/snmptrapd.conf snmptrapd - - # Remove everything, keeping only the snmpd, snmptrapd, MIBs, libs, and includes. - if use minimal; then - elog "USE=minimal is set. Cleaning up excess cruft for a embedded/minimal/server only install." - rm -rf - "${D}"/usr/bin/{encode_keychange,snmp{get,getnext,set,usm,walk,bulkwalk,table,trap,bulkget,translate,status,delta,test,df,vacm,netstat,inform,snmpcheck}} - rm -rf "${D}"/usr/share/snmp/snmpconf-data "${D}"/usr/share/snmp/*.conf - rm -rf "${D}"/usr/bin/{fixproc,traptoemail} "${D}"/usr/bin/snmpc{heck,onf} - find "${D}" -name '*.pl' -exec rm -f '{}' \; - use ipv6 || rm -rf "${D}"/usr/share/snmp/mibs/IPV6* - fi - - # bug 113788, install example config - insinto /etc/snmp - newins "${S}"/EXAMPLE.conf snmpd.conf.example -} - -pkg_postrm() { - if use python ; then - python_mod_cleanup - fi -} - -pkg_postinst() { - elog "An example configuration file has been installed in" - elog "/etc/snmp/snmpd.conf.example." -} diff --git a/net-analyzer/net-snmp/net-snmp-5.4.1.1.ebuild b/net-analyzer/net-snmp/net-snmp-5.4.2.1-r4.ebuild index 3731b193..24666681 100644 --- a/net-analyzer/net-snmp/net-snmp-5.4.1.1.ebuild +++ b/net-analyzer/net-snmp/net-snmp-5.4.2.1-r4.ebuild @@ -1,8 +1,11 @@ -# Copyright 1999-2008 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/net-snmp-5.4.1.1.ebuild,v 1.9 2008/06/23 18:59:58 ranger Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/net-snmp/net-snmp-5.4.2.1-r4.ebuild,v 1.13 2011/03/01 20:02:12 arfrever Exp $ -inherit fixheadtails flag-o-matic perl-module python autotools +EAPI="3" +PYTHON_DEPEND="python? 2" + +inherit fixheadtails flag-o-matic perl-module python autotools prefix DESCRIPTION="Software for generating and retrieving SNMP data" HOMEPAGE="http://net-snmp.sourceforge.net/" @@ -10,10 +13,10 @@ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" LICENSE="as-is BSD" SLOT="0" -KEYWORDS="alpha amd64 ~arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86" -IUSE="diskio doc elf ipv6 lm_sensors mfd-rewrites minimal perl python rpm selinux smux ssl tcpd X sendmail extensible" +KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86" +IUSE="bzip2 diskio doc elf extensible ipv6 kernel_linux lm_sensors mfd-rewrites minimal perl python rpm selinux sendmail smux ssl tcpd X zlib" -DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d ) +COMMON="ssl? ( >=dev-libs/openssl-0.9.6d ) tcpd? ( >=sys-apps/tcp-wrappers-7.6 ) rpm? ( app-arch/rpm @@ -21,11 +24,15 @@ DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d ) app-arch/bzip2 >=sys-libs/zlib-1.1.4 ) + bzip2? ( app-arch/bzip2 ) + zlib? ( >=sys-libs/zlib-1.1.4 ) elf? ( dev-libs/elfutils ) - lm_sensors? ( sys-apps/lm_sensors ) + lm_sensors? ( + kernel_linux? ( sys-apps/lm_sensors ) + ) python? ( dev-python/setuptools )" -RDEPEND="${DEPEND} +RDEPEND="${COMMON} perl? ( X? ( dev-perl/perl-tk ) !minimal? ( dev-perl/TermReadKey ) @@ -33,14 +40,27 @@ RDEPEND="${DEPEND} selinux? ( sec-policy/selinux-snmpd )" # Dependency on autoconf due to bug #225893 -DEPEND="${DEPEND} +DEPEND="${COMMON} >=sys-devel/autoconf-2.61-r2 >=sys-apps/sed-4 doc? ( app-doc/doxygen )" -src_unpack() { - unpack ${A} - cd "${S}" +pkg_setup() { + if use python; then + python_set_active_version 2 + python_pkg_setup + fi +} + +src_prepare() { + # Fix CVE-2008-6123 + epatch "${FILESDIR}"/CVE-2008-6123.patch + + # lm_sensors-3 support + if use lm_sensors ; then + epatch "${FILESDIR}"/${PN}-5.4.1-sensors3.patch \ + "${FILESDIR}"/${PN}-5.4.1-sensors3-version_detect.patch + fi # fix access violation in make check sed -i -e 's/\(snmpd.*\)-Lf/\1-l/' testing/eval_tools.sh || \ @@ -50,45 +70,62 @@ src_unpack() { die "sed fixproc failed" if use python ; then - python_version - PYTHON_MODNAME="netsnmp" - PYTHON_DIR=/usr/$(get_libdir)/python${PYVER}/site-packages - sed -i -e "s:\(install --basedir=\$\$dir\):\1 --root='${D}':" Makefile.in || die "sed python failed" + PYTHON_DIR="$(python_get_sitedir)" + sed -i -e "s:\(install --basedir=\$\$dir\):\1 --root='${D}':" Makefile.in || \ + die "sed python failed" fi - # snmpd crashes when snmpd.conf contains more than one "exec shelltest" line - epatch "${FILESDIR}"/${PN}-5.4-exec-crash.patch - # agent: suppress annoying "registration != duplicate" warning for root oids - epatch "${FILESDIR}"/${PN}-5.4.1-suppresssuppress-annoying.patch - # Crash when more then one interface have the same IP, bug 203127 - epatch "${FILESDIR}"/${PN}-5.4.1-ipAddressTable-crash-with-double-free.patch # snmpconf generates config files with proper selinux context use selinux && epatch "${FILESDIR}"/${PN}-5.1.2-snmpconf-selinux.patch - epatch "${FILESDIR}"/${PN}-5.4.1-clientaddr-fix.patch #180266 - epatch "${FILESDIR}"/${PN}-5.4.1-CVE-2008-2292.patch #222265 - epatch "${FILESDIR}"/${PN}-5.4.1-process-count-race.patch #213415 - epatch "${FILESDIR}"/${PN}-5.4.1-incorrect-hrFSStorageIndex.patch #211660 - epatch "${FILESDIR}"/${PN}-5.4.1-perl-asneeded.patch #224251 - # Fix version number to report 5.4.1.1: - sed -i -e 's:NetSnmpVersionInfo = "5.4.1":NetSnmpVersionInfo = "5.4.1.1":' snmplib/snmp_version.c + # remove CFLAGS from net-snmp-config script (bug #257622): + sed -i -e 's|@CFLAGS@||g' -e 's|@LDFLAGS@||g' \ + net-snmp-config.in || die "sedding CFLAGS/LDFLAGS failed" + + eprefixify net-snmp-config.in + + # Fix version number: + sed -i -e "s:NetSnmpVersionInfo = \".*\":NetSnmpVersionInfo = \"${PV}\":" \ + snmplib/snmp_version.c || die "sedding version failed" + + # Fix toolchain quadruplet detection, bug #330353 + epatch "${FILESDIR}/${P}-perlcc-hppa.patch" eautoreconf ht_fix_all } -src_compile() { - local mibs - +src_configure() { strip-flags - mibs="host ucd-snmp/dlmod" - use smux && mibs="${mibs} smux" - use sendmail && mibs="${mibs} mibII/mta_sendmail" - use lm_sensors && mibs="${mibs} ucd-snmp/lmSensors" + local mibs="host ucd-snmp/dlmod" use diskio && mibs="${mibs} ucd-snmp/diskio" use extensible && mibs="${mibs} ucd-snmp/extensible" + use lm_sensors && mibs="${mibs} ucd-snmp/lmsensorsMib" + use sendmail && mibs="${mibs} mibII/mta_sendmail" + use smux && mibs="${mibs} smux" + + local myconf="$(use_enable ipv6) \ + $(use_enable mfd-rewrites) \ + $(use_enable perl embedded-perl) \ + $(use_enable !ssl internal-md5) \ + $(use_with elf) \ + $(use_with perl perl-modules) \ + $(use_with python python-modules) \ + $(use_with ssl openssl) \ + $(use_with tcpd libwrap)" + if use rpm ; then + myconf="${myconf} \ + --with-rpm \ + --with-bzip2 \ + --with-zlib" + else + myconf="${myconf} \ + --without-rpm \ + $(use_with bzip2) \ + $(use_with zlib)" + fi econf \ --with-install-prefix="${D}" \ @@ -101,30 +138,12 @@ src_compile() { --enable-ucd-snmp-compatibility \ --enable-shared \ --enable-as-needed \ - --with-endianness=little \ - $(use_enable mfd-rewrites) \ - $(use_enable perl embedded-perl) \ - $(use_enable ipv6) \ - $(use_enable !ssl internal-md5) \ - $(use_with ssl openssl) \ - $(use_with tcpd libwrap) \ - $(use_with rpm) \ - $(use_with rpm bzip2) \ - $(use_with rpm zlib) \ - $(use_with elf) \ - $(use_with python python-modules) \ - || die "econf failed" + ${myconf} +} +src_compile() { emake -j1 || die "emake failed" - if use perl ; then - emake perlmodules || die "compile perl modules problem" - fi - - if use python ; then - emake pythonmodules || die "compile python modules problem" - fi - if use doc ; then einfo "Building HTML Documentation" make docsdox || die "failed to build docs" @@ -144,38 +163,33 @@ src_test() { } src_install () { - make DESTDIR="${D}" install || die "make install failed" + # bug #317965 + emake -j1 DESTDIR="${D}" install || die "make install failed" if use perl ; then - make DESTDIR="${D}" perlinstall || die "make perlinstall failed" fixlocalpod - - use X || rm -f "${D}/usr/bin/tkmib" + use X || rm -f "${D}"/usr/bin/tkmib else - rm -f "${D}/usr/bin/mib2c" "${D}/usr/bin/tkmib" "${D}/usr/bin/snmpcheck" - fi - - if use python ; then - mkdir -p "${D}/${PYTHON_DIR}" || die "Couldn't make $PYTHON_DIR" - make pythoninstall || die "make pythoninstall failed" + rm -f "${D}"/usr/bin/mib2c "${D}"/usr/bin/snmpcheck "${D}"/usr/bin/tkmib fi - dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO - newdoc EXAMPLE.conf.def EXAMPLE.conf + dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO || die + newdoc EXAMPLE.conf.def EXAMPLE.conf || die - use doc && dohtml docs/html/* + use doc && { dohtml docs/html/* || die ; } keepdir /etc/snmp /var/lib/net-snmp - newinitd "${FILESDIR}"/snmpd.rc7 snmpd - newconfd "${FILESDIR}"/snmpd.conf snmpd + newinitd "${FILESDIR}"/snmpd.init snmpd || die + newconfd "${FILESDIR}"/snmpd.conf snmpd || die - newinitd "${FILESDIR}"/snmptrapd.rc7 snmptrapd - newconfd "${FILESDIR}"/snmptrapd.conf snmptrapd + newinitd "${FILESDIR}"/snmptrapd.init snmptrapd || die + newconfd "${FILESDIR}"/snmptrapd.conf snmptrapd || die - # Remove everything, keeping only the snmpd, snmptrapd, MIBs, libs, and includes. + # Remove everything not required for an agent. + # Keep only the snmpd, snmptrapd, MIBs, headers and libraries. if use minimal; then - elog "USE=minimal is set. Cleaning up excess cruft for a embedded/minimal/server only install." + elog "USE='minimal' is set. Removing excess/non-minimal components." rm -rf "${D}"/usr/bin/{encode_keychange,snmp{get,getnext,set,usm,walk,bulkwalk,table,trap,bulkget,translate,status,delta,test,df,vacm,netstat,inform,snmpcheck}} rm -rf "${D}"/usr/share/snmp/snmpconf-data "${D}"/usr/share/snmp/*.conf @@ -186,16 +200,20 @@ src_install () { # bug 113788, install example config insinto /etc/snmp - newins "${S}"/EXAMPLE.conf snmpd.conf.example + newins "${S}"/EXAMPLE.conf snmpd.conf.example || die } -pkg_postrm() { - if use python ; then - python_mod_cleanup +pkg_postinst() { + if use python; then + python_mod_optimize netsnmp fi -} -pkg_postinst() { elog "An example configuration file has been installed in" elog "/etc/snmp/snmpd.conf.example." } + +pkg_postrm() { + if use python; then + python_mod_cleanup netsnmp + fi +} |