#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;
#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)
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");
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;
}
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);
}
}
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)
{