When we have 2 overlapping regions within the same backend the current
code takes the OID of the parent region after the child region returned
an EOMV. This is of course wrong and creates an infinite loop.

OK?

martijn@

Index: application.c
===================================================================
RCS file: /cvs/src/usr.sbin/snmpd/application.c,v
retrieving revision 1.6
diff -u -p -r1.6 application.c
--- application.c       30 Jun 2022 11:28:36 -0000      1.6
+++ application.c       22 Jul 2022 15:07:53 -0000
@@ -1260,6 +1260,7 @@ appl_varbind_backend(struct appl_varbind
        struct appl_request_upstream *ureq = ivb->avi_request_upstream;
        struct appl_region search, *region, *pregion;
        struct appl_varbind *vb = &(ivb->avi_varbind);
+       struct ber_oid oid;
        int next, cmp;
 
        next = ureq->aru_pdu->be_type == SNMP_C_GETNEXTREQ ||
@@ -1310,10 +1311,15 @@ appl_varbind_backend(struct appl_varbind
        }
        ivb->avi_region = region;
        if (next) {
+               oid = region->ar_oid;
                do {
                        pregion = region;
-                       region = appl_region_next(ureq->aru_ctx,
-                           &(region->ar_oid), pregion);
+                       region = appl_region_next(ureq->aru_ctx, &oid, pregion);
+                       if (region != NULL &&
+                           appl_region_cmp(region, pregion) > 0)
+                               oid = region->ar_oid;
+                       else
+                               ober_oid_nextsibling(&oid);
                } while (region != NULL &&
                    region->ar_backend == pregion->ar_backend);
                if (region == NULL) {

Reply via email to