]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: fix cleanup of MaxAge LSAs on exit
authorRenato Westphal <renato@opensourcerouting.org>
Mon, 31 May 2021 13:27:51 +0000 (10:27 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Tue, 8 Jun 2021 14:41:33 +0000 (11:41 -0300)
During shutdown, the ospf->maxage_lsa table is iterated over to
clean up all existing entries. While doing that, route_unlock_node()
should be called only for the nodes that have an associated entry,
otherwise the table will get corrupted and ospfd will crash.

As a side note, using a routing table to store MaxAge LSAs was a
very poor choice of a data structure, considering that a simple
rb-tree or hash table would get the job done with a much simpler
(and less error-prone) API. Something to cleanup in the future...

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ospfd/ospfd.c

index 106ce3bd7dc0ca067b440684860094968cd2299c..d053bdabbd3fdfee6a73b24ec8502d0d011e405a 100644 (file)
@@ -828,8 +828,8 @@ static void ospf_finish_final(struct ospf *ospf)
                if ((lsa = rn->info) != NULL) {
                        ospf_lsa_unlock(&lsa);
                        rn->info = NULL;
+                       route_unlock_node(rn);
                }
-               route_unlock_node(rn);
        }
        route_table_finish(ospf->maxage_lsa);