Hey David,

To follow-up on an off-list discussion we had on GR, here's that tweak.

I gather you're also concerned about internal queueing and batching to minimise CPU churn.

This patch set doesn't co-ordinate tracking of EoR-received state across all peers, but the current code doesn't have that either, and this set shouldn't of itself be an impediment to that.

commit 97dc9be5a0ae9ec3b3212d566ba56a39d2dae17e
Author: Paul Jakma <[email protected]>
Date:   Fri May 8 22:03:48 2015 +0100

    bgpd: Stateful GR R-bit flag should only apply to boot-up peers

    As noted by David Lamparter, the stateful R-bit flag, to ensure R-bit was
    set for the first session to peers, also would apply to peers added later.
    Which just doesn't make sense - having added a peer means you havn't
    restarted per se.  Limit it to peers created from the config file.

    Note, there's still a slight race in that a peer could be configured
    immediately after start-up, but before the boot-peers have synced up, but
    hey.  Rare case.  To fix that, the R-bit needs to become dependent on an
    additional bit of global state: whether all EoRs have been received yet from
    non-restarted peers.

    * bgpd.h: (struct bgp_master), add a global flag to indicate when the
      config file has been read.
    * bgp_main.c: (main) Set it after vty_read_config is done.
    * bgpd.c: (peer_new) Only set the state flag to set the GR R-bit for peers
      that are being created while reading the config file.

diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 5026b5e..70f5ce8 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -433,7 +433,8 @@ main (int argc, char **argv)

   /* Parse config file. */
   vty_read_config (config_file, config_default);
-
+  bm->config_file_done = true;
+
   /* Start execution only if not in dry-run mode */
   if(dryrun)
     return(0);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 5c2d880..f515137 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -827,8 +827,11 @@ peer_new (struct bgp *bgp)
        peer->orf_plist[afi][safi] = NULL;
       }
   SET_FLAG (peer->sflags, PEER_STATUS_CAPABILITY_OPEN);
-  SET_FLAG (peer->sflags, PEER_STATUS_GR_SEND_R_BIT);
- + + /* Interactively configured peers shouldn't be told we've restarted */
+  if (!bm->config_file_done)
+    SET_FLAG (peer->sflags, PEER_STATUS_GR_SEND_R_BIT);
+
   /* Create buffers.  */
   peer->ibuf = stream_new (BGP_MAX_PACKET_SIZE);
   peer->obuf = stream_fifo_new ();
@@ -5396,6 +5399,7 @@ bgp_master_init (void)
   bm->port = BGP_PORT_DEFAULT;
   bm->master = thread_master_create ();
   bm->start_time = bgp_clock ();
+  bm->config_file_done = false;
 }


diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 8cfb81b..3e855d4 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -60,6 +60,8 @@ struct bgp_master
 #define BGP_OPT_MULTIPLE_INSTANCE        (1 << 1)
 #define BGP_OPT_CONFIG_CISCO             (1 << 2)
 #define BGP_OPT_NO_LISTEN                (1 << 3)
+
+  bool config_file_done;
 };

 /* BGP instance structure.  */

--
Paul Jakma      [email protected]  @pjakma Key ID: 64A2FF6A
Fortune:
disks spinning backwards - toggle the hemisphere jumper.

_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to