mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 02:46:26 +00:00
vtysh: Cleanup some stuff(tm)
1) vtysh_config_dump was not properly indented. Fix 2) Add VRF_NODE to be line_uniq when parsing return from sub-daemons 3) Fix 'no log monitor' to be line_uniq as well Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
1da2945621
commit
9a7aa8be43
@ -183,9 +183,10 @@ vtysh_config_parse_line (void *arg, const char *line)
|
|||||||
config->index = INTERFACE_NODE;
|
config->index = INTERFACE_NODE;
|
||||||
}
|
}
|
||||||
else if (config->index == RMAP_NODE ||
|
else if (config->index == RMAP_NODE ||
|
||||||
config->index == INTERFACE_NODE ||
|
config->index == INTERFACE_NODE ||
|
||||||
config->index == NS_NODE ||
|
config->index == NS_NODE ||
|
||||||
config->index == VTY_NODE)
|
config->index == VTY_NODE ||
|
||||||
|
config->index == VRF_NODE)
|
||||||
config_add_line_uniq (config->line, line);
|
config_add_line_uniq (config->line, line);
|
||||||
else
|
else
|
||||||
config_add_line (config->line, line);
|
config_add_line (config->line, line);
|
||||||
@ -278,6 +279,7 @@ vtysh_config_parse_line (void *arg, const char *line)
|
|||||||
|| strncmp (line, "hostname", strlen ("hostname")) == 0
|
|| strncmp (line, "hostname", strlen ("hostname")) == 0
|
||||||
|| strncmp (line, "frr", strlen ("frr")) == 0
|
|| strncmp (line, "frr", strlen ("frr")) == 0
|
||||||
|| strncmp (line, "agentx", strlen ("agentx")) == 0
|
|| strncmp (line, "agentx", strlen ("agentx")) == 0
|
||||||
|
|| strncmp (line, "no log", strlen ("no log")) == 0
|
||||||
)
|
)
|
||||||
config_add_line_uniq (config_top, line);
|
config_add_line_uniq (config_top, line);
|
||||||
else
|
else
|
||||||
@ -319,41 +321,41 @@ vtysh_config_dump (FILE *fp)
|
|||||||
for (i = 0; i < vector_active (configvec); i++)
|
for (i = 0; i < vector_active (configvec); i++)
|
||||||
if ((master = vector_slot (configvec, i)) != NULL)
|
if ((master = vector_slot (configvec, i)) != NULL)
|
||||||
{
|
{
|
||||||
for (ALL_LIST_ELEMENTS (master, node, nnode, config))
|
for (ALL_LIST_ELEMENTS (master, node, nnode, config))
|
||||||
{
|
{
|
||||||
/* Don't print empty sections for interface/vrf. Route maps on the
|
/* Don't print empty sections for interface/vrf. Route maps on the
|
||||||
* other hand could have a legitimate empty section at the end.
|
* other hand could have a legitimate empty section at the end.
|
||||||
*/
|
*/
|
||||||
if ((config->index == INTERFACE_NODE || (config->index == VRF_NODE))
|
if ((config->index == INTERFACE_NODE || config->index == VRF_NODE)
|
||||||
&& list_isempty (config->line))
|
&& list_isempty (config->line))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fprintf (fp, "%s\n", config->name);
|
fprintf (fp, "%s\n", config->name);
|
||||||
fflush (fp);
|
fflush (fp);
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS (config->line, mnode, mnnode, line))
|
for (ALL_LIST_ELEMENTS (config->line, mnode, mnnode, line))
|
||||||
{
|
{
|
||||||
fprintf (fp, "%s\n", line);
|
fprintf (fp, "%s\n", line);
|
||||||
fflush (fp);
|
fflush (fp);
|
||||||
}
|
}
|
||||||
if (! NO_DELIMITER (i))
|
if (! NO_DELIMITER (i))
|
||||||
{
|
{
|
||||||
fprintf (fp, "!\n");
|
fprintf (fp, "!\n");
|
||||||
fflush (fp);
|
fflush (fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (NO_DELIMITER (i))
|
if (NO_DELIMITER (i))
|
||||||
{
|
{
|
||||||
fprintf (fp, "!\n");
|
fprintf (fp, "!\n");
|
||||||
fflush (fp);
|
fflush (fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < vector_active (configvec); i++)
|
for (i = 0; i < vector_active (configvec); i++)
|
||||||
if ((master = vector_slot (configvec, i)) != NULL)
|
if ((master = vector_slot (configvec, i)) != NULL)
|
||||||
{
|
{
|
||||||
list_delete (master);
|
list_delete (master);
|
||||||
vector_slot (configvec, i) = NULL;
|
vector_slot (configvec, i) = NULL;
|
||||||
}
|
}
|
||||||
list_delete_all_node (config_top);
|
list_delete_all_node (config_top);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user