From: Florian Forster Date: Fri, 7 Sep 2012 08:11:42 +0000 (+0200) Subject: snmp plugin: Check for SNMP_ENDOFMIBVIEW. X-Git-Tag: collectd-5.0.5~7^2~2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=07739dab47ddd4d51f82e37135dcfcd2addf1812;p=collectd.git snmp plugin: Check for SNMP_ENDOFMIBVIEW. Some implementations of SNMP will send a special "variable" when you're leaving the requested subtree with type "endOfMibView" aka. "SNMP_ENDOFMIBVIEW". Examples of such implementations are Citrix Netscalers and IBM's General Parallel File System (GPFS). Reading past this special variable will result in weird values being returned. This adds an appropriate check to csnmp_check_res_left_subtree(). Thanks to "Mark" for reporting this issue and clarifying. --- diff --git a/src/snmp.c b/src/snmp.c index 5c6cce26..5f7d3e9c 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -886,10 +886,12 @@ static int csnmp_check_res_left_subtree (const host_definition_t *host, vb = vb->next_variable, i++) { num_checked++; - if (snmp_oid_ncompare (data->values[i].oid, - data->values[i].oid_len, - vb->name, vb->name_length, - data->values[i].oid_len) != 0) + + if ((vb->type == SNMP_ENDOFMIBVIEW) + || (snmp_oid_ncompare (data->values[i].oid, + data->values[i].oid_len, + vb->name, vb->name_length, + data->values[i].oid_len) != 0)) num_left_subtree++; }