net-snmp 3.14.0 → 3.15.0

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.
package/README.cn.md CHANGED
@@ -1417,6 +1417,7 @@ snmp.createModuleStore ()
1417
1417
  * RFC1158-MIB
1418
1418
  * RFC-1212
1419
1419
  * RFC1213-MIB
1420
+ * RFC-1215
1420
1421
  * SNMPv2-SMI
1421
1422
  * SNMPv2-CONF
1422
1423
  * SNMPv2-TC
package/README.md CHANGED
@@ -2450,6 +2450,7 @@ pre-loaded "base" modules is:
2450
2450
  * RFC1158-MIB
2451
2451
  * RFC-1212
2452
2452
  * RFC1213-MIB
2453
+ * RFC-1215
2453
2454
  * SNMPv2-SMI
2454
2455
  * SNMPv2-CONF
2455
2456
  * SNMPv2-TC
@@ -3407,6 +3408,14 @@ Example programs are included under the module's `example` directory.
3407
3408
 
3408
3409
  * Add support for SMIv1 defined types and TRAP-TYPE SMIv1 macro
3409
3410
 
3411
+ ## Version 3.14.1 - 11/09/2024
3412
+
3413
+ * Add RFC-1215 to base MIB modules to provide TRAP-TYPE macro
3414
+
3415
+ ## Version 3.15.0 - 14/09/2024
3416
+
3417
+ * Change return of undefined or null MIB values to NoSuchInstance
3418
+
3410
3419
  # License
3411
3420
 
3412
3421
  Copyright (c) 2020 Mark Abrahams <mark@abrahams.co.nz>
package/index.js CHANGED
@@ -3555,6 +3555,7 @@ ModuleStore.BASE_MODULES = [
3555
3555
  "RFC1158-MIB",
3556
3556
  "RFC-1212",
3557
3557
  "RFC1213-MIB",
3558
+ "RFC-1215",
3558
3559
  "SNMPv2-SMI",
3559
3560
  "SNMPv2-CONF",
3560
3561
  "SNMPv2-TC",
@@ -3770,17 +3771,16 @@ MibNode.prototype.getNextInstanceNode = function () {
3770
3771
  var childrenAddresses;
3771
3772
 
3772
3773
  var node = this;
3773
- if ( this.value != null ) {
3774
- // Need upwards traversal first
3775
- node = this;
3774
+ // If we start on a leaf node, we need next (right) sibling or upwards traversal first
3775
+ if ( ! node.children || Object.keys (node.children).length === 0 ) {
3776
3776
  while ( node ) {
3777
3777
  siblingIndex = node.address.slice(-1)[0];
3778
3778
  node = node.parent;
3779
3779
  if ( ! node ) {
3780
- // end of MIB
3780
+ // End of MIB
3781
3781
  return null;
3782
3782
  } else {
3783
- // Move to next sibling
3783
+ // Move to next sibling if we are not last child
3784
3784
  childrenAddresses = Object.keys (node.children).sort ( (a, b) => a - b);
3785
3785
  var siblingPosition = childrenAddresses.indexOf(siblingIndex.toString());
3786
3786
  if ( siblingPosition + 1 < childrenAddresses.length ) {
@@ -3791,7 +3791,8 @@ MibNode.prototype.getNextInstanceNode = function () {
3791
3791
  }
3792
3792
  }
3793
3793
  while ( node ) {
3794
- if ( node.value != null ) {
3794
+ // Return if at leaf
3795
+ if ( ! node.children || Object.keys (node.children).length === 0 ) {
3795
3796
  return node;
3796
3797
  }
3797
3798
  // Descend to first child if not at leaf
@@ -5214,6 +5215,9 @@ Agent.prototype.request = function (socket, requestMessage, rinfo) {
5214
5215
  responseVarbind.type = mibRequests[savedIndex].instanceNode.valueType;
5215
5216
  }
5216
5217
  responseVarbind.value = mibRequests[savedIndex].instanceNode.value;
5218
+ if ( responseVarbind.value === undefined || responseVarbind.value === null ) {
5219
+ responseVarbind.type = ObjectType.NoSuchInstance;
5220
+ }
5217
5221
  }
5218
5222
  if ( providerNode && providerNode.provider && providerNode.provider.name ) {
5219
5223
  responseVarbind.providerName = providerNode.provider.name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "net-snmp",
3
- "version": "3.14.0",
3
+ "version": "3.15.0",
4
4
  "description": "JavaScript implementation of the Simple Network Management Protocol (SNMP)",
5
5
  "main": "index.js",
6
6
  "directories": {