Commits

Anonymous committed 388d1cb

Standard SNMP Apps and built-in proxy now ignores malformed errorIndex
value.

  • Participants
  • Parent commits 2db7b3d

Comments (0)

Files changed (4)

+Revision 4.2.5rc0
+-----------------
+
+- Packet-level SNMP API (pysnmp.proto.api) getErrorIndex() method can now
+  be instructed to ignore portentially malformed errorIndex SNMP packet
+  value what sometimes happens with buggy SNMP implementations.
+- Standard SNMP Apps and built-in proxy now ignores malformed errorIndex
+  value.
+
 Revision 4.2.4
 --------------
 

File pysnmp/entity/rfc3413/cmdgen.py

         cbFun(sendRequestHandle,
               None,
               pMod.apiPDU.getErrorStatus(rspPDU),
-              pMod.apiPDU.getErrorIndex(rspPDU),
+              pMod.apiPDU.getErrorIndex(rspPDU, muteErrors=True),
               pMod.apiPDU.getVarBinds(rspPDU),
               cbCtx)
 
         
         if not cbFun(sendRequestHandle, errorIndication,
                      pMod.apiPDU.getErrorStatus(rspPDU),
-                     pMod.apiPDU.getErrorIndex(rspPDU),
+                     pMod.apiPDU.getErrorIndex(rspPDU, muteErrors=True),
                      varBindTable, cbCtx):
             debug.logger & debug.flagApp and debug.logger('_handleResponse: sendRequestHandle %s, app says to stop walking' % sendRequestHandle)
             return  # app says enough
 
         if not cbFun(sendRequestHandle, errorIndication,
                      pMod.apiBulkPDU.getErrorStatus(rspPDU),
-                     pMod.apiBulkPDU.getErrorIndex(rspPDU),
+                     pMod.apiBulkPDU.getErrorIndex(rspPDU, muteErrors=True),
                      varBindTable, cbCtx):
             debug.logger & debug.flagApp and debug.logger('_handleResponse: sendRequestHandle %s, app says to stop walking' % sendRequestHandle)
             return # app says enough

File pysnmp/entity/rfc3413/ntforg.py

             pMod = api.protoModules[pduVersion]
             self._handleResponse(metaSendPduHandle, None,
                                  pMod.apiPDU.getErrorStatus(PDU),
-                                 pMod.apiPDU.getErrorIndex(PDU),
+                                 pMod.apiPDU.getErrorIndex(PDU,muteErrors=True),
                                  pMod.apiPDU.getVarBinds(PDU),            
                                  cbFun, cbCtx)
 

File pysnmp/proto/proxy/rfc2576.py

     if pduType in rfc3411.responseClassPDUs:
         # 4.1.2.2.1&2
         errorStatus = int(v1.apiPDU.getErrorStatus(v1Pdu))
-        errorIndex = int(v1.apiPDU.getErrorIndex(v1Pdu))
+        errorIndex = int(v1.apiPDU.getErrorIndex(v1Pdu, muteErrors=True))
         if errorStatus == 2: # noSuchName
             if origV2Pdu.tagSet == v2c.GetNextRequestPDU.tagSet:
                 v2VarBinds[errorIndex-1] = (
             v1.apiPDU.setErrorStatus(
                 v1Pdu, __v2ToV1ErrorMap[v2ErrorStatus]
                 )
-            v1.apiPDU.setErrorIndex(v1Pdu, v2c.apiPDU.getErrorIndex(v2Pdu))
+            v1.apiPDU.setErrorIndex(v1Pdu, v2c.apiPDU.getErrorIndex(v2Pdu, muteErrors=True))
             
     # Translate Var-Binds
     if pduType in rfc3411.responseClassPDUs and \