summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_route.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 02:40:33 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-05-20 02:40:33 +0200
commitf188f2c424e8cf37517e68c09ca93329aa4297aa (patch)
tree645f84ac58504781ccbb89af8f4c5874e3d24052 /bgpd/bgp_route.c
parentbgpd: bgpd-restart-bit-fix.patch (diff)
downloadfrr-f188f2c424e8cf37517e68c09ca93329aa4297aa.tar.xz
frr-f188f2c424e8cf37517e68c09ca93329aa4297aa.zip
bgpd: bgpd-update-delay.patch
COMMAND: 'update-delay <max-delay in seconds> [<establish-wait in seconds>]' DESCRIPTION: This feature is used to enable read-only mode on BGP process restart or when BGP process is cleared using 'clear ip bgp *'. When applicable, read-only mode would begin as soon as the first peer reaches Established state and a timer for <max-delay> seconds is started. During this mode BGP doesn't run any best-path or generate any updates to its peers. This mode continues until: 1. All the configured peers, except the shutdown peers, have sent explicit EOR (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached Established is considered an implicit-EOR. If the <establish-wait> optional value is given, then BGP will wait for peers to reach establish from the begining of the update-delay till the establish-wait period is over, i.e. the minimum set of established peers for which EOR is expected would be peers established during the establish-wait window, not necessarily all the configured neighbors. 2. max-delay period is over. On hitting any of the above two conditions, BGP resumes the decision process and generates updates to its peers. Default <max-delay> is 0, i.e. the feature is off by default. This feature can be useful in reducing CPU/network used as BGP restarts/clears. Particularly useful in the topologies where BGP learns a prefix from many peers. Intermediate bestpaths are possible for the same prefix as peers get established and start receiving updates at different times. This feature should offer a value-add if the network has a high number of such prefixes. IMPLEMENTATION OBJECTIVES: Given this is an optional feature, minimized the code-churn. Used existing constructs wherever possible (existing queue-plug/unplug were used to achieve delay and resume of best-paths/update-generation). As a result, no new data-structure(s) had to be defined and allocated. When the feature is disabled, the new node is not exercised for the most part. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com> Dinesh Dutt <ddutt@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r--bgpd/bgp_route.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 6397c5509..15c3b6eab 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1664,7 +1664,7 @@ bgp_processq_del (struct work_queue *wq, void *data)
XFREE (MTYPE_BGP_PROCESS_QUEUE, pq);
}
-static void
+void
bgp_process_queue_init (void)
{
bm->process_main_queue
@@ -2605,9 +2605,19 @@ bgp_announce_table (struct peer *peer, afi_t afi, safi_t safi,
if (! table)
table = (rsclient) ? peer->rib[afi][safi] : peer->bgp->rib[afi][safi];
- if (safi != SAFI_MPLS_VPN
- && CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
- bgp_default_originate (peer, afi, safi, 0);
+ if (safi != SAFI_MPLS_VPN)
+ {
+ if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
+ {
+ bgp_default_originate (peer, afi, safi, 0);
+ }
+ else
+ {
+ /* Send the withdraw if it was postponed during read-only mode. */
+ if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
+ bgp_default_originate (peer, afi, safi, 1);
+ }
+ }
/* It's initialized in bgp_announce_[check|check_rsclient]() */
attr.extra = &extra;
@@ -2659,6 +2669,9 @@ bgp_announce_route_all (struct peer *peer)
afi_t afi;
safi_t safi;
+ if (bgp_update_delay_active(peer->bgp))
+ return;
+
for (afi = AFI_IP; afi < AFI_MAX; afi++)
for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
bgp_announce_route (peer, afi, safi);