]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_flood.c
eigrpd: eigrp usage of uint32_t to struct in_addr for router_id data
[mirror_frr.git] / ospf6d / ospf6_flood.c
index dae10dce0d7e1cd5ba3c52daf74978395ccad393..0828c2beb659348d24b47305d0ae9f8f1f87a2ac 100644 (file)
@@ -156,6 +156,28 @@ void ospf6_lsa_purge(struct ospf6_lsa *lsa)
        ospf6_lsa_premature_aging(lsa);
 }
 
+/* Puring Multi Link-State IDs LSAs:
+ * Same Advertising Router with Multiple Link-State IDs
+ * LSAs, purging require to traverse all Link-State IDs
+ */
+void ospf6_lsa_purge_multi_ls_id(struct ospf6_area *oa, struct ospf6_lsa *lsa)
+{
+       int ls_id = 0;
+       struct ospf6_lsa *lsa_next;
+       uint16_t type;
+
+       type = lsa->header->type;
+
+       ospf6_lsa_purge(lsa);
+
+       lsa_next = ospf6_lsdb_lookup(type, htonl(++ls_id),
+                                    oa->ospf6->router_id, oa->lsdb);
+       while (lsa_next) {
+               ospf6_lsa_purge(lsa_next);
+               lsa_next = ospf6_lsdb_lookup(type, htonl(++ls_id),
+                                            oa->ospf6->router_id, oa->lsdb);
+       }
+}
 
 void ospf6_increment_retrans_count(struct ospf6_lsa *lsa)
 {
@@ -308,6 +330,8 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa,
                                                zlog_debug(
                                                        "Requesting the same, remove it, next neighbor");
                                        if (req == on->last_ls_req) {
+                                               /* sanity check refcount */
+                                               assert(req->lock >= 2);
                                                ospf6_lsa_unlock(req);
                                                on->last_ls_req = NULL;
                                        }
@@ -327,8 +351,9 @@ void ospf6_flood_interface(struct ospf6_neighbor *from, struct ospf6_lsa *lsa,
                                                ospf6_lsa_unlock(req);
                                                on->last_ls_req = NULL;
                                        }
-                                       ospf6_lsdb_remove(req,
-                                                         on->request_list);
+                                       if (req)
+                                               ospf6_lsdb_remove(req,
+                                                       on->request_list);
                                        ospf6_check_nbr_loading(on);
                                        /* fall through */
                                }