]> git.puffer.fish Git - mirror/frr.git/commitdiff
[ospfd] draft-ogier-ospf-dbex-opt DB-exchange optimisation
authorPaul Jakma <paul.jakma@sun.com>
Sun, 27 Aug 2006 06:40:04 +0000 (06:40 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Sun, 27 Aug 2006 06:40:04 +0000 (06:40 +0000)
2006-08-03 Paul Jakma <paul.jakma@sun.com>

* ospf_packet.c: (ospf_make_db_desc) Implement
  draft-ogier-ospf-dbex-opt DB-exchange optimisation.

ospfd/ChangeLog
ospfd/ospf_packet.c

index 193f0de5ae6acd62c51ff0b39f31a43b0f125d58..05f96ace29f01ccd8c475231f55baba3636908b5 100644 (file)
@@ -15,6 +15,7 @@
          before deciding whether both sides are done, avoids a
          needless round of empty DD packet exchanges at the end of
          Exchange, hence speeding up ExchangeDone.
+         Implement draft-ogier-ospf-dbex-opt DB-exchange optimisation.
          (ospf_db_desc) use UNSET_FLAG macro.
 
 2006-07-27 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
index 74caaa77c167c8b556851fed934f4e372fb23583..6449e63a79c473316d14b060803e04d91093809e 100644 (file)
@@ -1035,20 +1035,40 @@ ospf_db_desc_proc (struct stream *s, struct ospf_interface *oi,
 
       /* Lookup received LSA, then add LS request list. */
       find = ospf_lsa_lookup_by_header (oi->area, lsah);
-      if (!find || ospf_lsa_more_recent (find, new) < 0)
-       {
-         ospf_ls_request_add (nbr, new);
-         ospf_lsa_discard (new);
-       }
-      else
-       {
-         /* Received LSA is not recent. */
-         if (IS_DEBUG_OSPF_EVENT)
-           zlog_debug ("Packet [DD:RECV]: LSA received Type %d, "
-                      "ID %s is not recent.", lsah->type, inet_ntoa (lsah->id));
-         ospf_lsa_discard (new);
-         continue;
-       }
+      
+      /* ospf_lsa_more_recent is fine with NULL pointers */
+      switch (ospf_lsa_more_recent (find, new))
+        {
+          case -1:
+            /* Neighbour has a more recent LSA, we must request it */
+            ospf_ls_request_add (nbr, new);
+          case 0:
+            /* If we have a copy of this LSA, it's either less recent
+             * and we're requesting it from neighbour (the case above), or
+             * it's as recent and we both have same copy (this case).
+             *
+             * In neither of these two cases is there any point in
+             * describing our copy of the LSA to the neighbour in a
+             * DB-Summary packet, if we're still intending to do so.
+             *
+             * See: draft-ogier-ospf-dbex-opt-00.txt, describing the
+             * backward compatible optimisation to OSPF DB Exchange /
+             * DB Description process implemented here.
+             */
+            if (find)
+              ospf_lsdb_delete (&nbr->db_sum, find);
+            ospf_lsa_discard (new);
+            break;
+          default:
+            /* We have the more recent copy, nothing specific to do:
+             * - no need to request neighbours stale copy
+             * - must leave DB summary list copy alone
+             */
+            if (IS_DEBUG_OSPF_EVENT)
+              zlog_debug ("Packet [DD:RECV]: LSA received Type %d, "
+                         "ID %s is not recent.", lsah->type, inet_ntoa (lsah->id));
+            ospf_lsa_discard (new);
+        }
     }
 
   /* Master */