summaryrefslogtreecommitdiffstats
path: root/vtysh
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2021-08-26 17:57:33 +0200
committerGitHub <noreply@github.com>2021-08-26 17:57:33 +0200
commitd448e2c5f96b3430fd643f52b9264ca87a45c291 (patch)
treed38574fb0ce8c936a003287d107eebf6eb718a8c /vtysh
parentMerge pull request #9492 from Jafaral/pim-cov (diff)
parent*: explicitly print "exit" at the end of every node config (diff)
downloadfrr-d448e2c5f96b3430fd643f52b9264ca87a45c291.tar.xz
frr-d448e2c5f96b3430fd643f52b9264ca87a45c291.zip
Merge pull request #9331 from idryzhov/explicit-exit
*: explicitly print "exit" at the end of every node config
Diffstat (limited to 'vtysh')
-rw-r--r--vtysh/vtysh_config.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index d22ec3113..2e1d7c5ba 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -272,16 +272,11 @@ void vtysh_config_parse_line(void *arg, const char *line)
strlen(" ip igmp query-interval")) == 0) {
config_add_line_uniq_end(config->line, line);
} else if (config->index == LINK_PARAMS_NODE
- && strncmp(line, " exit-link-params",
- strlen(" exit"))
+ && strncmp(line, " exit-link-params",
+ strlen(" exit"))
== 0) {
config_add_line(config->line, line);
config->index = INTERFACE_NODE;
- } else if (config->index == VRF_NODE
- && strncmp(line, " exit-vrf",
- strlen(" exit-vrf"))
- == 0) {
- config_add_line_uniq_end(config->line, line);
} else if (!strncmp(line, " vrrp", strlen(" vrrp"))
|| !strncmp(line, " no vrrp",
strlen(" no vrrp"))) {
@@ -300,7 +295,10 @@ void vtysh_config_parse_line(void *arg, const char *line)
config_add_line(config_top, line);
break;
default:
- if (strncmp(line, "interface", strlen("interface")) == 0)
+ if (strncmp(line, "exit", strlen("exit")) == 0) {
+ if (config)
+ config_add_line_uniq_end(config->line, line);
+ } else if (strncmp(line, "interface", strlen("interface")) == 0)
config = config_get(INTERFACE_NODE, line);
else if (strncmp(line, "pseudowire", strlen("pseudowire")) == 0)
config = config_get(PW_NODE, line);
@@ -496,7 +494,9 @@ void vtysh_config_dump(void)
* are not under the VRF node.
*/
if (config->index == INTERFACE_NODE
- && list_isempty(config->line)) {
+ && (listcount(config->line) == 1)
+ && (line = listnode_head(config->line))
+ && strmatch(line, "exit")) {
config_del(config);
continue;
}