]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospf6d: reinvoke MaxAge remover thread if not all MaxAge LSAs were flushed.
authorDinesh Dutt <ddutt@cumulusnetworks.com>
Sat, 24 Aug 2013 07:54:17 +0000 (07:54 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 8 Nov 2013 02:15:42 +0000 (18:15 -0800)
MaxAge LSAs are being flushed out only on an event, unlike OSPFv2 where they're flushed out
periodically. This causes certain LSAs to hang around forever, never getting flushed out.
This patch makes flushing out MaxAge LSAs periodic, retriggered after a certain period if
not all MaxAge LSAs were flushed out.

Signed-off-by: Dinesh G Dutt <ddutt at cumulusnetworks.com>
Reviewed-by: Scott Feldman <sfeldma at cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/libospf.h
ospf6d/ospf6_lsdb.c
ospf6d/ospf6_lsdb.h
ospf6d/ospf6_top.c
ospfd/ospfd.c
ospfd/ospfd.h

index 2282c0729695bf06d438259f79e2f20a8a4d2a16..9a60ce9eb5ad77ef6a98ad31fb2fd8383a349ebe 100644 (file)
@@ -77,6 +77,6 @@
 #define OSPF_SPF_MAX_HOLDTIME_DEFAULT      10000
 
 #define OSPF_LSA_MAXAGE_CHECK_INTERVAL         30
-#define OSFP_LSA_MAXAGE_REMOVE_DELAY_DEFAULT   60
+#define OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT   60
 
 #endif /* _LIBOSPFD_H */
index 7455d8353b960690a0be6091de9ab558426fdc9b..0edc7a34c9d34408ca724ca63adbaf287af2c856 100644 (file)
@@ -481,6 +481,29 @@ ospf6_lsdb_remove_all (struct ospf6_lsdb *lsdb)
     ospf6_lsdb_remove (lsa, lsdb);
 }
 
+int
+ospf6_lsdb_maxage_remover (struct ospf6_lsdb *lsdb)
+{
+  int reschedule = 0;
+  struct ospf6_lsa *lsa;
+
+  for (lsa = ospf6_lsdb_head (lsdb); lsa; lsa = ospf6_lsdb_next (lsa))
+    {
+      if (! OSPF6_LSA_IS_MAXAGE (lsa))
+       continue;
+      if (lsa->retrans_count != 0)
+       {
+         reschedule = 1;
+         continue;
+       }
+      if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type))
+       zlog_debug ("Remove MaxAge %s", lsa->name);
+      ospf6_lsdb_remove (lsa, lsdb);
+    }
+
+  return (reschedule);
+}
+
 void
 ospf6_lsdb_show (struct vty *vty, int level,
                  u_int16_t *type, u_int32_t *id, u_int32_t *adv_router,
index 71297daec2cea0a2279bb4d42a6c00c9d61c8f4e..2974ffb1c84ac55cddb40879e0f1d448bb828820 100644 (file)
@@ -34,21 +34,6 @@ struct ospf6_lsdb
   void (*hook_remove) (struct ospf6_lsa *);
 };
 
-#define OSPF6_LSDB_MAXAGE_REMOVER(lsdb)                                  \
-  do {                                                                   \
-    struct ospf6_lsa *lsa;                                               \
-    for (lsa = ospf6_lsdb_head (lsdb); lsa; lsa = ospf6_lsdb_next (lsa)) \
-      {                                                                  \
-        if (! OSPF6_LSA_IS_MAXAGE (lsa))                                 \
-          continue;                                                      \
-        if (lsa->retrans_count != 0)                                     \
-          continue;                                                      \
-        if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type))                 \
-          zlog_debug ("Remove MaxAge %s", lsa->name);                    \
-        ospf6_lsdb_remove (lsa, lsdb);                                   \
-      }                                                                  \
-  } while (0)
-
 /* Function Prototypes */
 extern struct ospf6_lsdb *ospf6_lsdb_create (void *data);
 extern void ospf6_lsdb_delete (struct ospf6_lsdb *lsdb);
index 540ef382ee90ced77a28a71aed81d67b224ed689..e9fe7a4e945f42656a11993cf809a567f0d6c418 100644 (file)
@@ -208,7 +208,7 @@ ospf6_disable (struct ospf6 *o)
     }
 }
 
-static int
+int
 ospf6_maxage_remover (struct thread *thread)
 {
   struct ospf6 *o = (struct ospf6 *) THREAD_ARG (thread);
@@ -216,6 +216,7 @@ ospf6_maxage_remover (struct thread *thread)
   struct ospf6_interface *oi;
   struct ospf6_neighbor *on;
   struct listnode *i, *j, *k;
+  int reschedule = 0;
 
   o->maxage_remover = (struct thread *) NULL;
 
@@ -227,8 +228,9 @@ ospf6_maxage_remover (struct thread *thread)
             {
               if (on->state != OSPF6_NEIGHBOR_EXCHANGE &&
                   on->state != OSPF6_NEIGHBOR_LOADING)
-                continue;
+                 continue;
 
+             ospf6_maxage_remove (o);
               return 0;
             }
         }
@@ -237,11 +239,28 @@ ospf6_maxage_remover (struct thread *thread)
   for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
     {
       for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
-        OSPF6_LSDB_MAXAGE_REMOVER (oi->lsdb);
+       {
+         if (ospf6_lsdb_maxage_remover (oi->lsdb))
+           {
+             reschedule = 1;
+           }
+       }
       
-      OSPF6_LSDB_MAXAGE_REMOVER (oa->lsdb);
+      if (ospf6_lsdb_maxage_remover (oa->lsdb))
+       {
+           reschedule = 1;
+       }
+    }
+
+  if (ospf6_lsdb_maxage_remover (o->lsdb))
+    {
+      reschedule = 1;
+    }
+
+  if (reschedule)
+    {
+      ospf6_maxage_remove (o);
     }
-  OSPF6_LSDB_MAXAGE_REMOVER (o->lsdb);
 
   return 0;
 }
@@ -250,7 +269,8 @@ void
 ospf6_maxage_remove (struct ospf6 *o)
 {
   if (o && ! o->maxage_remover)
-    o->maxage_remover = thread_add_event (master, ospf6_maxage_remover, o, 0);
+    o->maxage_remover = thread_add_timer (master, ospf6_maxage_remover, o,
+                                         OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT);
 }
 
 /* start ospf6 */
index 3e2b23480aae34f321b013995486e0aca07c31a0..538bc09405ee8b45ba6cbc684ed1347d3eb47ff1 100644 (file)
@@ -200,7 +200,7 @@ ospf_new (void)
   new->spf_hold_multiplier = 1;
 
   /* MaxAge init. */
-  new->maxage_delay = OSFP_LSA_MAXAGE_REMOVE_DELAY_DEFAULT;
+  new->maxage_delay = OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT;
   new->maxage_lsa = route_table_init();
   new->t_maxage_walker =
     thread_add_timer (master, ospf_lsa_maxage_walker,
index fe9d77e9b714b10d9d55db71b7b978f0a9b01ca1..4242aa01b919acf2c8a4940ad831b97326d0c5b0 100644 (file)
@@ -211,10 +211,8 @@ struct ospf
   struct thread *t_opaque_lsa_self;    /* Type-11 Opaque-LSAs origin event. */
 #endif /* HAVE_OPAQUE_LSA */
 
-#define OSFP_LSA_MAXAGE_REMOVE_DELAY_DEFAULT   60
   unsigned int maxage_delay;           /* Delay on Maxage remover timer, sec */
   struct thread *t_maxage;              /* MaxAge LSA remover timer. */
-#define OSPF_LSA_MAXAGE_CHECK_INTERVAL         30
   struct thread *t_maxage_walker;       /* MaxAge LSA checking timer. */
 
   struct thread *t_deferred_shutdown;  /* deferred/stub-router shutdown timer*/