diff options
author | Christian Hopps <chopps@labn.net> | 2023-07-15 00:21:55 +0200 |
---|---|---|
committer | Christian Hopps <chopps@labn.net> | 2023-07-15 00:24:44 +0200 |
commit | 07035ce9548021c2d9484358aa620572d7dad851 (patch) | |
tree | a9d468b9ab4e007cd34330f31ac9d5232976d6b3 /vtysh/vtysh.c | |
parent | lib: mgmtd: only clear pending for the in-progress command (diff) | |
download | frr-07035ce9548021c2d9484358aa620572d7dad851.tar.xz frr-07035ce9548021c2d9484358aa620572d7dad851.zip |
vtysh: track and fix file-lock use in the workaround from 2004
There's a workaround in the code from a bug from back in 2004, it ends
and re-enters config mode anytime an `exit` is done from a level below
the top-level config node (e.g., from a `router isis` node). We need to
re-enter config mode with or without a lock according to how we actually
entered it to begin with.
fixes #13920
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'vtysh/vtysh.c')
-rw-r--r-- | vtysh/vtysh.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 6744bfe72..8b223d1aa 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2357,8 +2357,13 @@ static int vtysh_exit(struct vty *vty) /* resync in case one of the daemons is somewhere else */ vtysh_execute("end"); /* NOTE: a rather expensive thing to do, can we avoid it? */ - vtysh_execute("configure terminal file-lock"); + + if (vty->vtysh_file_locked) + vtysh_execute("configure terminal file-lock"); + else + vtysh_execute("configure terminal"); } + return CMD_SUCCESS; } |