ospfd: print extra LSA information in some log messages

Log the LSA advertising router in addition to the LSA type and
ID in the places where that information is necessary to uniquely
identify the LSA in the LSDB.

This is useful, for example, to know exactly which LSA has changed
when the router is exiting from the GR helper mode when a topology
change was detected.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2021-05-31 10:27:51 -03:00
parent 12536067cc
commit e9505bc63a
5 changed files with 26 additions and 24 deletions

View File

@ -1036,8 +1036,8 @@ void ospf_lsa_flush_area(struct ospf_lsa *lsa, struct ospf_area *area)
retransmissions */ retransmissions */
lsa->data->ls_age = htons(OSPF_LSA_MAXAGE); lsa->data->ls_age = htons(OSPF_LSA_MAXAGE);
if (IS_DEBUG_OSPF_EVENT) if (IS_DEBUG_OSPF_EVENT)
zlog_debug("%s: MAXAGE set to LSA %pI4", __func__, zlog_debug("%s: MaxAge set to LSA[%s]", __func__,
&lsa->data->id); dump_lsa_key(lsa));
monotime(&lsa->tv_recv); monotime(&lsa->tv_recv);
lsa->tv_orig = lsa->tv_recv; lsa->tv_orig = lsa->tv_recv;
ospf_flood_through_area(area, NULL, lsa); ospf_flood_through_area(area, NULL, lsa);
@ -1050,6 +1050,9 @@ void ospf_lsa_flush_as(struct ospf *ospf, struct ospf_lsa *lsa)
more time for the ACK to be received and avoid more time for the ACK to be received and avoid
retransmissions */ retransmissions */
lsa->data->ls_age = htons(OSPF_LSA_MAXAGE); lsa->data->ls_age = htons(OSPF_LSA_MAXAGE);
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("%s: MaxAge set to LSA[%s]", __func__,
dump_lsa_key(lsa));
monotime(&lsa->tv_recv); monotime(&lsa->tv_recv);
lsa->tv_orig = lsa->tv_recv; lsa->tv_orig = lsa->tv_recv;
ospf_flood_through_as(ospf, NULL, lsa); ospf_flood_through_as(ospf, NULL, lsa);

View File

@ -623,9 +623,8 @@ void ospf_helper_handle_topo_chg(struct ospf *ospf, struct ospf_lsa *lsa)
return; return;
if (IS_DEBUG_OSPF_GR_HELPER) if (IS_DEBUG_OSPF_GR_HELPER)
zlog_debug( zlog_debug("%s: Topo change detected due to LSA[%s]", __func__,
"%s, Topo change detected due to lsa LSID:%pI4 type:%d", dump_lsa_key(lsa));
__func__, &lsa->data->id, lsa->data->type);
lsa->to_be_acknowledged = OSPF_GR_TRUE; lsa->to_be_acknowledged = OSPF_GR_TRUE;

View File

@ -2791,8 +2791,8 @@ struct ospf_lsa *ospf_lsa_install(struct ospf *ospf, struct ospf_interface *oi,
*/ */
if (IS_LSA_MAXAGE(new)) { if (IS_LSA_MAXAGE(new)) {
if (IS_DEBUG_OSPF(lsa, LSA_INSTALL)) if (IS_DEBUG_OSPF(lsa, LSA_INSTALL))
zlog_debug("LSA[Type%d:%pI4]: Install LSA %p, MaxAge", zlog_debug("LSA[%s]: Install LSA %p, MaxAge",
new->data->type, &new->data->id, lsa); dump_lsa_key(new), lsa);
ospf_lsa_maxage(ospf, lsa); ospf_lsa_maxage(ospf, lsa);
} }
@ -2874,9 +2874,8 @@ static int ospf_maxage_lsa_remover(struct thread *thread)
if (IS_DEBUG_OSPF(lsa, LSA_FLOODING)) if (IS_DEBUG_OSPF(lsa, LSA_FLOODING))
zlog_debug( zlog_debug(
"LSA[Type%d:%pI4]: MaxAge LSA removed from list", "LSA[%s]: MaxAge LSA removed from list",
lsa->data->type, dump_lsa_key(lsa));
&lsa->data->id);
if (CHECK_FLAG(lsa->flags, OSPF_LSA_PREMATURE_AGE)) { if (CHECK_FLAG(lsa->flags, OSPF_LSA_PREMATURE_AGE)) {
if (IS_DEBUG_OSPF(lsa, LSA_FLOODING)) if (IS_DEBUG_OSPF(lsa, LSA_FLOODING))
@ -2894,9 +2893,8 @@ static int ospf_maxage_lsa_remover(struct thread *thread)
*/ */
if (old != lsa) { if (old != lsa) {
flog_err(EC_OSPF_LSA_MISSING, flog_err(EC_OSPF_LSA_MISSING,
"%s: LSA[Type%d:%pI4]: LSA not in LSDB", "%s: LSA[%s]: LSA not in LSDB",
__func__, lsa->data->type, __func__, dump_lsa_key(lsa));
&lsa->data->id);
continue; continue;
} }
@ -2905,9 +2903,8 @@ static int ospf_maxage_lsa_remover(struct thread *thread)
} else { } else {
if (IS_DEBUG_OSPF(lsa, LSA_FLOODING)) if (IS_DEBUG_OSPF(lsa, LSA_FLOODING))
zlog_debug( zlog_debug(
"%s: LSA[Type%d:%pI4]: No associated LSDB!", "%s: LSA[%s]: No associated LSDB!",
__func__, lsa->data->type, __func__, dump_lsa_key(lsa));
&lsa->data->id);
} }
} }
@ -2964,9 +2961,8 @@ void ospf_lsa_maxage(struct ospf *ospf, struct ospf_lsa *lsa)
if (CHECK_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE)) { if (CHECK_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE)) {
if (IS_DEBUG_OSPF(lsa, LSA_FLOODING)) if (IS_DEBUG_OSPF(lsa, LSA_FLOODING))
zlog_debug( zlog_debug(
"LSA[Type%d:%pI4]: %p already exists on MaxAge LSA list", "LSA[%s]: %p already exists on MaxAge LSA list",
lsa->data->type, &lsa->data->id, dump_lsa_key(lsa), lsa);
(void *)lsa);
return; return;
} }

View File

@ -2147,6 +2147,11 @@ void ospf_opaque_self_originated_lsa_received(struct ospf_neighbor *nbr,
if ((top = oi_to_top(nbr->oi)) == NULL) if ((top = oi_to_top(nbr->oi)) == NULL)
return; return;
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
"LSA[Type%d:%pI4]: processing self-originated Opaque-LSA",
lsa->data->type, &lsa->data->id);
/* /*
* Since these LSA entries are not yet installed into corresponding * Since these LSA entries are not yet installed into corresponding
* LSDB, just flush them without calling ospf_ls_maxage() afterward. * LSDB, just flush them without calling ospf_ls_maxage() afterward.

View File

@ -3575,14 +3575,13 @@ static int ospf_make_ls_upd(struct ospf_interface *oi, struct list *update,
struct lsa_header *lsah; struct lsa_header *lsah;
uint16_t ls_age; uint16_t ls_age;
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("ospf_make_ls_upd: List Iteration %d",
count);
lsa = listgetdata(node); lsa = listgetdata(node);
assert(lsa->data); assert(lsa->data);
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("%s: List Iteration %d LSA[%s]", __func__,
count, dump_lsa_key(lsa));
/* Will it fit? Minimum it has to fit atleast one */ /* Will it fit? Minimum it has to fit atleast one */
if ((length + delta + ntohs(lsa->data->length) > size_noauth) && if ((length + delta + ntohs(lsa->data->length) > size_noauth) &&
(count > 0)) (count > 0))