Merge pull request #1627 from qlyoung/bgp-autoshutdown

BGP auto-shutdown
This commit is contained in:
Russ White 2018-01-16 15:29:17 -05:00 committed by GitHub
commit 7256280c1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 2 deletions

View File

@ -2692,6 +2692,19 @@ static int peer_remote_as_vty(struct vty *vty, const char *peer_str,
return bgp_vty_return(vty, ret);
}
DEFUN (bgp_default_shutdown,
bgp_default_shutdown_cmd,
"[no] bgp default shutdown",
NO_STR
BGP_STR
"Configure BGP defaults\n"
"Do not automatically activate peers upon configuration\n")
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
bgp->autoshutdown = !strmatch(argv[0]->text, "no");
return CMD_SUCCESS;
}
DEFUN (neighbor_remote_as,
neighbor_remote_as_cmd,
"neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>",
@ -3238,7 +3251,6 @@ DEFUN (no_neighbor_password,
return bgp_vty_return(vty, ret);
}
DEFUN (neighbor_activate,
neighbor_activate_cmd,
"neighbor <A.B.C.D|X:X::X:X|WORD> activate",
@ -11555,6 +11567,9 @@ void bgp_vty_init(void)
install_element(BGP_NODE, &bgp_listen_range_cmd);
install_element(BGP_NODE, &no_bgp_listen_range_cmd);
/* "neighbors auto-shutdown" command */
install_element(BGP_NODE, &bgp_default_shutdown_cmd);
/* "neighbor remote-as" commands. */
install_element(BGP_NODE, &neighbor_remote_as_cmd);
install_element(BGP_NODE, &neighbor_interface_config_cmd);

View File

@ -1495,8 +1495,11 @@ struct peer *peer_create(union sockunion *su, const char *conf_if,
peer_af_create(peer, afi, safi);
}
/* auto shutdown if configured */
if (bgp->autoshutdown)
peer_flag_set(peer, PEER_FLAG_SHUTDOWN);
/* Set up peer's events and timers. */
if (!active && peer_active(peer))
else if (!active && peer_active(peer))
bgp_timer_set(peer);
return peer;
@ -7146,6 +7149,10 @@ int bgp_config_write(struct vty *vty)
vty_out(vty, " bgp default subgroup-pkt-queue-max %u\n",
bgp->default_subgroup_pkt_queue_max);
/* BGP default autoshutdown neighbors */
if (bgp->autoshutdown)
vty_out(vty, " bgp default auto-shutdown\n");
/* BGP client-to-client reflection. */
if (bgp_flag_check(bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT))
vty_out(vty, " no bgp client-to-client reflection\n");

View File

@ -390,6 +390,9 @@ struct bgp {
/* Actual coalesce time */
uint32_t coalesce_time;
/* Auto-shutdown new peers */
bool autoshutdown;
u_int32_t addpath_tx_id;
int addpath_tx_used[AFI_MAX][SAFI_MAX];