summaryrefslogtreecommitdiff
path: root/ospfd/ospf_lsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_lsa.c')
-rw-r--r--ospfd/ospf_lsa.c62
1 files changed, 26 insertions, 36 deletions
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index d5eba74fd4..5a48eebe49 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -337,7 +337,7 @@ void lsa_header_set(struct stream *s, uint8_t options, uint8_t type,
/* router-LSA related functions. */
/* Get router-LSA flags. */
-static uint8_t router_lsa_flags(struct ospf_area *area)
+uint8_t router_lsa_flags(struct ospf_area *area)
{
uint8_t flags;
@@ -420,9 +420,8 @@ static uint16_t ospf_link_cost(struct ospf_interface *oi)
}
/* Set a link information. */
-static char link_info_set(struct stream **s, struct in_addr id,
- struct in_addr data, uint8_t type, uint8_t tos,
- uint16_t cost)
+char link_info_set(struct stream **s, struct in_addr id, struct in_addr data,
+ uint8_t type, uint8_t tos, uint16_t cost)
{
/* LSA stream is initially allocated to OSPF_MAX_LSA_SIZE, suits
* vast majority of cases. Some rare routers with lots of links need
@@ -679,7 +678,7 @@ static int router_lsa_link_set(struct stream **s, struct ospf_area *area)
}
/* Set router-LSA body. */
-static void ospf_router_lsa_body_set(struct stream **s, struct ospf_area *area)
+void ospf_router_lsa_body_set(struct stream **s, struct ospf_area *area)
{
unsigned long putp;
uint16_t cnt;
@@ -1756,8 +1755,8 @@ static struct ospf_lsa *ospf_lsa_translated_nssa_new(struct ospf *ospf,
== NULL) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_nssa_translate_originate(): Could not originate Translated Type-5 for %pI4",
- &ei.p.prefix);
+ "%s: Could not originate Translated Type-5 for %pI4",
+ __func__, &ei.p.prefix);
return NULL;
}
@@ -1790,24 +1789,22 @@ struct ospf_lsa *ospf_translated_nssa_originate(struct ospf *ospf,
if ((new = ospf_lsa_translated_nssa_new(ospf, type7)) == NULL) {
if (IS_DEBUG_OSPF_NSSA)
zlog_debug(
- "ospf_translated_nssa_originate(): Could not translate Type-7, Id %pI4, to Type-5",
- &type7->data->id);
+ "%s: Could not translate Type-7, Id %pI4, to Type-5",
+ __func__, &type7->data->id);
return NULL;
}
extnew = (struct as_external_lsa *)new->data;
if ((new = ospf_lsa_install(ospf, NULL, new)) == NULL) {
- flog_warn(
- EC_OSPF_LSA_INSTALL_FAILURE,
- "ospf_lsa_translated_nssa_originate(): Could not install LSA id %pI4",
- &type7->data->id);
+ flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
+ "%s: Could not install LSA id %pI4", __func__,
+ &type7->data->id);
return NULL;
}
if (IS_DEBUG_OSPF_NSSA) {
- zlog_debug(
- "ospf_translated_nssa_originate(): translated Type 7, installed:");
+ zlog_debug("%s: translated Type 7, installed", __func__);
ospf_lsa_header_dump(new->data);
zlog_debug(" Network mask: %d", ip_masklen(extnew->mask));
zlog_debug(" Forward addr: %pI4",
@@ -2166,12 +2163,6 @@ void ospf_external_lsa_flush(struct ospf *ospf, uint8_t type,
/* Sweep LSA from Link State Retransmit List. */
ospf_ls_retransmit_delete_nbr_as(ospf, lsa);
-/* There must be no self-originated LSA in rtrs_external. */
-#if 0
- /* Remove External route from Zebra. */
- ospf_zebra_delete ((struct prefix_ipv4 *) p, &nexthop);
-#endif
-
if (!IS_LSA_MAXAGE(lsa)) {
/* Unregister LSA from Refresh queue. */
ospf_refresher_unregister_lsa(ospf, lsa);
@@ -2443,12 +2434,7 @@ ospf_summary_lsa_install(struct ospf *ospf, struct ospf_lsa *new, int rt_recalc)
necessary to re-examine all the AS-external-LSAs.
*/
-#if 0
- /* This doesn't exist yet... */
- ospf_summary_incremental_update(new); */
-#else /* #if 0 */
ospf_spf_calculate_schedule(ospf, SPF_FLAG_SUMMARY_LSA_INSTALL);
-#endif /* #if 0 */
}
if (IS_LSA_SELF(new))
@@ -2469,16 +2455,8 @@ static struct ospf_lsa *ospf_summary_asbr_lsa_install(struct ospf *ospf,
destination is an AS boundary router, it may also be
necessary to re-examine all the AS-external-LSAs.
*/
-#if 0
- /* These don't exist yet... */
- ospf_summary_incremental_update(new);
- /* Isn't this done by the above call?
- - RFC 2328 Section 16.5 implies it should be */
- /* ospf_ase_calculate_schedule(); */
-#else /* #if 0 */
ospf_spf_calculate_schedule(ospf,
SPF_FLAG_ASBR_SUMMARY_LSA_INSTALL);
-#endif /* #if 0 */
}
/* register LSA to refresh-list. */
@@ -2667,7 +2645,7 @@ struct ospf_lsa *ospf_lsa_install(struct ospf *ospf, struct ospf_interface *oi,
} else {
if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) {
zlog_debug(
- "ospf_lsa_install() got an lsa with seq 0x80000000 that was not self originated. Ignoring\n");
+ "ospf_lsa_install() got an lsa with seq 0x80000000 that was not self originated. Ignoring");
ospf_lsa_header_dump(lsa->data);
}
return old;
@@ -2789,7 +2767,7 @@ int ospf_check_nbr_status(struct ospf *ospf)
static int ospf_maxage_lsa_remover(struct thread *thread)
{
struct ospf *ospf = THREAD_ARG(thread);
- struct ospf_lsa *lsa;
+ struct ospf_lsa *lsa, *old;
struct route_node *rn;
int reschedule = 0;
@@ -2851,6 +2829,18 @@ static int ospf_maxage_lsa_remover(struct thread *thread)
/* Remove from lsdb. */
if (lsa->lsdb) {
+ old = ospf_lsdb_lookup(lsa->lsdb, lsa);
+ /* The max age LSA here must be the same
+ * as the LSA in LSDB
+ */
+ if (old != lsa) {
+ flog_err(EC_OSPF_LSA_MISSING,
+ "%s: LSA[Type%d:%pI4]: LSA not in LSDB",
+ __func__, lsa->data->type,
+ &lsa->data->id);
+
+ continue;
+ }
ospf_discard_from_db(ospf, lsa->lsdb, lsa);
ospf_lsdb_delete(lsa->lsdb, lsa);
} else {