if (IS_LSA_SELF (lsa))
lsdb->type[lsa->data->type].count_self++;
lsdb->type[lsa->data->type].count++;
+ lsdb->type[lsa->data->type].checksum += ntohs(lsa->data->checksum);
lsdb->total++;
}
else
if (IS_LSA_SELF (lsa))
lsdb->type[lsa->data->type].count_self--;
lsdb->type[lsa->data->type].count--;
+ lsdb->type[lsa->data->type].checksum -= ntohs(lsa->data->checksum);
lsdb->total--;
rn->info = NULL;
route_unlock_node (rn);
if (IS_LSA_SELF (lsa))
lsdb->type[i].count_self--;
lsdb->type[i].count--;
+ lsdb->type[i].checksum -= ntohs(lsa->data->checksum);
lsdb->total--;
rn->info = NULL;
route_unlock_node (rn);
return lsdb->type[type].count_self;
}
-unsigned long
-ospf_lsdb_isempty (struct ospf_lsdb *lsdb)
+unsigned int
+ospf_lsdb_checksum (struct ospf_lsdb *lsdb, int type)
{
- return (lsdb->total == 0);
+ return lsdb->type[type].checksum;
}
-struct ospf_lsa *
-foreach_lsa (struct route_table *table, void *p_arg, int int_arg,
- int (*callback) (struct ospf_lsa *, void *, int))
+unsigned long
+ospf_lsdb_isempty (struct ospf_lsdb *lsdb)
{
- struct route_node *rn;
- struct ospf_lsa *lsa;
-
- for (rn = route_top (table); rn; rn = route_next (rn))
- if ((lsa = rn->info) != NULL)
- if (callback (lsa, p_arg, int_arg))
- return lsa;
-
- return NULL;
+ return (lsdb->total == 0);
}
{
unsigned long count;
unsigned long count_self;
+ unsigned int checksum;
struct route_table *db;
} type[OSPF_MAX_LSA];
unsigned long total;
};
/* Macros. */
-#define LSDB_LOOP(T,N,L) \
- for ((N) = route_top ((T)); ((N)); ((N)) = route_next ((N))) \
+#define LSDB_LOOP(T,N,L) \
+ if ((T) != NULL) \
+ for ((N) = route_top ((T)); ((N)); ((N)) = route_next ((N))) \
if (((L) = (N)->info))
#define ROUTER_LSDB(A) ((A)->lsdb->type[OSPF_ROUTER_LSA].db)
unsigned long ospf_lsdb_count_all (struct ospf_lsdb *);
unsigned long ospf_lsdb_count (struct ospf_lsdb *, int);
unsigned long ospf_lsdb_count_self (struct ospf_lsdb *, int);
+unsigned int ospf_lsdb_checksum (struct ospf_lsdb *, int);
unsigned long ospf_lsdb_isempty (struct ospf_lsdb *);
-struct ospf_lsa *foreach_lsa (struct route_table *, void *, int,
- int (*callback) (struct ospf_lsa *, void *, int));
#endif /* _ZEBRA_OSPF_LSDB_H */
/* Show number of LSA. */
vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE);
-
+ vty_out (vty, " Number of router LSA %ld. Checksum Sum 0x%08x%s",
+ ospf_lsdb_count (area->lsdb, OSPF_ROUTER_LSA),
+ ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTY_NEWLINE);
+ vty_out (vty, " Number of network LSA %ld. Checksum Sum 0x%08x%s",
+ ospf_lsdb_count (area->lsdb, OSPF_NETWORK_LSA),
+ ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTY_NEWLINE);
+ vty_out (vty, " Number of summary LSA %ld. Checksum Sum 0x%08x%s",
+ ospf_lsdb_count (area->lsdb, OSPF_SUMMARY_LSA),
+ ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTY_NEWLINE);
+ vty_out (vty, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s",
+ ospf_lsdb_count (area->lsdb, OSPF_ASBR_SUMMARY_LSA),
+ ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTY_NEWLINE);
+ vty_out (vty, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s",
+ ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA),
+ ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE);
+#ifdef HAVE_OPAQUE_LSA
+ vty_out (vty, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s",
+ ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA),
+ ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE);
+ vty_out (vty, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s",
+ ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA),
+ ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE);
+#endif /* HAVE_OPAQUE_LSA */
vty_out (vty, "%s", VTY_NEWLINE);
}
"(injecting external routing information)%s", VTY_NEWLINE);
/* Show Number of AS-external-LSAs. */
- vty_out (vty, " Number of external LSA %ld%s",
- ospf_lsdb_count_all (ospf->lsdb), VTY_NEWLINE);
-
+ vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s",
+ ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA),
+ ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE);
+#ifdef HAVE_OPAQUE_LSA
+ vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s",
+ ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA),
+ ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE);
+#endif /* HAVE_OPAQUE_LSA */
/* Show number of areas attached. */
vty_out (vty, " Number of areas attached to this router: %d%s%s",
listcount (ospf->areas), VTY_NEWLINE, VTY_NEWLINE);