[quagga-dev 10593] [PATCH 2/2] ospfd: run DR election prior to LSA regeneration

Christian Franke chris at opensourcerouting.org
Wed Jul 10 13:56:18 BST 2013


The results from DR election are used when constructing router-LSAs.
E.g. they are used to determine whether a broadcast interface should
be added with a link type of stub interface or transit interface.

Therefore, we should run DR election prior before regenerating LSAs.

Before commit c363d3861b5384a31465a72ddc3b0f6ff007a95a the DR election
was called synchronously prior to router-LSA regeneration which was run
asynchronously.

This fixes bug #761 on the Quagga bugzilla.

Signed-off-by: Christian Franke <chris at opensourcerouting.org>
---
 ospfd/ospf_nsm.c |   33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index fe4ddf5..bcabd5f 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -661,6 +661,25 @@ nsm_change_state (struct ospf_neighbor *nbr, int state)
   if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
     vl_area = ospf_area_lookup_by_area_id (oi->ospf, oi->vl_data->vl_area_id);
 
+  /* Generate NeighborChange ISM event.
+   *
+   * In response to NeighborChange, DR election is rerun. The information
+   * from the election process is required by the router-lsa construction.
+   *
+   * Therefore, trigger the event prior to refreshing the LSAs. */
+  switch (oi->state) {
+  case ISM_DROther:
+  case ISM_Backup:
+  case ISM_DR:
+    if ((old_state < NSM_TwoWay && state >= NSM_TwoWay) ||
+        (old_state >= NSM_TwoWay && state < NSM_TwoWay))
+      OSPF_ISM_EVENT_EXECUTE (oi, ISM_NeighborChange);
+    break;
+  default:
+    /* ISM_PointToPoint -> ISM_Down, ISM_Loopback -> ISM_Down, etc. */
+    break;
+  }
+
   /* One of the neighboring routers changes to/from the FULL state. */
   if ((old_state != NSM_Full && state == NSM_Full) ||
       (old_state == NSM_Full && state != NSM_Full))
@@ -760,20 +779,6 @@ nsm_change_state (struct ospf_neighbor *nbr, int state)
   if (state == NSM_Down)
     nbr->crypt_seqnum = 0;
   
-  /* Generete NeighborChange ISM event. */
-  switch (oi->state) {
-  case ISM_DROther:
-  case ISM_Backup:
-  case ISM_DR:
-    if ((old_state < NSM_TwoWay && state >= NSM_TwoWay) ||
-        (old_state >= NSM_TwoWay && state < NSM_TwoWay))
-      OSPF_ISM_EVENT_EXECUTE (oi, ISM_NeighborChange);
-    break;
-  default:
-    /* ISM_PointToPoint -> ISM_Down, ISM_Loopback -> ISM_Down, etc. */
-    break;
-  }
-
   /* Preserve old status? */
 }
 
-- 
1.7.10.4





More information about the Quagga-dev mailing list