summaryrefslogtreecommitdiffstats
path: root/lib/vty.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2023-09-28 01:41:16 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2023-09-28 01:41:16 +0200
commitd3aa9adb8da2a3d2fc4c7d926e2135c261bd2764 (patch)
tree75d35840bc39e44b4f1ea60246ff88691e021f9b /lib/vty.c
parentvty: fix configure terminal argument descriptions (diff)
downloadfrr-d3aa9adb8da2a3d2fc4c7d926e2135c261bd2764.tar.xz
frr-d3aa9adb8da2a3d2fc4c7d926e2135c261bd2764.zip
vty: fix working in file-lock mode
When the configuration node is entered in file-lock mode, candidate and running datastores are locked. Any configuration change is followed by an implicit commit which leads to a crash of mgmtd, because double lock is prohibited by an assert. When working in file-lock mode, we shouldn't do implicit commits which is disabled by allowing pending configuration changes. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/vty.c b/lib/vty.c
index 15cc340eb..ed8b71ed2 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2890,6 +2890,12 @@ int vty_config_enter(struct vty *vty, bool private_config, bool exclusive,
}
assert(vty->mgmt_locked_candidate_ds);
assert(vty->mgmt_locked_running_ds);
+
+ /*
+ * As datastores are locked explicitly, we don't need implicit
+ * commits and should allow pending changes.
+ */
+ vty->pending_allowed = true;
}
vty->node = CONFIG_NODE;
@@ -2946,6 +2952,8 @@ int vty_config_node_exit(struct vty *vty)
/* TODO: could we check for un-commited changes here? */
+ vty->pending_allowed = false;
+
if (vty->mgmt_locked_running_ds)
vty_mgmt_unlock_running_inline(vty);