Sensors marked as invalid should be excluded by snmpd(8) from the sensors
MIB just as sysctl(8) excludes them from the 'hw.sensors' tree.

Gerhard


Index: usr.sbin/snmpd/mib.c
===================================================================
RCS file: /cvs/src/usr.sbin/snmpd/mib.c,v
retrieving revision 1.79
diff -u -p -u -p -r1.79 mib.c
--- usr.sbin/snmpd/mib.c        8 Oct 2015 08:29:21 -0000       1.79
+++ usr.sbin/snmpd/mib.c        17 Nov 2015 10:39:31 -0000
@@ -2556,7 +2556,7 @@ mib_sensors(struct oid *oid, struct ber_
                }
                for (j = 0; j < SENSOR_MAX_TYPES; j++) {
                        mib[3] = j;
-                       for (k = 0; k < sensordev.maxnumt[j]; k++, n++) {
+                       for (k = 0; k < sensordev.maxnumt[j]; k++) {
                                mib[4] = k;
                                if (sysctl(mib, 5,
                                    &sensor, &slen, NULL, 0) == -1) {
@@ -2566,8 +2566,11 @@ mib_sensors(struct oid *oid, struct ber_
                                                break;
                                        return (-1);
                                }
+                               if (sensor.flags & SENSOR_FINVALID)
+                                       continue;
                                if (n == idx)
                                        goto found;
+                               n++;
                        }
                }
        }

Reply via email to