Bruce Shaw wrote:
There's a couple of Solaris bugs I'd like rectified for 5.1.2. I've already posted patches.
1.956272
This is the biggie. It's reporting incorrect values and the fix is relatively simple.
The hrPartitionSize patch is applied.
2.944029
http://sourceforge.net/tracker/index.php?func=detail&aid=944029&group_id=126 94&atid=312694
People have been bugging me about this (PERL on Solaris) for awhile. It's the only solution that I can find that will satisfy everybody (except purists).
Was my reworking of 944029 useful to you ?
3.
This one is a bit tricker. At present, on Solaris (probably others), it only believes in controller 0 and 1. Most Solaris boxes have more controllers than that. Bumping this value up too high causes a segfault for reasons I don't quite follow.
Nevertheless this patch...
http://sourceforge.net/tracker/index.php?func=detail&aid=910094&group_id=126 94&atid=312694
is a partial compromise that works at least for me. It gives you more (0-7), but doesn't (AFAIK) segfault.
I've tried a debug print of HR_number_disk_types following
the last Add_HR_Disk_entry() call.
With patch#910094, the disk_devices array is fully used on Solaris.
A code review shows no array bounds overflow.
/*
Solaris uses 16 disk device types
HP/UX 10 uses 2 disk device types
Linux uses 3 disk device types
FreeBSD 4/5 uses 4 disk device types
FreeBSD 2 uses 2 disk device types
NetBSD 1 uses 2 disk device types
*/But I believe there is another array that has problems ? Try the attached patch. It won't increase MAXDISKS, but should prevent code mangling.
Note, however, that it STILL only reports mounted partitions, which is not the letter of HOST-RESOURCES-MIB, but fixing this is a complete rewrite (which I don't have time for - I've got a sick server) best left for 5.2.
4.
First CPU test is wrong. I don't know what I was thinking of.
It should be CHECKORDIE "^.1.3.6.1.2.1.25.3.2.1.3.768 = STRING: CPU"
That change was made to both V5-1-patches and the main branch.
18-Jun-2004 Mike Slifcak This patch prevents running off the end of the disks array. Offending attempts will print the name of the disk device and do no harm.
--- ./agent/mibgroup/ucd-snmp/disk.c 2004-01-08 18:10:06.000000000 -0500
+++ ./agent/mibgroup/ucd-snmp/disk.c 2004-06-18 01:47:11.205761104 -0400
@@ -236,7 +236,7 @@
int minpercent;
int minspace;
- if (numdisks == MAXDISKS) {
+ if (numdisks >= MAXDISKS) {
config_perror("Too many disks specified.");
snprintf(tmpbuf, sizeof(tmpbuf), "\tignoring: %s", cptr);
tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
@@ -282,7 +282,7 @@
char tmpbuf[1024];
int minpercent = DISKMINPERCENT;
- if (numdisks == MAXDISKS) {
+ if (numdisks >= MAXDISKS) {
config_perror("Too many disks specified.");
sprintf(tmpbuf, "\tignoring: %s", cptr);
config_perror(tmpbuf);
@@ -325,6 +325,14 @@
else if(index == -1){
/* add if and only if the device was found */
if(device[0] != 0) {
+ if (numdisks >= MAXDISKS) {
+ /* but if there is no room, tell this one is not allowed */
+ char tmpbuf[1024];
+ snprintf(tmpbuf, sizeof(tmpbuf), "Only %d disks allowed. Ignoring: %s",
MAXDISKS, path);
+ tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+ snmp_log(LOG_ERR, tmpbuf);
+ return;
+ }
copy_nword(path, disks[numdisks].path,
sizeof(disks[numdisks].path));
copy_nword(device, disks[numdisks].device,
