diff options
| author | Acee Lindem <acee@lindem.com> | 2025-02-06 18:36:06 +0000 | 
|---|---|---|
| committer | Acee <aceelindem@gmail.com> | 2025-02-12 08:21:34 -0500 | 
| commit | b44258413f4b6569f8f94869b207ee655bac70ae (patch) | |
| tree | 5c90d14f16a0c29817948793cd3f1a6ca7a0dc2b /ospfd/ospf_lsa.c | |
| parent | cea55c9223a4bff308238c97541c7d75c8bd88cd (diff) | |
ospfd: Replace LSDB callbacks with LSA Update/Delete hooks.
Replace the LSDB callbacks with LSA update and delete hooks using the
the FRR hook mechanism. Remove redundant callbacks by placing the LSA
update and delete hooks in a single place so that deletes don't need
to be handled by the update hook. Simplify existing OSPF TE and OSPF
API Server callbacks now that there is no ambiguity or redundancy.
Also cleanup the debugging by separating out opaque-lsa debugging
from the overloaded event debugging.
Signed-off-by: Acee Lindem <acee@lindem.com>
Diffstat (limited to 'ospfd/ospf_lsa.c')
| -rw-r--r-- | ospfd/ospf_lsa.c | 16 | 
1 files changed, 16 insertions, 0 deletions
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index ac53f3a19f..1d5c0be5c4 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -61,6 +61,12 @@ static struct ospf_lsa *  ospf_exnl_lsa_prepare_and_flood(struct ospf *ospf, struct external_info *ei,  				struct in_addr id); +/* + * LSA Update and Delete Hook LSAs. + */ +DEFINE_HOOK(ospf_lsa_update, (struct ospf_lsa *lsa), (lsa)); +DEFINE_HOOK(ospf_lsa_delete, (struct ospf_lsa *lsa), (lsa)); +  uint32_t get_metric(uint8_t *metric)  {  	uint32_t m; @@ -3146,6 +3152,11 @@ struct ospf_lsa *ospf_lsa_install(struct ospf *ospf, struct ospf_interface *oi,  			zlog_debug("LSA[%s]: Install LSA %p, MaxAge",  				   dump_lsa_key(new), lsa);  		ospf_lsa_maxage(ospf, lsa); +	} else { +		/* +		 * Invoke the LSA update hook. +		 */ +		hook_call(ospf_lsa_update, new);  	}  	return new; @@ -3364,6 +3375,11 @@ void ospf_lsa_maxage(struct ospf *ospf, struct ospf_lsa *lsa)  		zlog_debug("LSA[%s]: MaxAge LSA remover scheduled.",  			   dump_lsa_key(lsa)); +	/* +	 * Invoke the LSA delete hook. +	 */ +	hook_call(ospf_lsa_delete, lsa); +  	OSPF_TIMER_ON(ospf->t_maxage, ospf_maxage_lsa_remover,  		      ospf->maxage_delay);  }  | 
