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 <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2018-06-29 11:09:01 -04:00
parent 8bc8de2c15
commit 0b70cb101c

View File

@ -296,12 +296,12 @@ 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);
}
}
}
}
/*
* This function looks at a svrf's stable and notices if any of the
@ -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,12 +336,11 @@ static void static_fixup_vrf(struct static_vrf *svrf,
else
continue;
}
}
if (install)
static_install_route(rn, si, safi);
}
}
}
/*
* This function enables static routes in a svrf as it
@ -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,13 +371,10 @@ static void static_enable_vrf(struct static_vrf *svrf,
else
continue;
}
install = true;
}
if (install)
static_install_route(rn, si, safi);
}
}
}
/*
* When a vrf is being enabled by the kernel, go through all the