net-snmp 3.5.5 → 3.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +4 -0
  2. package/index.js +11 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -3154,6 +3154,10 @@ Example programs are included under the module's `example` directory.
3154
3154
 
3155
3155
  * Add missing return in getbulk feedCb callback non-repeaters error condition
3156
3156
 
3157
+ ## Version 3.5.6 - 20/10/2021
3158
+
3159
+ * Fix GetNext OID calculation for off-tree OIDs
3160
+
3157
3161
  # License
3158
3162
 
3159
3163
  Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
package/index.js CHANGED
@@ -3492,7 +3492,7 @@ MibNode.prototype.findChildImmediatelyBefore = function (index) {
3492
3492
  }
3493
3493
  }
3494
3494
  }
3495
- return this.children[sortedChildrenKeys[sortedChildrenKeys.length]];
3495
+ return this.children[sortedChildrenKeys[sortedChildrenKeys.length - 1]];
3496
3496
  };
3497
3497
 
3498
3498
  MibNode.prototype.isDescendant = function (address) {
@@ -3824,7 +3824,16 @@ Mib.prototype.getTreeNode = function (oid) {
3824
3824
  var last = address.pop ();
3825
3825
  var parent = this.lookupAddress (address);
3826
3826
  if ( parent ) {
3827
- return (parent.findChildImmediatelyBefore (last) || parent);
3827
+ node = parent.findChildImmediatelyBefore (last);
3828
+ if ( !node )
3829
+ return parent;
3830
+ while ( true ) {
3831
+ // Find the last descendant
3832
+ var childrenAddresses = Object.keys (node.children).sort ( (a, b) => a - b);
3833
+ if ( childrenAddresses.length == 0 )
3834
+ return node;
3835
+ node = node.children[childrenAddresses[childrenAddresses.length - 1]];
3836
+ }
3828
3837
  }
3829
3838
  }
3830
3839
  return this.root;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "net-snmp",
3
- "version": "3.5.5",
3
+ "version": "3.5.6",
4
4
  "description": "JavaScript implementation of the Simple Network Management Protocol (SNMP)",
5
5
  "main": "index.js",
6
6
  "directories": {