From ca187fd3558a9fafc0366eaf902aea60edd7ba91 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Fri, 7 May 2021 18:10:01 +0300 Subject: [PATCH] ospfd: free "default-information originate" config when removing router Signed-off-by: Igor Ryzhov --- ospfd/ospfd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 8e047cd9c9..2b9457d8b9 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -697,6 +697,7 @@ static void ospf_finish_final(struct ospf *ospf) struct ospf_area *area; struct ospf_vl_data *vl_data; struct listnode *node, *nnode; + struct ospf_redist *red; int i; QOBJ_UNREG(ospf); @@ -710,7 +711,6 @@ static void ospf_finish_final(struct ospf *ospf) /* Unregister redistribution */ for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { struct list *red_list; - struct ospf_redist *red; red_list = ospf->redist[i]; if (!red_list) @@ -721,7 +721,12 @@ static void ospf_finish_final(struct ospf *ospf) ospf_redist_del(ospf, i, red->instance); } } - ospf_redistribute_default_set(ospf, DEFAULT_ORIGINATE_NONE, 0, 0); + red = ospf_redist_lookup(ospf, DEFAULT_ROUTE, 0); + if (red) { + ospf_routemap_unset(red); + ospf_redist_del(ospf, DEFAULT_ROUTE, 0); + ospf_redistribute_default_set(ospf, DEFAULT_ORIGINATE_NONE, 0, 0); + } for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area)) ospf_remove_vls_through_area(ospf, area);