Skip to content
Browse files

bgpd: Fix bgp auto-shutdown behavior

The current behavior of the `bgp default shutdown` command is to set the
state of all newly configured peers to shutdown. This leads to a problem
when restarting bgpd, because all peers will then be seen as newly
configured, which leads to all peers being set to shutdown after each

This behavior is undesired and not common when comparing the
implementation against other vendors. This commit moves the `bgp default
shutdown` configuration underneath the peer-group and peer
configuration, to ensure that existing peers will not be set to shutdown
after a daemon restart.

Signed-off-by: Pascal Mathis <>
  • Loading branch information...
ppmathis committed Jul 7, 2018
1 parent 76f17a8 commit 76af525b645a22498146a72053a0a541298c25e6
Showing with 10 additions and 4 deletions.
  1. +10 −4 bgpd/bgpd.c
@@ -7649,10 +7649,6 @@ int bgp_config_write(struct vty *vty)
vty_out(vty, " bgp default subgroup-pkt-queue-max %u\n",

/* BGP default autoshutdown neighbors */
if (bgp->autoshutdown)
vty_out(vty, " bgp default 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");
@@ -7806,6 +7802,16 @@ int bgp_config_write(struct vty *vty)
/* listen range and limit for dynamic BGP neighbors */
bgp_config_write_listen(vty, bgp);

* BGP default autoshutdown neighbors
* This must be placed after any peer and peer-group
* configuration, to avoid setting all peers to shutdown after
* a daemon restart, which is undesired behavior. (see #2286)
if (bgp->autoshutdown)
vty_out(vty, " bgp default shutdown\n");

/* No auto-summary */
if (bgp_option_check(BGP_OPT_CONFIG_CISCO))
vty_out(vty, " no auto-summary\n");

0 comments on commit 76af525

Please sign in to comment.
You can’t perform that action at this time.