From b44258413f4b6569f8f94869b207ee655bac70ae Mon Sep 17 00:00:00 2001 From: Acee Lindem Date: Thu, 6 Feb 2025 18:36:06 +0000 Subject: 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 --- ospfd/ospf_te.c | 55 +++++++++++++------------------------------------------ 1 file changed, 13 insertions(+), 42 deletions(-) (limited to 'ospfd/ospf_te.c') diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c index d57990e1a1..b6f432b1bb 100644 --- a/ospfd/ospf_te.c +++ b/ospfd/ospf_te.c @@ -3015,7 +3015,7 @@ static int ospf_te_delete_opaque_lsa(struct ls_ted *ted, struct ospf_lsa *lsa) /** * Update Traffic Engineering Database Elements that correspond to the received - * OSPF LSA. If LSA age is equal to MAX_AGE, call deletion function instead. + * OSPF LSA. * * @param lsa OSPF Link State Advertisement * @@ -3037,34 +3037,18 @@ static int ospf_mpls_te_lsa_update(struct ospf_lsa *lsa) return -1; } - /* If LSA is MAX_AGE, remove corresponding Link State element */ - if (IS_LSA_MAXAGE(lsa)) { - switch (lsa->data->type) { - case OSPF_ROUTER_LSA: - rc = ospf_te_delete_router_lsa(OspfMplsTE.ted, lsa); - break; - case OSPF_OPAQUE_AREA_LSA: - case OSPF_OPAQUE_AS_LSA: - rc = ospf_te_delete_opaque_lsa(OspfMplsTE.ted, lsa); - break; - default: - rc = 0; - break; - } - } else { - /* Parse LSA to Update corresponding Link State element */ - switch (lsa->data->type) { - case OSPF_ROUTER_LSA: - rc = ospf_te_parse_router_lsa(OspfMplsTE.ted, lsa); - break; - case OSPF_OPAQUE_AREA_LSA: - case OSPF_OPAQUE_AS_LSA: - rc = ospf_te_parse_opaque_lsa(OspfMplsTE.ted, lsa); - break; - default: - rc = 0; - break; - } + /* Parse LSA to Update corresponding Link State element */ + switch (lsa->data->type) { + case OSPF_ROUTER_LSA: + rc = ospf_te_parse_router_lsa(OspfMplsTE.ted, lsa); + break; + case OSPF_OPAQUE_AREA_LSA: + case OSPF_OPAQUE_AS_LSA: + rc = ospf_te_parse_opaque_lsa(OspfMplsTE.ted, lsa); + break; + default: + rc = 0; + break; } return rc; @@ -3096,19 +3080,6 @@ static int ospf_mpls_te_lsa_delete(struct ospf_lsa *lsa) return -1; } - /* - * Process only self LSAs that reach MAX_AGE. Indeed, when the router - * need to update or refresh an LSA, it first removes the old LSA from - * the LSDB and then insert the new one. Thus, to avoid removing - * corresponding Link State element and loosing some parameters - * instead of just updating it, only self LSAs that reach MAX_AGE are - * processed here. Other LSAs are processed by ospf_mpls_te_lsa_update() - * and eventually removed when LSA age is MAX_AGE i.e. LSA is flushed - * by the originator. - */ - if (!IS_LSA_SELF(lsa) || !IS_LSA_MAXAGE(lsa)) - return 0; - /* Parse Link State information */ switch (lsa->data->type) { case OSPF_ROUTER_LSA: -- cgit v1.2.3