From: SourceForge.net <no...@so...> - 2011-10-18 14:08:09
|
Patches item #3423915, was opened at 2011-10-14 13:25 Message generated for change (Comment added) made by fenner You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=3423915&group_id=12694 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Closed Resolution: None Priority: 5 Private: No Submitted By: Bill Fenner (fenner) Assigned to: Robert Story (rstory) Summary: default retry in 4.7.1 is 0, not 5 Initial Comment: In 4.6.1, as documented, snmpget (and all snmp commands) retry 5 times (for a total of 6): ~/482f @bs1.pa% strace -o /tmp/4.6.1-snmpget-retries.txt snmpget 10.0.0.0 sysDescr.0 Timeout: No Response from 10.0.0.0. ~/482f @bs1.pa% grep select /tmp/4.6.1-snmpget-retries.txt select(6, [5], NULL, NULL, {0, 999961}) = 0 (Timeout) select(6, [5], NULL, NULL, {0, 999955}) = 0 (Timeout) select(6, [5], NULL, NULL, {0, 999952}) = 0 (Timeout) select(6, [5], NULL, NULL, {0, 999950}) = 0 (Timeout) select(6, [5], NULL, NULL, {0, 999910}) = 0 (Timeout) select(6, [5], NULL, NULL, {0, 999957}) = 0 (Timeout) In 4.7.1, there are zero retries: ~/nar @bs14.sjc% strace -o /tmp/4.7.1-snmpget-retries.txt snmpget 10.0.0.0 sysDescr.0 Timeout: No Response from 10.0.0.0. ~/nar @bs14.sjc% grep select /tmp/4.7.1-snmpget-retries.txt select(6, [5], NULL, NULL, {0, 999959}) = 0 (Timeout) (I ran "snmpget -Dread_config" and made sure that there was no entry found for retries in any config file) It looks like the code to set retries assumes that netsnmp_ds_get_int returns a negative number when there is no value. int retry = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES); if (retry < 0) session->retries = DEFAULT_RETRIES; else session->retries = retry; but, it returns 0, so we never use DEFAULT_RETRIES. ---------------------------------------------------------------------- Comment By: Bill Fenner (fenner) Date: 2011-10-18 07:08 Message: You're right, I was trying to simplify since that code wasn't used in the normal case, but there's no particular harm in using the default when someone specifies "retries -1". ---------------------------------------------------------------------- Comment By: (bvassche) Date: 2011-10-18 06:02 Message: Why to remove the "retry < 0" code ? I think it makes sense to set "retries" to zero if the user has specified a negative value. ---------------------------------------------------------------------- Comment By: Bill Fenner (fenner) Date: 2011-10-15 21:16 Message: I tried with my suggested change to your patch (I uploaded precisely the patch that I tried), and I got the desired behavior: 5 retries, for a total of 6 calls to select. ---------------------------------------------------------------------- Comment By: Bill Fenner (fenner) Date: 2011-10-15 08:07 Message: Hi Bart, Thanks for the patch. I don't quite have time to test it right now, but it looks sensible. If I was going down that path, I would simplify the code to just unconditionally use netsnmp_ds_get_int( ..., NETSNMP_DS_LIB_RETRIES) since you know that it's set to DEFAULT_RETRIES. I hope to get to try your patch this weekend. ---------------------------------------------------------------------- Comment By: (bvassche) Date: 2011-10-15 05:58 Message: Thanks for the detailed bug report. Does the attached patch help ? ---------------------------------------------------------------------- Comment By: Bill Fenner (fenner) Date: 2011-10-14 13:30 Message: This code was added in git commit 6cac050a476ac5bcf36ac497c518b7f465b0d5b9 . ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=3423915&group_id=12694 |