]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Fix bgp auto-shutdown behavior 2632/head
authorPascal Mathis <mail@pascalmathis.com>
Sat, 7 Jul 2018 11:14:55 +0000 (13:14 +0200)
committerPascal Mathis <mail@pascalmathis.com>
Sat, 7 Jul 2018 11:14:55 +0000 (13:14 +0200)
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
restart.

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 <mail@pascalmathis.com>
bgpd/bgpd.c

index d21c074ccc2cedd3dbd0943d39acee7e9aa92d5e..ed4879146eae5d92cf27d6f7014ea492878c895c 100644 (file)
@@ -7649,10 +7649,6 @@ 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 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");