From f344c66ea358c151a218e986173e60bb0295e003 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 26 Nov 2018 16:47:22 -0200 Subject: *: remove the configuration lock from all daemons A while ago all FRR configuration commands were converted to use the QOBJ infrastructure to keep track of configuration objects. This means the configuration lock isn't necessary anymore because the QOBJ code detects when someones tries to edit a configuration object that was deleted and react accordingly (log an error and abort the command). The possibility of accessing dangling pointers doesn't exist anymore since vty->index was removed. Summary of the changes: * remove the configuration lock and the vty_config_lockless() function. * rename vty_config_unlock() to vty_config_exit() since we need to clean up a few things when exiting from the configuration mode. * rename vty_config_lock() to vty_config_enter() to remove code duplication that existed between the three different "configuration" commands (terminal, private and exclusive). Configuration commands converted to the new northbound model don't need the configuration lock either since the northbound API also detects when someone tries to edit a configuration object that doesn't exist anymore. Signed-off-by: Renato Westphal --- lib/command.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'lib/command.c') diff --git a/lib/command.c b/lib/command.c index bd000c3746..80ba86db37 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1386,19 +1386,7 @@ DEFUN (config_terminal, "Configuration from vty interface\n" "Configuration terminal\n") { - if (vty_config_lock(vty)) - vty->node = CONFIG_NODE; - else { - vty_out(vty, "VTY configuration is locked by other VTY\n"); - return CMD_WARNING_CONFIG_FAILED; - } - - vty->private_config = false; - vty->candidate_config = vty_shared_candidate_config; - if (frr_get_cli_mode() == FRR_CLI_TRANSACTIONAL) - vty->candidate_config_base = nb_config_dup(running_config); - - return CMD_SUCCESS; + return vty_config_enter(vty, false, false); } /* Enable command */ @@ -1450,7 +1438,7 @@ void cmd_exit(struct vty *vty) break; case CONFIG_NODE: vty->node = ENABLE_NODE; - vty_config_unlock(vty); + vty_config_exit(vty); break; case INTERFACE_NODE: case PW_NODE: @@ -1594,7 +1582,7 @@ DEFUN (config_end, case LINK_PARAMS_NODE: case BFD_NODE: case BFD_PEER_NODE: - vty_config_unlock(vty); + vty_config_exit(vty); vty->node = ENABLE_NODE; break; default: -- cgit v1.2.3