[quagga-dev 12182] [PATCH 2/2] bgpd/GR: Try tidy the logic for suppressing updates while waiting on EoR

Paul Jakma paul at opensourcerouting.org
Mon Apr 27 16:36:10 BST 2015


Again, untested. The current logic doesn't quite make sense to me.

* bgp_packet.c: (bgp_write_packet) Try tidy up the logic on when update
  sending should be suppressed, when graceful-restart is enabled.  The RFC
  suggests to me that advertisements should be suppressed by the restarting
  speaker only when the remote peer has not restarted, until such time as
  the EoR has been received from the remote peer.
---
 bgpd/bgp_packet.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 0a916d0..2605e1f 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -613,19 +613,20 @@ bgp_write_packet (struct peer *peer)
 	      {
 		if (CHECK_FLAG (adv->binfo->peer->cap, PEER_CAP_RESTART_RCV)
 		    && CHECK_FLAG (adv->binfo->peer->cap, PEER_CAP_RESTART_ADV)
-		    && ! (CHECK_FLAG (adv->binfo->peer->cap,
-                                      PEER_CAP_RESTART_BIT_RCV) &&
-		          CHECK_FLAG (adv->binfo->peer->cap,
-                                      PEER_CAP_RESTART_BIT_ADV))
-		    && ! CHECK_FLAG (adv->binfo->flags, BGP_INFO_STALE)
 		    && safi != SAFI_MPLS_VPN)
-		  {
-		    if (CHECK_FLAG (adv->binfo->peer->af_sflags[afi][safi],
-			PEER_STATUS_EOR_RECEIVED))
-		      s = bgp_update_packet (peer, afi, safi);
-		  }
-		else
-		  s = bgp_update_packet (peer, afi, safi);
+                  {
+                    /* For graceful restart, we defer sending updates if we've
+                     * restarted and other side hasn't, until EoR comes in.
+                     */   
+                    if (CHECK_FLAG (adv->binfo->peer->cap,
+                                    PEER_CAP_RESTART_BIT_ADV
+                        && !CHECK_FLAG (adv->binfo->peer->cap,
+                                        PEER_CAP_RESTART_BIT_RCV)
+                        && !CHECK_FLAG (adv->binfo->peer->af_sflags[afi][safi],
+                                        PEER_STATUS_EOR_RECEIVED)))
+                      continue;
+                  }
+                s = bgp_update_packet (peer, afi, safi);
 	      }
 
 	    if (s)
-- 
2.1.0





More information about the Quagga-dev mailing list