]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospf6d/ospf6_lsdb.c
Merge pull request #8814 from kuldeepkash/topojson_framework
[mirror_frr.git] / ospf6d / ospf6_lsdb.c
index 0892863cf10cae0499b4c5b5966985a60d14781b..304f03fde8a8373783d1b6a4ebbbccbc550fa35e 100644 (file)
@@ -34,6 +34,8 @@
 #include "ospf6d.h"
 #include "bitfield.h"
 
+DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_LSDB, "OSPF6 LSA database");
+
 struct ospf6_lsdb *ospf6_lsdb_create(void *data)
 {
        struct ospf6_lsdb *lsdb;
@@ -68,9 +70,9 @@ static void ospf6_lsdb_set_key(struct prefix_ipv6 *key, const void *value,
 #ifdef DEBUG
 static void _lsdb_count_assert(struct ospf6_lsdb *lsdb)
 {
-       struct ospf6_lsa *debug;
+       struct ospf6_lsa *debug, *debugnext;
        unsigned int num = 0;
-       for (ALL_LSDB(lsdb, debug))
+       for (ALL_LSDB(lsdb, debug, debugnext))
                num++;
 
        if (num == lsdb->count)
@@ -78,7 +80,7 @@ static void _lsdb_count_assert(struct ospf6_lsdb *lsdb)
 
        zlog_debug("PANIC !! lsdb[%p]->count = %d, real = %d", lsdb,
                   lsdb->count, num);
-       for (ALL_LSDB(lsdb, debug))
+       for (ALL_LSDB(lsdb, debug, debugnext))
                zlog_debug("%s lsdb[%p]", debug->name, debug->lsdb);
        zlog_debug("DUMP END");
 
@@ -318,9 +320,17 @@ int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb)
        struct ospf6_lsa *lsa, *lsanext;
 
        for (ALL_LSDB(lsdb, lsa, lsanext)) {
-               if (!OSPF6_LSA_IS_MAXAGE(lsa))
+               if (!OSPF6_LSA_IS_MAXAGE(lsa)) {
+                       if (IS_OSPF6_DEBUG_LSA_TYPE(lsa->header->type))
+                               zlog_debug("Not MaxAge %s", lsa->name);
                        continue;
+               }
+
                if (lsa->retrans_count != 0) {
+                       if (IS_OSPF6_DEBUG_LSA_TYPE(lsa->header->type))
+                               zlog_debug("Remove MaxAge %s retrans_count %d",
+                                          lsa->name, lsa->retrans_count);
+
                        reschedule = 1;
                        continue;
                }
@@ -339,6 +349,7 @@ int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb)
                        THREAD_OFF(lsa->refresh);
                        thread_execute(master, ospf6_lsa_refresh, lsa, 0);
                } else {
+                       zlog_debug("calling ospf6_lsdb_remove %s", lsa->name);
                        ospf6_lsdb_remove(lsa, lsdb);
                }
        }
@@ -346,55 +357,6 @@ int ospf6_lsdb_maxage_remover(struct ospf6_lsdb *lsdb)
        return (reschedule);
 }
 
-void ospf6_lsdb_show(struct vty *vty, enum ospf_lsdb_show_level level,
-                    uint16_t *type, uint32_t *id, uint32_t *adv_router,
-                    struct ospf6_lsdb *lsdb)
-{
-       struct ospf6_lsa *lsa;
-       const struct route_node *end = NULL;
-       void (*showfunc)(struct vty *, struct ospf6_lsa *) = NULL;
-
-       switch (level) {
-       case OSPF6_LSDB_SHOW_LEVEL_DETAIL:
-               showfunc = ospf6_lsa_show;
-               break;
-       case OSPF6_LSDB_SHOW_LEVEL_INTERNAL:
-               showfunc = ospf6_lsa_show_internal;
-               break;
-       case OSPF6_LSDB_SHOW_LEVEL_DUMP:
-               showfunc = ospf6_lsa_show_dump;
-               break;
-       case OSPF6_LSDB_SHOW_LEVEL_NORMAL:
-       default:
-               showfunc = ospf6_lsa_show_summary;
-       }
-
-       if (type && id && adv_router) {
-               lsa = ospf6_lsdb_lookup(*type, *id, *adv_router, lsdb);
-               if (lsa) {
-                       if (level == OSPF6_LSDB_SHOW_LEVEL_NORMAL)
-                               ospf6_lsa_show(vty, lsa);
-                       else
-                               (*showfunc)(vty, lsa);
-               }
-               return;
-       }
-
-       if (level == OSPF6_LSDB_SHOW_LEVEL_NORMAL)
-               ospf6_lsa_show_summary_header(vty);
-
-       end = ospf6_lsdb_head(lsdb, !!type + !!(type && adv_router),
-                             type ? *type : 0, adv_router ? *adv_router : 0,
-                             &lsa);
-       while (lsa) {
-               if ((!adv_router || lsa->header->adv_router == *adv_router)
-                   && (!id || lsa->header->id == *id))
-                       (*showfunc)(vty, lsa);
-
-               lsa = ospf6_lsdb_next(end, lsa);
-       }
-}
-
 uint32_t ospf6_new_ls_id(uint16_t type, uint32_t adv_router,
                         struct ospf6_lsdb *lsdb)
 {