From 07739dab47ddd4d51f82e37135dcfcd2addf1812 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 7 Sep 2012 10:11:42 +0200 Subject: [PATCH] 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. --- src/snmp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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++; } -- 2.11.0