0neblock / Arduino_SNMP

SNMP Agent built with Arduino
MIT License
77 stars 30 forks source link

Issue when GoSNMP library uses the default MaxRepetitions=50 #36

Open Assar-Westman opened 2 years ago

Assar-Westman commented 2 years ago

Hi I had an issue with Arduino locking up when using the GoSNMP library doing a bulkwalk. After some testing it was found that the default MaxRepititions=50 in the GoSNMP library made the Arduino to crash. I did a simple patch in the SNMPParser.cpp

@@ -63,10 +63,6 @@
                 pass = false;
                 globalError = GEN_ERR;
             } else {
-                // These three lines are needed to make big bulkwalk possible, without memory will be thrashed and the Arduino will stop working
-                if ( request.errorIndex.maxRepititions > 10 ){
-                    request.errorIndex.maxRepititions = 10;
-                }
                 pass = handleGetBulkRequestPDU(callbacks, request.varbindList, outResponseList, request.errorStatus.nonRepeaters, request.errorIndex.maxRepititions);
                 handleStatus = SNMP_GETBULK_OCCURRED;
             }
@@ -112,4 +108,4 @@
     }

     return handleStatus;
-}
+}

For me it seems to fix the crashing issue even when MaxRepititions=50 Best regards Assar W.

0neblock commented 1 year ago

Hey there, could you make a PR with this change?