]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_lsdb.c
Merge pull request #5653 from slankdev/slankdev-bgpd-support-prefix-sid-srv6-l3vpn
[mirror_frr.git] / ospf6d / ospf6_lsdb.c
index 5e02c0c917b66471931a6626bb32395acea53275..0a9f1c6f7ced9bfa0f7c4add1a35754aa33078d9 100644 (file)
@@ -39,10 +39,6 @@ struct ospf6_lsdb *ospf6_lsdb_create(void *data)
        struct ospf6_lsdb *lsdb;
 
        lsdb = XCALLOC(MTYPE_OSPF6_LSDB, sizeof(struct ospf6_lsdb));
-       if (lsdb == NULL) {
-               zlog_warn("Can't malloc lsdb");
-               return NULL;
-       }
        memset(lsdb, 0, sizeof(struct ospf6_lsdb));
 
        lsdb->data = data;
@@ -302,13 +298,17 @@ struct ospf6_lsa *ospf6_lsdb_next(const struct route_node *iterend,
 
 void ospf6_lsdb_remove_all(struct ospf6_lsdb *lsdb)
 {
-       struct ospf6_lsa *lsa;
+       struct ospf6_lsa *lsa, *lsa_next;
+       const struct route_node *iterend;
 
        if (lsdb == NULL)
                return;
 
-       for (ALL_LSDB(lsdb, lsa))
+       for (iterend = ospf6_lsdb_head(lsdb, 0, 0, 0, &lsa); lsa;
+            lsa = lsa_next) {
+               lsa_next = ospf6_lsdb_next(iterend, lsa);
                ospf6_lsdb_remove(lsa, lsdb);
+       }
 }
 
 void ospf6_lsdb_lsa_unlock(struct ospf6_lsa *lsa)
@@ -323,9 +323,12 @@ void ospf6_lsdb_lsa_unlock(struct ospf6_lsa *lsa)
 int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb)
 {
        int reschedule = 0;
-       struct ospf6_lsa *lsa;
+       struct ospf6_lsa *lsa, *lsa_next;
+       const struct route_node *iterend;
 
-       for (ALL_LSDB(lsdb, lsa)) {
+       for (iterend = ospf6_lsdb_head(lsdb, 0, 0, 0, &lsa); lsa;
+            lsa = lsa_next) {
+               lsa_next = ospf6_lsdb_next(iterend, lsa);
                if (!OSPF6_LSA_IS_MAXAGE(lsa))
                        continue;
                if (lsa->retrans_count != 0) {