diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index ecb6c5c6ac..abd5d04f44 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2097,7 +2097,8 @@ DEFUN (vtysh_write_terminal, vty_out (vty, "!%s", VTY_NEWLINE); for (i = 0; i < array_size(vtysh_client); i++) - vtysh_client_config (&vtysh_client[i], line); + if ((argc < 1 ) || (begins_with(vtysh_client[i].name, argv[0]))) + vtysh_client_config (&vtysh_client[i], line); /* Integrate vtysh specific configuration. */ vtysh_config_write (); @@ -2317,7 +2318,7 @@ ALIAS (vtysh_write_terminal, SHOW_STR "Current operating configuration\n") -ALIAS (vtysh_write_terminal_daemon, +ALIAS (vtysh_write_terminal, vtysh_show_running_config_daemon_cmd, "show running-config (zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd|pimd)", SHOW_STR diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index eeb635419c..e678fc1a8b 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -318,7 +318,14 @@ vtysh_config_dump (FILE *fp) if ((master = vector_slot (configvec, i)) != NULL) { for (ALL_LIST_ELEMENTS (master, node, nnode, config)) - { + { + /* Don't print empty sections for interface/vrf. Route maps on the + * other hand could have a legitimate empty section at the end. + */ + if ((config->index == INTERFACE_NODE || (config->index == VRF_NODE)) + && list_isempty (config->line)) + continue; + fprintf (fp, "%s\n", config->name); fflush (fp);