summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_lsdb.c23
-rw-r--r--ospf6d/ospf6_lsdb.h15
-rw-r--r--ospf6d/ospf6_top.c32
3 files changed, 49 insertions, 21 deletions
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c
index 7455d835..0edc7a34 100644
--- a/ospf6d/ospf6_lsdb.c
+++ b/ospf6d/ospf6_lsdb.c
@@ -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,
diff --git a/ospf6d/ospf6_lsdb.h b/ospf6d/ospf6_lsdb.h
index 71297dae..2974ffb1 100644
--- a/ospf6d/ospf6_lsdb.h
+++ b/ospf6d/ospf6_lsdb.h
@@ -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);
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 540ef382..e9fe7a4e 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -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 */