summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_lsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_lsa.c')
-rw-r--r--ospfd/ospf_lsa.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 62a4fb45..aaf1f484 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -261,6 +261,14 @@ ospf_lsa_free (struct ospf_lsa *lsa)
XFREE (MTYPE_OSPF_LSA, lsa);
}
+/* Lock LSA. */
+struct ospf_lsa *
+ospf_lsa_lock (struct ospf_lsa *lsa)
+{
+ lsa->lock++;
+ return lsa;
+}
+
/* Unlock LSA. */
void
ospf_lsa_unlock (struct ospf_lsa **lsa)
@@ -2994,6 +3002,19 @@ ospf_maxage_lsa_remover (struct thread *thread)
return 0;
}
+static int
+ospf_lsa_maxage_exist (struct ospf *ospf, struct ospf_lsa *new)
+{
+ struct listnode *node;
+ struct ospf_lsa *lsa;
+
+ for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa))
+ if (lsa == new)
+ return 1;
+
+ return 0;
+}
+
void
ospf_lsa_maxage_delete (struct ospf *ospf, struct ospf_lsa *lsa)
{
@@ -3011,7 +3032,7 @@ ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *lsa)
{
/* When we saw a MaxAge LSA flooded to us, we put it on the list
and schedule the MaxAge LSA remover. */
- if (CHECK_FLAG(lsa->flags, OSPF_LSA_MAXAGE))
+ if (ospf_lsa_maxage_exist (ospf, lsa))
{
if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
zlog_debug ("LSA[Type%d:%s]: %p already exists on MaxAge LSA list",
@@ -3020,7 +3041,6 @@ ospf_lsa_maxage (struct ospf *ospf, struct ospf_lsa *lsa)
}
listnode_add (ospf->maxage_lsa, ospf_lsa_lock (lsa));
- SET_FLAG(lsa->flags, OSPF_LSA_MAXAGE);
if (IS_DEBUG_OSPF (lsa, LSA_FLOODING))
zlog_debug ("LSA[%s]: MaxAge LSA remover scheduled.", dump_lsa_key (lsa));