diff options
Diffstat (limited to 'lib/northbound_sysrepo.c')
| -rw-r--r-- | lib/northbound_sysrepo.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/northbound_sysrepo.c b/lib/northbound_sysrepo.c index b5ef040a3f..c027f4de72 100644 --- a/lib/northbound_sysrepo.c +++ b/lib/northbound_sysrepo.c @@ -414,6 +414,7 @@ static int frr_sr_config_rpc_cb(sr_session_ctx_t *session, const char *xpath, struct yang_data *data; size_t cb_output_cnt; int ret = SR_ERR_OK; + char errmsg[BUFSIZ] = {0}; nb_node = nb_node_find(xpath); if (!nb_node) { @@ -436,7 +437,9 @@ static int frr_sr_config_rpc_cb(sr_session_ctx_t *session, const char *xpath, } /* Execute callback registered for this XPath. */ - if (nb_callback_rpc(nb_node, xpath, input, output) != NB_OK) { + if (nb_callback_rpc(nb_node, xpath, input, output, errmsg, + sizeof(errmsg)) + != NB_OK) { flog_warn(EC_LIB_NB_CB_RPC, "%s: rpc callback failed: %s", __func__, xpath); ret = SR_ERR_OPERATION_FAILED; @@ -572,6 +575,8 @@ static int frr_sr_subscribe_state(const struct lys_node *snode, void *arg) return YANG_ITER_CONTINUE; nb_node = snode->priv; + if (!nb_node) + return YANG_ITER_CONTINUE; DEBUGD(&nb_dbg_client_sysrepo, "sysrepo: providing data to '%s'", nb_node->xpath); @@ -596,6 +601,8 @@ static int frr_sr_subscribe_rpc(const struct lys_node *snode, void *arg) return YANG_ITER_CONTINUE; nb_node = snode->priv; + if (!nb_node) + return YANG_ITER_CONTINUE; DEBUGD(&nb_dbg_client_sysrepo, "sysrepo: providing RPC to '%s'", nb_node->xpath); @@ -683,10 +690,10 @@ static int frr_sr_init(void) int event_pipe; frr_sr_subscribe_config(module); - yang_snodes_iterate_module(module->info, frr_sr_subscribe_state, - 0, module); - yang_snodes_iterate_module(module->info, frr_sr_subscribe_rpc, - 0, module); + yang_snodes_iterate(module->info, frr_sr_subscribe_state, 0, + module); + yang_snodes_iterate(module->info, frr_sr_subscribe_rpc, 0, + module); /* Watch subscriptions. */ ret = sr_get_event_pipe(module->sr_subscription, &event_pipe); |
