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 ebfd173e0b
commit fa87b7d59f
3 changed files with 9 additions and 4 deletions

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;