Skip to content

Commit

Permalink
vty: fix working in file-lock mode
Browse files Browse the repository at this point in the history
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 <[email protected]>
(cherry picked from commit d3aa9ad)
  • Loading branch information
idryzhov authored and mergify[bot] committed Sep 28, 2023
1 parent d3237b9 commit 8a1ca70
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -2884,6 +2884,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;
Expand Down Expand Up @@ -2940,6 +2946,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);

Expand Down

0 comments on commit 8a1ca70

Please sign in to comment.