Skip to content

Conversation

dplepage-dd
Copy link

There's a value .NonRepeaters defined in gosnmp.go. The comment on this value is wrong - there is no max-repeaters value defined by that RFC, only max-repetitions, which is set by .MaxRepetitions. In fact, what this attribute is setting is the non-repeaters attribute, which is NOT something that makes sense as a global setting - it indicates how many of the oids provided in a GETBULK request should only have one value fetched, instead of bulk-fetching max-repetitions OIDs starting at that point.

In the only place this attribute is used, as part of walk.go, there is exactly one OID being passed in, and the whole point of using GetBulk is that we want to fetch more than one value, so in this call non-repeaters should always be set to 0; it should not be configurable. Setting it to anything greater than zero simply means that GetBulk will now only fetch one value for that OID; if you want that behavior, you should be using .Walk instead of .BulkWalk.

So as a parameter, its sole behavior is to make .BulkWalk* behave unexpectedly badly; it is not something that should exist.

Signed-off-by: Daniel Lepage <daniel.lepage@datadoghq.com>
@dplepage-dd dplepage-dd force-pushed the remove-non-repeaters branch from 40bc5ad to 5b8969e Compare June 25, 2024 17:02
@@ -111,10 +111,6 @@ type GoSNMP struct {
// See comments in https://github.com/gosnmp/gosnmp/issues/100
MaxRepetitions uint32

// NonRepeaters sets the GETBULK max-repeaters used by BulkWalk*.
// (default: 0 as per RFC 1905)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than fully remove this, can you mark it Deprecated: This parameter is not used and ignored per Go syntax conventions?

We can keep the behavior change in walk.go, but keeping the struct field avoids breaking the API.

@TimRots TimRots mentioned this pull request Jul 14, 2025
@TimRots TimRots closed this Jul 15, 2025
@TimRots TimRots mentioned this pull request Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants