From 0b70cb101c6fea5dd79396219ecb38dc13035b1e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 29 Jun 2018 11:09:01 -0400 Subject: [PATCH] staticd: Fix crash with NULL si Move the call to the static_install_route to inside of the loop, since we have changed the behavior of how we send down routes to zebra a bit. Signed-off-by: Donald Sharp --- staticd/static_routes.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/staticd/static_routes.c b/staticd/static_routes.c index 9f4338f946..ef0e6d057a 100644 --- a/staticd/static_routes.c +++ b/staticd/static_routes.c @@ -296,9 +296,9 @@ static void static_ifindex_update_af(struct interface *ifp, bool up, afi_t afi, continue; si->ifindex = IFINDEX_INTERNAL; } - } - static_install_route(rn, si, safi); + static_install_route(rn, si, safi); + } } } } @@ -321,16 +321,13 @@ static void static_fixup_vrf(struct static_vrf *svrf, struct route_node *rn; struct static_route *si; struct interface *ifp; - bool install; for (rn = route_top(stable); rn; rn = route_next(rn)) { - install = false; for (si = rn->info; si; si = si->next) { if (strcmp(svrf->vrf->name, si->nh_vrfname) != 0) continue; si->nh_vrf_id = svrf->vrf->vrf_id; - install = true; if (si->ifindex) { ifp = if_lookup_by_name(si->ifname, si->nh_vrf_id); @@ -339,10 +336,9 @@ static void static_fixup_vrf(struct static_vrf *svrf, else continue; } - } - if (install) static_install_route(rn, si, safi); + } } } @@ -363,10 +359,8 @@ static void static_enable_vrf(struct static_vrf *svrf, struct static_route *si; struct interface *ifp; struct vrf *vrf = svrf->vrf; - bool install; for (rn = route_top(stable); rn; rn = route_next(rn)) { - install = false; for (si = rn->info; si; si = si->next) { si->vrf_id = vrf->vrf_id; if (si->ifindex) { @@ -377,11 +371,8 @@ static void static_enable_vrf(struct static_vrf *svrf, else continue; } - install = true; - } - - if (install) static_install_route(rn, si, safi); + } } } -- 2.39.5