diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/darr.c | 7 | ||||
| -rw-r--r-- | lib/if.c | 11 | ||||
| -rw-r--r-- | lib/northbound.c | 2 | ||||
| -rw-r--r-- | lib/vty.c | 10 |
4 files changed, 23 insertions, 7 deletions
diff --git a/lib/darr.c b/lib/darr.c index f7a64fc394..7a01274104 100644 --- a/lib/darr.c +++ b/lib/darr.c @@ -58,6 +58,7 @@ char *__darr_in_vsprintf(char **sp, bool concat, const char *fmt, va_list ap) size_t inlen = concat ? darr_strlen(*sp) : 0; size_t capcount = strlen(fmt) + MIN(inlen + 64, 128); ssize_t len; + va_list ap_copy; darr_ensure_cap(*sp, capcount); @@ -68,10 +69,12 @@ char *__darr_in_vsprintf(char **sp, bool concat, const char *fmt, va_list ap) if (darr_len(*sp) == 0) *darr_append(*sp) = 0; again: - len = vsnprintf(darr_last(*sp), darr_avail(*sp), fmt, ap); + va_copy(ap_copy, ap); + len = vsnprintf(darr_last(*sp), darr_avail(*sp) + 1, fmt, ap_copy); + va_end(ap_copy); if (len < 0) darr_in_strcat(*sp, fmt); - else if ((size_t)len < darr_avail(*sp)) + else if ((size_t)len <= darr_avail(*sp)) _darr_len(*sp) += len; else { darr_ensure_cap(*sp, darr_len(*sp) + (size_t)len); @@ -1340,6 +1340,15 @@ static void cli_show_interface_end(struct vty *vty, vty_out(vty, "exit\n"); } +static int cli_cmp_interface(const struct lyd_node *dnode1, + const struct lyd_node *dnode2) +{ + const char *ifname1 = yang_dnode_get_string(dnode1, "name"); + const char *ifname2 = yang_dnode_get_string(dnode2, "name"); + + return if_cmp_name_func(ifname1, ifname2); +} + void if_vty_config_start(struct vty *vty, struct interface *ifp) { vty_frame(vty, "!\n"); @@ -1760,6 +1769,7 @@ const struct frr_yang_module_info frr_interface_info = { .destroy = lib_interface_destroy, .cli_show = cli_show_interface, .cli_show_end = cli_show_interface_end, + .cli_cmp = cli_cmp_interface, .get_next = lib_interface_get_next, .get_keys = lib_interface_get_keys, .lookup_entry = lib_interface_lookup_entry, @@ -1842,6 +1852,7 @@ const struct frr_yang_module_info frr_interface_cli_info = { .cbs = { .cli_show = cli_show_interface, .cli_show_end = cli_show_interface_end, + .cli_cmp = cli_cmp_interface, }, }, { diff --git a/lib/northbound.c b/lib/northbound.c index 25ea658bc4..487f225913 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -1873,7 +1873,7 @@ static void nb_transaction_apply_finish(struct nb_transaction *transaction, dnode = lyd_parent(dnode); if (!dnode) - break; + continue; /* * The dnode from 'delete' callbacks point to elements @@ -3570,8 +3570,9 @@ static void vty_mgmt_set_config_result_notified( zlog_err("SET_CONFIG request for client 0x%" PRIx64 " failed, Error: '%s'", client_id, errmsg_if_any ? errmsg_if_any : "Unknown"); - vty_out(vty, "ERROR: SET_CONFIG request failed, Error: %s\n", - errmsg_if_any ? errmsg_if_any : "Unknown"); + vty_out(vty, "%% Configuration failed.\n\n"); + if (errmsg_if_any) + vty_out(vty, "%s\n", errmsg_if_any); } else { debug_fe_client("SET_CONFIG request for client 0x%" PRIx64 " req-id %" PRIu64 " was successfull", @@ -3602,8 +3603,9 @@ static void vty_mgmt_commit_config_result_notified( zlog_err("COMMIT_CONFIG request for client 0x%" PRIx64 " failed, Error: '%s'", client_id, errmsg_if_any ? errmsg_if_any : "Unknown"); - vty_out(vty, "ERROR: COMMIT_CONFIG request failed, Error: %s\n", - errmsg_if_any ? errmsg_if_any : "Unknown"); + vty_out(vty, "%% Configuration failed.\n\n"); + if (errmsg_if_any) + vty_out(vty, "%s\n", errmsg_if_any); } else { debug_fe_client("COMMIT_CONFIG request for client 0x%" PRIx64 " req-id %" PRIu64 " was successfull", |
