SNMP: Fixed leafref index issue and table min-column issue for mult index

This commit is contained in:
Olof hagsand 2022-06-17 12:18:58 +02:00
parent ab6d9f565b
commit a61567a916
5 changed files with 11 additions and 8 deletions

View file

@ -49,9 +49,7 @@
* `--enable-netsnmp` * `--enable-netsnmp`
* `--with-mib-generated-yang-dir=DIR` * `--with-mib-generated-yang-dir=DIR`
* Current limitations: * Current limitations:
* Only static tables * Table add rows/columns via netsnmp API
* No advanced table indexes, (only integers)
* Memory leaks
## 5.7.0 ## 5.7.0
Expected: May 2022 Expected: May 2022

View file

@ -489,11 +489,14 @@ snmp_table_get(clicon_handle h,
while ((ys = yn_each(yt, ys)) != NULL) { while ((ys = yn_each(yt, ys)) != NULL) {
if (yang_keyword_get(ys) != Y_LEAF) if (yang_keyword_get(ys) != Y_LEAF)
continue; continue;
/* reset oid */
oidleaflen = MAX_OID_LEN;
if ((ret = yangext_oid_get(ys, oidleaf, &oidleaflen, NULL)) < 0) if ((ret = yangext_oid_get(ys, oidleaf, &oidleaflen, NULL)) < 0)
goto done; goto done;
if (ret == 0) if (ret == 0)
goto done; goto done;
assert(oidtlen + 1 == oidleaflen); if (oidtlen + 1 != oidleaflen) /* Indexes may be from other OID scope, skip those */
continue;
if (oids[oidleaflen-1] == oidleaf[oidleaflen-1]) if (oids[oidleaflen-1] == oidleaf[oidleaflen-1])
break; break;
} }

View file

@ -35,9 +35,11 @@
* It assumes a netsnmp damon is running. * It assumes a netsnmp damon is running.
* - If netsnmp does not run, clixon_snmp will not start * - If netsnmp does not run, clixon_snmp will not start
* - If netsnmp dies, clixon_snmp will exit * - If netsnmp dies, clixon_snmp will exit
* - If netsnmp is restarted, so should clixon_snmp be * - If netsnmp is restarted, clixon_snmp should also be restarted
* It is possible to be more resilient, such as setting a timer and trying again, in fact, libnetsnmp * It is possible to be more resilient, such as setting a timer and trying again, in fact, libnetsnmp
* has some such mechanisms * has some such mechanisms but these are NOT implemented
* @see RFC 6643 Translation of Structure of Management Information Version 2 (SMIv2)
* MIB Modules to YANG Modules
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H

View file

@ -312,7 +312,7 @@ mibyang_table_register(clicon_handle h,
goto done; goto done;
} }
} }
table_info->min_column = cvec_len(cvk); table_info->min_column = 1;
/* Count columns */ /* Count columns */
yleaf = NULL; yleaf = NULL;

View file

@ -166,4 +166,4 @@
/*! Re-register table entries when quering /*! Re-register table entries when quering
*/ */
#undef SNMP_TABLE_DYNAMIC #define SNMP_TABLE_DYNAMIC