From 5993c4aef923700bd606c4d105da39a3c66523c3 Mon Sep 17 00:00:00 2001 From: Acee Date: Mon, 27 Nov 2023 08:13:03 -0500 Subject: ospfd: Fix OSPF link-local opaque LSA crash and opaque memory corruption 1. When an OSPF interface is deleted, remove the references in link-local LSA. Delete the LSA from the LSDB so that the callback has accessibily to the interface prior to deletion. 2. Fix a double free for the opaque function table data structure. 3. Assure that the opaque per-type information and opaque function table structures are removed at the same time since they have back pointers to one another. 4. Add a topotest variation for the link-local opaque LSA crash. Signed-off-by: Acee --- ospfd/ospf_interface.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'ospfd/ospf_interface.c') diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index 3ee1db7550..0a60fa364a 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -339,6 +339,8 @@ void ospf_if_free(struct ospf_interface *oi) assert(oi->state == ISM_Down); + ospf_opaque_type9_lsa_if_cleanup(oi); + ospf_opaque_type9_lsa_term(oi); QOBJ_UNREG(oi); @@ -380,26 +382,6 @@ int ospf_if_is_up(struct ospf_interface *oi) return if_is_up(oi->ifp); } -struct ospf_interface *ospf_if_exists(struct ospf_interface *oic) -{ - struct listnode *node; - struct ospf *ospf; - struct ospf_interface *oi; - - if (!oic) - return NULL; - - ospf = oic->ospf; - if (ospf == NULL) - return NULL; - - for (ALL_LIST_ELEMENTS_RO(ospf->oiflist, node, oi)) - if (oi == oic) - return oi; - - return NULL; -} - /* Lookup OSPF interface by router LSA posistion */ struct ospf_interface *ospf_if_lookup_by_lsa_pos(struct ospf_area *area, int lsa_pos) -- cgit v1.2.3