diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2023-09-28 02:45:05 +0300 | 
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2023-09-28 02:45:05 +0300 | 
| commit | 1a09cf38949c2f2ab6d926941329e264f50d6880 (patch) | |
| tree | 8a6b15d3e85f7a73f0bc8767d5a48bf4809d0631 /vtysh | |
| parent | d3aa9adb8da2a3d2fc4c7d926e2135c261bd2764 (diff) | |
vtysh: fix entering configuration node in file-lock mode
When the config node is entered in file-lock mode, we should actually
remember it to correctly apply the workaround in `vtysh_exit`.
Otherwise, the file-lock mode is dropped once we exit any node one level
below the config node.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'vtysh')
| -rw-r--r-- | vtysh/vtysh.c | 14 | 
1 files changed, 13 insertions, 1 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 2475ef0c8f..9c61146c2d 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2379,12 +2379,23 @@ DEFUNSH(VTYSH_REALLYALL, vtysh_disable, vtysh_disable_cmd, "disable",  }  DEFUNSH(VTYSH_REALLYALL, vtysh_config_terminal, vtysh_config_terminal_cmd, -	"configure [terminal [file-lock]]", +	"configure [terminal]", +	"Configuration from vty interface\n" +	"Configuration terminal\n") +{ +	vty->node = CONFIG_NODE; +	return CMD_SUCCESS; +} + +DEFUNSH(VTYSH_REALLYALL, vtysh_config_terminal_file_lock, +	vtysh_config_terminal_file_lock_cmd, +	"configure terminal file-lock",  	"Configuration from vty interface\n"  	"Configuration terminal\n"  	"Configuration with locked datastores\n")  {  	vty->node = CONFIG_NODE; +	vty->vtysh_file_locked = true;  	return CMD_SUCCESS;  } @@ -5021,6 +5032,7 @@ void vtysh_init_vty(void)  	if (!user_mode)  		install_element(VIEW_NODE, &vtysh_enable_cmd);  	install_element(ENABLE_NODE, &vtysh_config_terminal_cmd); +	install_element(ENABLE_NODE, &vtysh_config_terminal_file_lock_cmd);  	install_element(ENABLE_NODE, &vtysh_disable_cmd);  	/* "exit" command. */  | 
