]> git.puffer.fish Git - mirror/frr.git/commitdiff
[ospfd] Fix bad SPF calculation on some topologies - incorrect sorting
authorPaul Jakma <paul.jakma@sun.com>
Mon, 6 Aug 2007 18:52:45 +0000 (18:52 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Mon, 6 Aug 2007 18:52:45 +0000 (18:52 +0000)
2007-08-07 Atis Elsts <atis@mikrotik.com>

* ospf_spf.c: (ospf_spf_next) Sort heap in correct direction
  after vertex cost is changed, thus fixing incorrect SPF
  calculation on certain topologies.
* lib/pqueue.{c,h}: Export trickle_up

lib/ChangeLog
lib/pqueue.c
lib/pqueue.h
ospfd/ChangeLog
ospfd/ospf_spf.c

index 41689d038729378c832bf023d38e7a1f1d9f0bba..ee32911465157a10e30f10cf21652e8ebf650c55 100644 (file)
@@ -1,3 +1,7 @@
+2007-07-06 Atis Elsts <atis@mikrotik.com>
+
+       * pqueue.{c,h}: Export trickle_up
+
 2007-07-26  Paul Jakma <paul.jakma@sun.com>
 
        * log.c: (mes_lookup) warning about code not being in same-number
index a974a49e67db2850a216a3bccf0657d877d6f60d..12a779f2a7bb015eedca94f4b3b4a80417da6b73 100644 (file)
@@ -42,7 +42,7 @@ Boston, MA 02111-1307, USA.  */
 #define RIGHT_OF(x) (2 * x + 2)
 #define HAVE_CHILD(x,q) (x < (q)->size / 2)
 
-static void
+void
 trickle_up (int index, struct pqueue *queue)
 {
   void *tmp;
index 1f3201b9f3c75831bb0b85a5394a116c5fca9f62..be37f98da08235c71c5e1b64d8d52ecbaa618a1d 100644 (file)
@@ -40,5 +40,6 @@ extern void pqueue_enqueue (void *data, struct pqueue *queue);
 extern void *pqueue_dequeue (struct pqueue *queue);
 
 extern void trickle_down (int index, struct pqueue *queue);
+extern void trickle_up (int index, struct pqueue *queue);
 
 #endif /* _ZEBRA_PQUEUE_H */
index bb0e90834c433d3d88d7e17ad34fcf3f3ef219bd..422208e886db3c842316f0edb6a5980e77f158e3 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-07 Atis Elsts <atis@mikrotik.com>
+
+       * ospf_spf.c: (ospf_spf_next) Sort heap in correct direction
+         after vertex cost is changed, thus fixing incorrect SPF
+         calculation on certain topologies.
+
 2007-08-06 Paul Jakma <paul.jakma@sun.com>
 
        * ospf_lsa.c: (router_lsa_flags) Bug #331, NSSA regression caused
index 51e338323ecb96dd4a0ed5c484cf3ed8fab3d181..41288f1efb2a4a78fc2fb6d6b432178d3dbcbf7c 100644 (file)
@@ -896,9 +896,12 @@ ospf_spf_next (struct vertex *v, struct ospf_area *area,
                * will flush the old parents
                */
               if (ospf_nexthop_calculation (area, v, w, l, distance))
-                /* Decrease the key of the node in the heap,
-                 * re-sort the heap. */
-                trickle_down (w_lsa->stat, candidate);
+                /* Decrease the key of the node in the heap.
+                 * trickle-sort it up towards root, just in case this
+                 * node should now be the new root due the cost change. 
+                 * (pqueu_{de,en}queue 
+                 */
+                trickle_up (w_lsa->stat, candidate);
             }
         } /* end W is already on the candidate list */
     } /* end loop over the links in V's LSA */