- /* The instance OID is added to the list of OIDs to GET from the
- * snmp agent last, so set vb on the last variable returned and copy
- * that OID. */
- for (vb = res->variables;
- (vb != NULL) && (vb->next_variable != NULL);
- vb = vb->next_variable)
- /* do nothing */;
- assert (vb != NULL);
-
- /* Copy the OID of the instance value to oid_list[data->values_len].
- * "oid_list" is used for the next GETNEXT request. */
- memcpy (oid_list[data->values_len].oid, vb->name,
- sizeof (oid) * vb->name_length);
- oid_list[data->values_len].oid_len = vb->name_length;
- }
-
- /* Iterate over all the (non-instance) values returned by the agent. The
- * (i < value_len) check will make sure we're not handling the instance OID
- * twice. */
- for (vb = res->variables, i = 0;
- (vb != NULL) && (i < data->values_len);
- vb = vb->next_variable, i++)
- {
- csnmp_table_values_t *vt;
- oid_t vb_name;
- oid_t suffix;
-
- csnmp_oid_init (&vb_name, vb->name, vb->name_length);
-
- /* Calculate the current suffix. This is later used to check that the
- * suffix is increasing. This also checks if we left the subtree */
- status = csnmp_oid_suffix (&suffix, &vb_name, data->values + i);
- if (status != 0)
- {
- DEBUG ("snmp plugin: host = %s; data = %s; Value %i failed. "
- "It probably left its subtree.",
- host->name, data->name, i);
- continue;
- }
-
- /* Make sure the OIDs returned by the agent are increasing. Otherwise our
- * table matching algorithm will get confused. */
- if ((value_list_tail[i] != NULL)
- && (csnmp_oid_compare (&suffix, &value_list_tail[i]->suffix) <= 0))
- {
- DEBUG ("snmp plugin: host = %s; data = %s; i = %i; "
- "Suffix is not increasing.",
- host->name, data->name, i);
- continue;
- }
+ /* The variable we are processing is a normal value */
+ } else {
+
+ csnmp_table_values_t *vt;
+ oid_t vb_name;
+ oid_t suffix;
+
+ csnmp_oid_init (&vb_name, vb->name, vb->name_length);
+
+ /* Calculate the current suffix. This is later used to check that the
+ * suffix is increasing. This also checks if we left the subtree */
+ int ret;
+ ret = csnmp_oid_suffix (&suffix, &vb_name, data->values + i);
+ if (ret != 0)
+ {
+ DEBUG ("snmp plugin: host = %s; data = %s; i = %i; "
+ "Value probably left its subtree.",
+ host->name, data->name, i);
+ oid_todo_list[i] = 0;
+ continue;
+ }
+
+ /* Make sure the OIDs returned by the agent are increasing. Otherwise our
+ * table matching algorithm will get confused. */
+ if ((value_list_tail[i] != NULL)
+ && (csnmp_oid_compare (&suffix, &value_list_tail[i]->suffix) <= 0))
+ {
+ DEBUG ("snmp plugin: host = %s; data = %s; i = %i; "
+ "Suffix is not increasing.",
+ host->name, data->name, i);
+ oid_todo_list[i] = 0;
+ continue;
+ }