From: Russ White Date: Mon, 29 Jan 2018 13:25:49 +0000 (-0500) Subject: Merge pull request #1679 from qlyoung/revert-remove-options-directly-connected X-Git-Tag: frr-4.0-dev~18 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=983976514f51b10ad30d050d5a3cb9f8b92c5a57;hp=08c9af9375a8555edc180fab4ca5ba385a2b7ec3;p=mirror_frr.git Merge pull request #1679 from qlyoung/revert-remove-options-directly-connected Revert "bgpd: disallow invalid config at cli layer" --- diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 83842e576..38bc45728 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -3415,6 +3415,18 @@ static int peer_flag_modify_vty(struct vty *vty, const char *ip_str, if (!peer) return CMD_WARNING_CONFIG_FAILED; + /* + * If 'neighbor ', then this is for directly connected peers, + * we should not accept disable-connected-check. + */ + if (peer->conf_if && (flag == PEER_FLAG_DISABLE_CONNECTED_CHECK)) { + vty_out(vty, + "%s is directly connected peer, cannot accept disable-" + "connected-check\n", + ip_str); + return CMD_WARNING_CONFIG_FAILED; + } + if (!set && flag == PEER_FLAG_SHUTDOWN) peer_tx_shutdown_message_unset(peer); @@ -4505,9 +4517,9 @@ DEFUN (no_neighbor_ebgp_multihop, /* disable-connected-check */ DEFUN (neighbor_disable_connected_check, neighbor_disable_connected_check_cmd, - "neighbor ", + "neighbor ", NEIGHBOR_STR - NEIGHBOR_ADDR_STR + NEIGHBOR_ADDR_STR2 "one-hop away EBGP peer using loopback address\n" "Enforce EBGP neighbors perform multihop\n") { @@ -4518,10 +4530,10 @@ DEFUN (neighbor_disable_connected_check, DEFUN (no_neighbor_disable_connected_check, no_neighbor_disable_connected_check_cmd, - "no neighbor ", + "no neighbor ", NO_STR NEIGHBOR_STR - NEIGHBOR_ADDR_STR + NEIGHBOR_ADDR_STR2 "one-hop away EBGP peer using loopback address\n" "Enforce EBGP neighbors perform multihop\n") { @@ -5960,9 +5972,9 @@ ALIAS_HIDDEN( DEFUN (neighbor_ttl_security, neighbor_ttl_security_cmd, - "neighbor ttl-security hops (1-254)", + "neighbor ttl-security hops (1-254)", NEIGHBOR_STR - NEIGHBOR_ADDR_STR + NEIGHBOR_ADDR_STR2 "BGP ttl-security parameters\n" "Specify the maximum number of hops to the BGP peer\n" "Number of hops to BGP peer\n") @@ -5978,15 +5990,26 @@ DEFUN (neighbor_ttl_security, gtsm_hops = strtoul(argv[idx_number]->arg, NULL, 10); + /* + * If 'neighbor swpX', then this is for directly connected peers, + * we should not accept a ttl-security hops value greater than 1. + */ + if (peer->conf_if && (gtsm_hops > 1)) { + vty_out(vty, + "%s is directly connected peer, hops cannot exceed 1\n", + argv[idx_peer]->arg); + return CMD_WARNING_CONFIG_FAILED; + } + return bgp_vty_return(vty, peer_ttl_security_hops_set(peer, gtsm_hops)); } DEFUN (no_neighbor_ttl_security, no_neighbor_ttl_security_cmd, - "no neighbor ttl-security hops (1-254)", + "no neighbor ttl-security hops (1-254)", NO_STR NEIGHBOR_STR - NEIGHBOR_ADDR_STR + NEIGHBOR_ADDR_STR2 "BGP ttl-security parameters\n" "Specify the maximum number of hops to the BGP peer\n" "Number of hops to BGP peer\n")