diff options
| -rw-r--r-- | bgpd/bgp_vty.c | 18 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 24 | ||||
| -rw-r--r-- | bgpd/bgpd.h | 9 | ||||
| -rw-r--r-- | doc/user/bgp.rst | 5 | ||||
| -rw-r--r-- | zebra/zserv.c | 3 |
5 files changed, 57 insertions, 2 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 955e73fcf3..e840f8bceb 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1514,6 +1514,18 @@ void cli_show_router_bgp_router_id(struct vty *vty, struct lyd_node *dnode, vty_out(vty, " bgp router-id %s\n", yang_dnode_get_string(dnode, NULL)); } +DEFPY (bgp_global_suppress_fib_pending, + bgp_global_suppress_fib_pending_cmd, + "[no] bgp suppress-fib-pending", + NO_STR + BGP_STR + "Advertise only routes that are programmed in kernel to peers globally\n") +{ + bm_wait_for_fib_set(!no); + + return CMD_SUCCESS; +} + DEFPY (bgp_suppress_fib_pending, bgp_suppress_fib_pending_cmd, "[no] bgp suppress-fib-pending", @@ -16936,6 +16948,9 @@ int bgp_config_write(struct vty *vty) vty_out(vty, "\n"); } + if (bm->wait_for_fib) + vty_out(vty, "bgp suppress-fib-pending\n"); + if (CHECK_FLAG(bm->flags, BM_FLAG_GRACEFUL_SHUTDOWN)) vty_out(vty, "bgp graceful-shutdown\n"); @@ -17464,6 +17479,9 @@ void bgp_vty_init(void) install_element(CONFIG_NODE, &bgp_local_mac_cmd); install_element(CONFIG_NODE, &no_bgp_local_mac_cmd); + /* "bgp suppress-fib-pending" global */ + install_element(CONFIG_NODE, &bgp_global_suppress_fib_pending_cmd); + /* bgp route-map delay-timer commands. */ install_element(CONFIG_NODE, &bgp_set_route_map_delay_timer_cmd); install_element(CONFIG_NODE, &no_bgp_set_route_map_delay_timer_cmd); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index d3db540871..22c1caacad 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -393,6 +393,29 @@ void bgp_router_id_static_set(struct bgp *bgp, struct in_addr id) true /* is config */); } +void bm_wait_for_fib_set(bool set) +{ + bool send_msg = false; + + if (bm->wait_for_fib == set) + return; + + bm->wait_for_fib = set; + if (set) { + if (bgp_suppress_fib_count == 0) + send_msg = true; + bgp_suppress_fib_count++; + } else { + bgp_suppress_fib_count--; + if (bgp_suppress_fib_count == 0) + send_msg = true; + } + + if (send_msg && zclient) + zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST, + zclient, set); +} + /* Set the suppress fib pending for the bgp configuration */ void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set) { @@ -7419,6 +7442,7 @@ void bgp_master_init(struct thread_master *master, const int buffer_size) bm->terminating = false; bm->socket_buffer = buffer_size; bm->send_extra_data_to_zebra = true; + bm->wait_for_fib = false; bgp_mac_init(); /* init the rd id space. diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 3451a616a4..ebc53fe192 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -159,6 +159,9 @@ struct bgp_master { /* How big should we set the socket buffer size */ uint32_t socket_buffer; + /* Should we do wait for fib install globally? */ + bool wait_for_fib; + /* EVPN multihoming */ struct bgp_evpn_mh_info *mh_info; @@ -719,8 +722,9 @@ struct afi_safi_info { #define BGP_SELECT_DEFER_DISABLE(bgp) \ (CHECK_FLAG(bgp->flags, BGP_FLAG_SELECT_DEFER_DISABLE)) -#define BGP_SUPPRESS_FIB_ENABLED(bgp) \ - (CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING)) +#define BGP_SUPPRESS_FIB_ENABLED(bgp) \ + (CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING) \ + || bm->wait_for_fib) /* BGP peer-group support. */ struct peer_group { @@ -1879,6 +1883,7 @@ extern int bgp_handle_socket(struct bgp *bgp, struct vrf *vrf, extern void bgp_router_id_zebra_bump(vrf_id_t, const struct prefix *); extern void bgp_router_id_static_set(struct bgp *, struct in_addr); +extern void bm_wait_for_fib_set(bool set); extern void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set); extern int bgp_cluster_id_set(struct bgp *, struct in_addr *); extern int bgp_cluster_id_unset(struct bgp *); diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst index 288b955c27..c65f1144eb 100644 --- a/doc/user/bgp.rst +++ b/doc/user/bgp.rst @@ -3523,6 +3523,11 @@ status in FIB: .. index:: bgp suppress-fib-pending .. clicmd:: [no] bgp suppress-fib-pending + This command is applicable at the global level and at an individual + bgp level. If applied at the global level all bgp instances will + wait for fib installation before announcing routes and there is no + way to turn it off for a particular bgp vrf. + .. _routing-policy: Routing Policy diff --git a/zebra/zserv.c b/zebra/zserv.c index c7b9433257..484d94fac8 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1033,6 +1033,9 @@ static void zebra_show_client_detail(struct vty *vty, struct zserv *client) } else vty_out(vty, "Not registered for Nexthop Updates\n"); + vty_out(vty, "Client will %sbe notified about it's routes status\n", + client->notify_owner ? "" : "Not "); + last_read_time = (time_t)atomic_load_explicit(&client->last_read_time, memory_order_relaxed); last_write_time = (time_t)atomic_load_explicit(&client->last_write_time, |
