summaryrefslogtreecommitdiff
path: root/ospfd/ospf_apiserver.c
diff options
context:
space:
mode:
authorAcee <aceelindem@gmail.com>2023-05-09 16:51:03 -0400
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2023-05-10 20:52:06 +0000
commit947b69eb17d0344b4e5a9ea8388ece4481200edd (patch)
treef5ad5e4dfad830d82de114513df84444a34e5ae8 /ospfd/ospf_apiserver.c
parentdcaac2a2a559c80ba13b5a38a98438d101e0cad7 (diff)
ospfd: OSPF opaque LSA stale processing fix and topotests.
1. Fix OSPF opaque LSA processing to preserve the stale opaque LSAs in the Link State Database for 60 seconds consistent with what is done for other LSA types. 2. Add a topotest that tests for cases where ospfd is restarted and a stale OSPF opaque LSA exists in the OSPF routing domain both when the LSA is purged and when the LSA is reoriginagted with a more recent instance. Signed-off-by: Acee <aceelindem@gmail.com> (cherry picked from commit 4e7eb1e62ce54ebcf78622682de962fdeff20b80)
Diffstat (limited to 'ospfd/ospf_apiserver.c')
-rw-r--r--ospfd/ospf_apiserver.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c
index 6415fda1fc..bcfdddd39f 100644
--- a/ospfd/ospf_apiserver.c
+++ b/ospfd/ospf_apiserver.c
@@ -1779,6 +1779,12 @@ int ospf_apiserver_originate1(struct ospf_lsa *lsa, struct ospf_lsa *old)
* session. Dump it, but increment past it's seqnum.
*/
assert(!ospf_opaque_is_owned(old));
+ if (IS_DEBUG_OSPF_CLIENT_API)
+ zlog_debug(
+ "LSA[Type%d:%pI4]: OSPF API Server Originate LSA Old Seq: 0x%x Age: %d",
+ old->data->type, &old->data->id,
+ ntohl(old->data->ls_seqnum),
+ ntohl(old->data->ls_age));
if (IS_LSA_MAX_SEQ(old)) {
flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
"%s: old LSA at maxseq", __func__);
@@ -1787,6 +1793,11 @@ int ospf_apiserver_originate1(struct ospf_lsa *lsa, struct ospf_lsa *old)
lsa->data->ls_seqnum = lsa_seqnum_increment(old);
ospf_discard_from_db(ospf, old->lsdb, old);
}
+ if (IS_DEBUG_OSPF_CLIENT_API)
+ zlog_debug(
+ "LSA[Type%d:%pI4]: OSPF API Server Originate LSA New Seq: 0x%x Age: %d",
+ lsa->data->type, &lsa->data->id,
+ ntohl(lsa->data->ls_seqnum), ntohl(lsa->data->ls_age));
/* Install this LSA into LSDB. */
if (ospf_lsa_install(ospf, lsa->oi, lsa) == NULL) {
@@ -1861,6 +1872,11 @@ struct ospf_lsa *ospf_apiserver_lsa_refresher(struct ospf_lsa *lsa)
ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
assert(ospf);
+ if (IS_DEBUG_OSPF(lsa, LSA_GENERATE)) {
+ zlog_debug("LSA[Type%d:%pI4]: OSPF API Server LSA Refresher",
+ lsa->data->type, &lsa->data->id);
+ }
+
apiserv = lookup_apiserver_by_lsa(lsa);
if (!apiserv) {
zlog_warn("%s: LSA[%s]: No apiserver?", __func__,
@@ -1870,14 +1886,14 @@ struct ospf_lsa *ospf_apiserver_lsa_refresher(struct ospf_lsa *lsa)
goto out;
}
- if (IS_LSA_MAXAGE(lsa)) {
- ospf_opaque_lsa_flush_schedule(lsa);
- goto out;
- }
-
/* Check if updated version of LSA instance has already prepared. */
new = ospf_lsdb_lookup(&apiserv->reserve, lsa);
if (!new) {
+ if (IS_LSA_MAXAGE(lsa)) {
+ ospf_opaque_lsa_flush_schedule(lsa);
+ goto out;
+ }
+
/* This is a periodic refresh, driven by core OSPF mechanism. */
new = ospf_apiserver_opaque_lsa_new(lsa->area, lsa->oi,
lsa->data);