]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: handle seqnum wrapping
authorDinesh Dutt <ddutt@cumulusnetworks.com>
Sat, 24 Aug 2013 08:00:44 +0000 (08:00 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 8 Nov 2013 02:15:43 +0000 (18:15 -0800)
Signed-off-by: Shrijeet Mukherjee <shm at cumulusnetworks.com>
Reviewed-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
[DL: mechanical adjust to rebase]
[DL: adjust to removal of timerwheel code]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospf6d/ospf6_flood.c
ospf6d/ospf6_lsa.h
ospf6d/ospf6_lsdb.c

index e02a432f96ce2b64fcda988f92e1b8a58888d334..7f6b2850c1b93b015d837cfbb8aaf778ac87f2b4 100644 (file)
@@ -230,6 +230,25 @@ ospf6_install_lsa (struct ospf6_lsa *lsa)
   else
     lsa->expire = NULL;
 
+  if (OSPF6_LSA_IS_SEQWRAP(lsa) &&
+      ! (CHECK_FLAG(lsa->flag,OSPF6_LSA_SEQWRAPPED) &&
+         lsa->header->seqnum == htonl(OSPF_MAX_SEQUENCE_NUMBER)))
+   {
+     if (IS_OSPF6_DEBUG_EXAMIN_TYPE (lsa->header->type))
+       zlog_debug("lsa install wrapping: sequence 0x%x",
+                  ntohl(lsa->header->seqnum));
+     SET_FLAG(lsa->flag, OSPF6_LSA_SEQWRAPPED);
+     /* in lieu of premature_aging, since we do not want to recreate this lsa
+      * and/or mess with timers etc, we just want to wrap the sequence number
+      * and reflood the lsa before continuing.
+      * NOTE: Flood needs to be called right after this function call, by the
+      * caller
+      */
+     lsa->header->seqnum = htonl (OSPF_MAX_SEQUENCE_NUMBER);
+     lsa->header->age = htons (OSPF_LSA_MAXAGE);
+     ospf6_lsa_checksum (lsa->header);
+   }
+
   /* actually install */
   lsa->installed = now;
   ospf6_lsdb_add (lsa, lsa->lsdb);
index 998599ba4c9e91d44adcb840be04c66c5e5d22a5..ffd6ae0aaa292d13401ba678b1bb692806e79229 100644 (file)
@@ -109,6 +109,8 @@ struct ospf6_lsa_header
 #define OSPF6_LSA_IS_DIFFER(L1, L2)  ospf6_lsa_is_differ (L1, L2)
 #define OSPF6_LSA_IS_MAXAGE(L) (ospf6_lsa_age_current (L) == OSPF_LSA_MAXAGE)
 #define OSPF6_LSA_IS_CHANGED(L1, L2) ospf6_lsa_is_changed (L1, L2)
+#define OSPF6_LSA_IS_SEQWRAP(L) ((L)->header->seqnum == htonl(OSPF_MAX_SEQUENCE_NUMBER + 1))
+
 
 struct ospf6_lsa
 {
@@ -139,6 +141,7 @@ struct ospf6_lsa
 #define OSPF6_LSA_FLOODBACK  0x02
 #define OSPF6_LSA_DUPLICATE  0x04
 #define OSPF6_LSA_IMPLIEDACK 0x08
+#define OSPF6_LSA_SEQWRAPPED 0x20
 
 struct ospf6_lsa_handler
 {
index b13ae9b1fe2d6bcca9b229c10e6d19b1c017a0f7..5138d1c1cfdeb137e0f4bc956522c12cbc3246c5 100644 (file)
@@ -465,7 +465,18 @@ ospf6_lsdb_maxage_remover (struct ospf6_lsdb *lsdb)
        }
       if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type))
        zlog_debug ("Remove MaxAge %s", lsa->name);
-      ospf6_lsdb_remove (lsa, lsdb);
+      if (CHECK_FLAG(lsa->flag, OSPF6_LSA_SEQWRAPPED))
+      {
+        UNSET_FLAG(lsa->flag, OSPF6_LSA_SEQWRAPPED);
+        /*
+         * lsa->header->age = 0;
+         */
+        lsa->header->seqnum = htonl(OSPF_MAX_SEQUENCE_NUMBER + 1);
+        ospf6_lsa_checksum (lsa->header);
+        thread_execute (master, ospf6_lsa_refresh, lsa, 0);
+      } else {
+        ospf6_lsdb_remove (lsa, lsdb);
+      }
     }
 
   return (reschedule);