]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: run DR election prior to LSA regeneration
authorChristian Franke <chris@opensourcerouting.org>
Wed, 10 Jul 2013 11:56:18 +0000 (11:56 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 14 May 2014 14:46:08 +0000 (16:46 +0200)
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@opensourcerouting.org>
Acked-by: Feng Lu <lu.feng@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospfd/ospf_nsm.c

index fe4ddf5b2a3e7e69d90155726e3ca48a1fd23b8b..bcabd5f70120aa53dcb6bc8fe3e20b48c3aecee1 100644 (file)
@@ -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? */
 }