summaryrefslogtreecommitdiff
path: root/lib/vty.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-06-13 11:10:18 +0300
committerGitHub <noreply@github.com>2023-06-13 11:10:18 +0300
commite0db9a05bd43eafbd6e2b2bf84aaa7ac31b415fa (patch)
tree1a7d330c62e2a0bacd77a2a574852c5debd89dbb /lib/vty.c
parentb8396c9cb00a57a1daa981bfa9566dc900f91844 (diff)
parentdac48df52ad6322b505aea7aae62319a726216b5 (diff)
Merge pull request #13763 from LabNConsulting/mgmtd/simplify
fix 'exit' bug in config file processing, et al.
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/vty.c b/lib/vty.c
index fedbdbb813..cbf42de473 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2423,6 +2423,14 @@ void vty_close(struct vty *vty)
vty->status = VTY_CLOSE;
+ /*
+ * If we reach here with pending config to commit we will be losing it
+ * so warn the user.
+ */
+ if (vty->mgmt_num_pending_setcfg)
+ MGMTD_FE_CLIENT_ERR(
+ "vty closed, uncommitted config will be lost.");
+
if (mgmt_fe_client && vty->mgmt_session_id) {
MGMTD_FE_CLIENT_DBG("closing vty session");
mgmt_fe_destroy_client_session(mgmt_fe_client,
@@ -3445,7 +3453,9 @@ static void vty_mgmt_session_notify(struct mgmt_fe_client *client,
vty->mgmt_session_id = session_id;
} else {
vty->mgmt_session_id = 0;
- vty_close(vty);
+ /* We may come here by way of vty_close() and short-circuits */
+ if (vty->status != VTY_CLOSE)
+ vty_close(vty);
}
}