From 638dc8281d2ee2fd567e71d5ddbc40644378d9cb Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 19 May 2015 18:03:55 -0700 Subject: [PATCH] bgpd-ensure-fast-eor-send.patch BGP: Ensure EOR is always sent immediately after all prefixes have been adv. Its possible that EOR send is delayed until the next KeepAlive timer fires. This can happen when the send update iteration precisely matches the last update packet sent. After this since there are no more updates to be sent, no write thread is setup, but there's still the EOR to be sent. Therefore, EOR is not sent right away causing some neighbors to not exit RO mode and delaying convergence overall. This patch ensures that EOR is sent at the end of all updates on startup. Signed-off-by: Vivek Venkataraman Signed-off-by: Dinesh G Dutt --- bgpd/bgp_packet.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 5116787830..e03c9a1f70 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -281,6 +281,7 @@ bgp_write_proceed_actions (struct peer *peer) struct peer_af *paf; struct bpacket *next_pkt; int fullq_found = 0; + struct update_subgroup *subgrp; if (stream_fifo_head (peer->obuf)) { @@ -294,23 +295,43 @@ bgp_write_proceed_actions (struct peer *peer) paf = peer_af_find (peer, afi, safi); if (!paf) continue; + subgrp = paf->subgroup; + if (!subgrp) + continue; + next_pkt = paf->next_pkt_to_send; if (next_pkt && next_pkt->buffer) { BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd); return; } + /* No packets readily available for AFI/SAFI, are there subgroup packets * that need to be generated? */ - if (paf->subgroup && - bpacket_queue_is_full(SUBGRP_INST(paf->subgroup), - SUBGRP_PKTQ(paf->subgroup))) + if (bpacket_queue_is_full(SUBGRP_INST(subgrp), + SUBGRP_PKTQ(subgrp))) fullq_found = 1; - else if (subgroup_packets_to_build (paf->subgroup)) + else if (subgroup_packets_to_build (subgrp)) { BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd); return; } + + /* No packets to send, see if EOR is pending */ + if (CHECK_FLAG (peer->cap, PEER_CAP_RESTART_RCV)) + { + if (!subgrp->t_coalesce && + peer->afc_nego[afi][safi] && + peer->synctime && + !CHECK_FLAG(peer->af_sflags[afi][safi], + PEER_STATUS_EOR_SEND) && + safi != SAFI_MPLS_VPN) + { + BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd); + return; + } + + } } if (fullq_found) { -- 2.39.5