From: martijn Date: Tue, 24 Oct 2023 14:06:00 +0000 (+0000) Subject: When returning an endOfMibView we must always set it on the requested OID. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2f3602da13e11323806a3a205b8a07a6c4e283a1;p=openbsd When returning an endOfMibView we must always set it on the requested OID. OK tb@ --- diff --git a/usr.sbin/snmpd/application.c b/usr.sbin/snmpd/application.c index 77bd568ea62..d65999a06fb 100644 --- a/usr.sbin/snmpd/application.c +++ b/usr.sbin/snmpd/application.c @@ -1,4 +1,4 @@ -/* $OpenBSD: application.c,v 1.20 2023/10/24 13:50:47 martijn Exp $ */ +/* $OpenBSD: application.c,v 1.21 2023/10/24 14:06:00 martijn Exp $ */ /* * Copyright (c) 2021 Martijn van Duren @@ -99,6 +99,7 @@ struct appl_varbind_internal { enum appl_varbind_state avi_state; struct appl_varbind avi_varbind; struct appl_region *avi_region; + struct ber_oid avi_origid; int16_t avi_index; struct appl_request_upstream *avi_request_upstream; struct appl_request_downstream *avi_request_downstream; @@ -679,6 +680,8 @@ appl_processpdu(struct snmp_message *statereference, const char *ctxname, } ober_get_oid(varbind->be_sub, &(ureq->aru_vblist[i].avi_varbind.av_oid)); + ureq->aru_vblist[i].avi_origid = + ureq->aru_vblist[i].avi_varbind.av_oid; if (i + 1 < ureq->aru_varbindlen) { ureq->aru_vblist[i].avi_next = &(ureq->aru_vblist[i + 1]); @@ -1008,6 +1011,10 @@ appl_request_upstream_reply(struct appl_request_upstream *ureq) vb = &(ureq->aru_vblist[i]); vb->avi_varbind.av_next = &(ureq->aru_vblist[i + 1].avi_varbind); + value = vb->avi_varbind.av_value; + if (value->be_class == BER_CLASS_CONTEXT && + value->be_type == APPL_EXC_ENDOFMIBVIEW) + vb->avi_varbind.av_oid = vb->avi_origid; } ureq->aru_vblist[i - 1].avi_varbind.av_next = NULL;