When doing a getnext/getbulk request, agentx diverges from snmp that it sends a searchrange, instead of a simple next. The end oid is currently not correctly handled by both snmpd(8) and libagentx. If a backend has two ranges with one or more other backends having a region claimed in between snmpd(8) can skip over that other region.
To make it concrete. Moving most of mib.c into an libagentx based application make it claim ipfRouteEntStatus and dot1dBaseNumPorts. But the snmp tree (which resides in between) remains part of snmpd(8). Doing a getnext on ipfRouteEntStatus.9 would make snmpd(8) skip to dot1dBaseNumPorts.0, instead of snmpInPkts.0. This diff should fix the libagentx side of things. OK? martijn@ Index: agentx.c =================================================================== RCS file: /cvs/src/lib/libagentx/agentx.c,v retrieving revision 1.15 diff -u -p -r1.15 agentx.c --- agentx.c 19 Jul 2022 19:25:42 -0000 1.15 +++ agentx.c 21 Jul 2022 20:14:04 -0000 @@ -2722,7 +2722,8 @@ agentx_varbind_start(struct agentx_varbi getnext: while (axo != NULL && axo->axo_cstate != AX_CSTATE_OPEN) axo = RB_NEXT(axc_objects, &(axc->axc_objects), axo); - if (axo == NULL) { + if (axo == NULL || + ax_oid_cmp(&(axo->axo_oid), &(axv->axv_end)) > 0) { agentx_varbind_endofmibview(axv); return; }