Handle errors from clixon_table_create.
This commit is contained in:
parent
eb18a60d6c
commit
70ac79c825
1 changed files with 13 additions and 6 deletions
|
|
@ -108,6 +108,7 @@ int clixon_table_create(netsnmp_table_data_set *table, yang_stmt *ys, clicon_han
|
||||||
int i;
|
int i;
|
||||||
char *valstr;
|
char *valstr;
|
||||||
netsnmp_table_row *row, *tmprow;
|
netsnmp_table_row *row, *tmprow;
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
if (xml_nsctx_yang(ys, &nsc) < 0)
|
if (xml_nsctx_yang(ys, &nsc) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -157,6 +158,8 @@ int clixon_table_create(netsnmp_table_data_set *table, yang_stmt *ys, clicon_han
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retval = 1;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (xt)
|
if (xt)
|
||||||
xml_free(xt);
|
xml_free(xt);
|
||||||
|
|
@ -165,7 +168,7 @@ done:
|
||||||
if (cb)
|
if (cb)
|
||||||
cbuf_free(cb);
|
cbuf_free(cb);
|
||||||
|
|
||||||
return 0;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! SNMP table operation handlre
|
/*! SNMP table operation handlre
|
||||||
|
|
@ -179,7 +182,7 @@ snmp_table_handler(netsnmp_mib_handler *handler,
|
||||||
netsnmp_agent_request_info *reqinfo,
|
netsnmp_agent_request_info *reqinfo,
|
||||||
netsnmp_request_info *requests)
|
netsnmp_request_info *requests)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = SNMP_ERR_GENERR;
|
||||||
clixon_snmp_handle *sh;
|
clixon_snmp_handle *sh;
|
||||||
netsnmp_table_data_set *table;
|
netsnmp_table_data_set *table;
|
||||||
yang_stmt *ys;
|
yang_stmt *ys;
|
||||||
|
|
@ -199,7 +202,9 @@ snmp_table_handler(netsnmp_mib_handler *handler,
|
||||||
|
|
||||||
if ((ylist = yang_find(ys, Y_LIST, NULL)) == NULL)
|
if ((ylist = yang_find(ys, Y_LIST, NULL)) == NULL)
|
||||||
goto ok;
|
goto ok;
|
||||||
clixon_table_create(table, ys, h);
|
|
||||||
|
if (clixon_table_create(table, ys, h) < 0)
|
||||||
|
goto done;
|
||||||
|
|
||||||
switch(reqinfo->mode){
|
switch(reqinfo->mode){
|
||||||
case MODE_GETNEXT: // 160
|
case MODE_GETNEXT: // 160
|
||||||
|
|
@ -214,7 +219,8 @@ snmp_table_handler(netsnmp_mib_handler *handler,
|
||||||
}
|
}
|
||||||
ok:
|
ok:
|
||||||
retval = SNMP_ERR_NOERROR;
|
retval = SNMP_ERR_NOERROR;
|
||||||
//done:
|
|
||||||
|
done:
|
||||||
if (xt)
|
if (xt)
|
||||||
xml_free(xt);
|
xml_free(xt);
|
||||||
if (cb)
|
if (cb)
|
||||||
|
|
@ -437,7 +443,7 @@ static int
|
||||||
mib_yang_table(clicon_handle h,
|
mib_yang_table(clicon_handle h,
|
||||||
yang_stmt *ys)
|
yang_stmt *ys)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = SNMP_ERR_GENERR;
|
||||||
netsnmp_handler_registration *nhreg;
|
netsnmp_handler_registration *nhreg;
|
||||||
netsnmp_table_data_set *table;
|
netsnmp_table_data_set *table;
|
||||||
char *oidstr = NULL;
|
char *oidstr = NULL;
|
||||||
|
|
@ -477,7 +483,8 @@ mib_yang_table(clicon_handle h,
|
||||||
memcpy(sh->sh_oid, oid1, sizeof(oid1));
|
memcpy(sh->sh_oid, oid1, sizeof(oid1));
|
||||||
sh->sh_oidlen = sz1;
|
sh->sh_oidlen = sz1;
|
||||||
|
|
||||||
clixon_table_create(table, ys, h);
|
if (clixon_table_create(table, ys, h) < 0)
|
||||||
|
goto done;
|
||||||
|
|
||||||
if ((nhreg = netsnmp_create_handler_registration(name,
|
if ((nhreg = netsnmp_create_handler_registration(name,
|
||||||
snmp_table_handler,
|
snmp_table_handler,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue