summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd
diff options
context:
space:
mode:
authorGerhard Roth <gerhard@cvs.openbsd.org>2015-11-17 12:30:24 +0000
committerGerhard Roth <gerhard@cvs.openbsd.org>2015-11-17 12:30:24 +0000
commit2293a9c6f0bb38464633bd36e126258893fc64c7 (patch)
tree647c2362bd631f5120418013055b49ebddc54622 /usr.sbin/snmpd
parentaa9a10af28f7d1b0db0a4c533d065bd6f9e9e2ca (diff)
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. OK mikeb@, stehn@
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r--usr.sbin/snmpd/mib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/snmpd/mib.c b/usr.sbin/snmpd/mib.c
index 7868f8238e8..e8a4179fbc3 100644
--- a/usr.sbin/snmpd/mib.c
+++ b/usr.sbin/snmpd/mib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mib.c,v 1.79 2015/10/08 08:29:21 sthen Exp $ */
+/* $OpenBSD: mib.c,v 1.80 2015/11/17 12:30:23 gerhard Exp $ */
/*
* Copyright (c) 2012 Joel Knight <joel@openbsd.org>
@@ -2556,7 +2556,7 @@ mib_sensors(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
}
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_oid *o, struct ber_element **elm)
break;
return (-1);
}
+ if (sensor.flags & SENSOR_FINVALID)
+ continue;
if (n == idx)
goto found;
+ n++;
}
}
}