From fff063aba993cab2ebe26cc416a4d2df3bc43a28 Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Wed, 18 Oct 2017 12:14:53 +0200 Subject: fixed non-translated PDU version retries at CommandGenerator --- pysnmp/entity/rfc3413/cmdgen.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'pysnmp/entity') diff --git a/pysnmp/entity/rfc3413/cmdgen.py b/pysnmp/entity/rfc3413/cmdgen.py index d4f108a1..d4c9d92d 100644 --- a/pysnmp/entity/rfc3413/cmdgen.py +++ b/pysnmp/entity/rfc3413/cmdgen.py @@ -70,6 +70,7 @@ class CommandGenerator(object): debug.logger & debug.flagApp and debug.logger( 'processResponsePdu: sendPduHandle %s, statusInformation %s' % (sendPduHandle, statusInformation)) errorIndication = statusInformation['errorIndication'] + # SNMP engine discovery will take extra retries, allow that if (errorIndication in (errind.notInTimeWindow, errind.unknownEngineID) and @@ -81,12 +82,21 @@ class CommandGenerator(object): cbFun(snmpEngine, origSendRequestHandle, statusInformation['errorIndication'], None, cbCtx) return + + # User-side API assumes SMIv2 + if origMessageProcessingModel == 0: + reqPDU = rfc2576.v2ToV1(origPdu) + pduVersion = 0 + else: + reqPDU = origPdu + pduVersion = 1 + try: sendPduHandle = snmpEngine.msgAndPduDsp.sendPdu( snmpEngine, origTransportDomain, origTransportAddress, origMessageProcessingModel, origSecurityModel, origSecurityName, origSecurityLevel, origContextEngineId, - origContextName, origPduVersion, origPdu, + origContextName, pduVersion, reqPDU, True, origTimeout, self.processResponsePdu, (origSendRequestHandle, cbFun, cbCtx)) -- cgit v1.2.1