diff options
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 89 |
1 files changed, 12 insertions, 77 deletions
diff --git a/lib/command.c b/lib/command.c index bd000c3746..b46241ac87 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1009,7 +1009,7 @@ enum node_type node_parent(enum node_type node) } /* Execute command by argument vline vector. */ -static int cmd_execute_command_real(vector vline, enum filter_type filter, +static int cmd_execute_command_real(vector vline, enum cmd_filter_type filter, struct vty *vty, const struct cmd_element **cmd) { @@ -1051,8 +1051,13 @@ static int cmd_execute_command_real(vector vline, enum filter_type filter, int ret; if (matched_element->daemon) ret = CMD_SUCCESS_DAEMON; - else + else { + /* Clear enqueued configuration changes. */ + vty->num_cfg_changes = 0; + memset(&vty->cfg_changes, 0, sizeof(vty->cfg_changes)); + ret = matched_element->func(matched_element, vty, argc, argv); + } // delete list and cmd_token's in it list_delete(&argv_list); @@ -1386,19 +1391,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 +1443,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: @@ -1542,67 +1535,11 @@ DEFUN (config_end, "end", "End current mode and change to enable mode.\n") { - switch (vty->node) { - case VIEW_NODE: - case ENABLE_NODE: - /* Nothing to do. */ - break; - case CONFIG_NODE: - case INTERFACE_NODE: - case PW_NODE: - case LOGICALROUTER_NODE: - case VRF_NODE: - case NH_GROUP_NODE: - case ZEBRA_NODE: - case RIP_NODE: - case RIPNG_NODE: - case EIGRP_NODE: - case BABEL_NODE: - case BGP_NODE: - case BGP_VRF_POLICY_NODE: - case BGP_VNC_DEFAULTS_NODE: - case BGP_VNC_NVE_GROUP_NODE: - case BGP_VNC_L2_GROUP_NODE: - case BGP_VPNV4_NODE: - case BGP_VPNV6_NODE: - case BGP_FLOWSPECV4_NODE: - case BGP_FLOWSPECV6_NODE: - case BGP_IPV4_NODE: - case BGP_IPV4M_NODE: - case BGP_IPV4L_NODE: - case BGP_IPV6_NODE: - case BGP_IPV6M_NODE: - case BGP_EVPN_NODE: - case BGP_EVPN_VNI_NODE: - case BGP_IPV6L_NODE: - case RMAP_NODE: - case PBRMAP_NODE: - case OSPF_NODE: - case OSPF6_NODE: - case LDP_NODE: - case LDP_IPV4_NODE: - case LDP_IPV6_NODE: - case LDP_IPV4_IFACE_NODE: - case LDP_IPV6_IFACE_NODE: - case LDP_L2VPN_NODE: - case LDP_PSEUDOWIRE_NODE: - case ISIS_NODE: - case OPENFABRIC_NODE: - case KEYCHAIN_NODE: - case KEYCHAIN_KEY_NODE: - case VTY_NODE: - case LINK_PARAMS_NODE: - case BFD_NODE: - case BFD_PEER_NODE: - vty_config_unlock(vty); + if (vty->config) { + vty_config_exit(vty); vty->node = ENABLE_NODE; - break; - default: - break; } - vty->xpath_index = 0; - return CMD_SUCCESS; } @@ -2578,8 +2515,6 @@ DEFUN (config_log_syslog, { int idx_log_levels = 2; - disable_log_file(); - if (argc == 3) { int level; if ((level = level_match(argv[idx_log_levels]->arg)) @@ -2946,7 +2881,7 @@ void cmd_init(int terminal) #endif } -void cmd_terminate() +void cmd_terminate(void) { struct cmd_node *cmd_node; |
