mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 11:18:43 +00:00
bgpd: add neighbor autoshutdown
Adds ability to specify that peers should be administratively shutdown when first configured. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
89898ced5f
commit
f26845f9a6
@ -2677,6 +2677,19 @@ static int peer_remote_as_vty(struct vty *vty, const char *peer_str,
|
|||||||
return bgp_vty_return(vty, ret);
|
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,
|
DEFUN (neighbor_remote_as,
|
||||||
neighbor_remote_as_cmd,
|
neighbor_remote_as_cmd,
|
||||||
"neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>",
|
"neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>",
|
||||||
@ -3223,7 +3236,6 @@ DEFUN (no_neighbor_password,
|
|||||||
return bgp_vty_return(vty, ret);
|
return bgp_vty_return(vty, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DEFUN (neighbor_activate,
|
DEFUN (neighbor_activate,
|
||||||
neighbor_activate_cmd,
|
neighbor_activate_cmd,
|
||||||
"neighbor <A.B.C.D|X:X::X:X|WORD> activate",
|
"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, &bgp_listen_range_cmd);
|
||||||
install_element(BGP_NODE, &no_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. */
|
/* "neighbor remote-as" commands. */
|
||||||
install_element(BGP_NODE, &neighbor_remote_as_cmd);
|
install_element(BGP_NODE, &neighbor_remote_as_cmd);
|
||||||
install_element(BGP_NODE, &neighbor_interface_config_cmd);
|
install_element(BGP_NODE, &neighbor_interface_config_cmd);
|
||||||
|
@ -1497,8 +1497,11 @@ struct peer *peer_create(union sockunion *su, const char *conf_if,
|
|||||||
peer_af_create(peer, afi, safi);
|
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. */
|
/* Set up peer's events and timers. */
|
||||||
if (!active && peer_active(peer))
|
else if (!active && peer_active(peer))
|
||||||
bgp_timer_set(peer);
|
bgp_timer_set(peer);
|
||||||
|
|
||||||
return peer;
|
return peer;
|
||||||
@ -7140,6 +7143,10 @@ int bgp_config_write(struct vty *vty)
|
|||||||
vty_out(vty, " bgp default subgroup-pkt-queue-max %u\n",
|
vty_out(vty, " bgp default subgroup-pkt-queue-max %u\n",
|
||||||
bgp->default_subgroup_pkt_queue_max);
|
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. */
|
/* BGP client-to-client reflection. */
|
||||||
if (bgp_flag_check(bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT))
|
if (bgp_flag_check(bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT))
|
||||||
vty_out(vty, " no bgp client-to-client reflection\n");
|
vty_out(vty, " no bgp client-to-client reflection\n");
|
||||||
|
@ -386,6 +386,9 @@ struct bgp {
|
|||||||
/* Actual coalesce time */
|
/* Actual coalesce time */
|
||||||
uint32_t coalesce_time;
|
uint32_t coalesce_time;
|
||||||
|
|
||||||
|
/* Auto-shutdown new peers */
|
||||||
|
bool autoshutdown;
|
||||||
|
|
||||||
u_int32_t addpath_tx_id;
|
u_int32_t addpath_tx_id;
|
||||||
int addpath_tx_used[AFI_MAX][SAFI_MAX];
|
int addpath_tx_used[AFI_MAX][SAFI_MAX];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user