From 67c9a537a076ec94ef6d3cb02f228a9ee8dd4cb7 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Thu, 17 Jun 2021 19:31:03 +0300 Subject: [PATCH] ospfd: fix routemap update Currently, if the routemap already exists, we delete the pointer to it when it is updated. We should delete the pointer only if the route-map is actually deleted. Signed-off-by: Igor Ryzhov (cherry picked from commit 0fddd864b758f424eab484ea35f74479eda33fd2) --- ospfd/ospf_routemap.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index c89fd3597f..4f60103aa4 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -70,19 +70,14 @@ static void ospf_route_map_update(const char *name) /* Keep old route-map. */ struct route_map *old = ROUTEMAP(red); - if (!old) { - /* Route-map creation */ - /* Update route-map. */ - ROUTEMAP(red) = - route_map_lookup_by_name( - ROUTEMAP_NAME(red)); - - route_map_counter_increment( - ROUTEMAP(red)); - } else { - /* Route-map deletion */ - ROUTEMAP(red) = NULL; - } + ROUTEMAP(red) = + route_map_lookup_by_name( + ROUTEMAP_NAME(red)); + + if (!old) + route_map_counter_increment( + ROUTEMAP(red)); + /* No update for this distribute type. */ if (old == NULL -- 2.39.5