Skip to content

Commit

Permalink
Add EndOfMibView Check to Walk functions
Browse files Browse the repository at this point in the history
Comply with RFC 1906 4.2.2
  • Loading branch information
luke-waymark-addinsight committed Oct 17, 2024
1 parent 3840a4f commit b188748
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SharpSnmpLib/Messaging/Messenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ public static async Task<int> WalkAsync(VersionCode version, IPEndPoint endpoint
do
{
seed = data.Item2;

if (version == VersionCode.V2 && seed?.Data.TypeCode == SnmpType.EndOfMibView)
{
break;
}

if (seed == tableV)
{
data = await HasNextAsync(version, endpoint, community, seed).ConfigureAwait(false);
Expand Down Expand Up @@ -703,6 +709,12 @@ public static int Walk(VersionCode version, IPEndPoint endpoint, OctetString com
do
{
seed = next;

if (version == VersionCode.V2 && seed?.Data.TypeCode == SnmpType.EndOfMibView)
{
break;
}

if (seed == tableV)
{
continue;
Expand Down
6 changes: 6 additions & 0 deletions SharpSnmpLib/Messaging/Net6Messenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ public static async Task<int> WalkAsync(VersionCode version, IPEndPoint endpoint
do
{
var seed = data.Item2;

if (version == VersionCode.V2 && seed?.Data.TypeCode == SnmpType.EndOfMibView)
{
break;
}

if (seed == tableV)
{
data = await HasNextAsync(version, endpoint, community, seed, token).ConfigureAwait(false);
Expand Down

0 comments on commit b188748

Please sign in to comment.