]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Fix bgp auto-shutdown behavior
authorPascal Mathis <mail@pascalmathis.com>
Sat, 7 Jul 2018 11:14:55 +0000 (13:14 +0200)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Sun, 2 Jun 2019 20:03:49 +0000 (23:03 +0300)
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 3d7a0f32c05f5b409b7552c8c375cd9de418ab28..8e25463e87d945f935b7730c824145ab81086851 100644 (file)
@@ -7589,10 +7589,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");
@@ -7746,6 +7742,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");