summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-09-26 19:32:41 -0400
committerGitHub <noreply@github.com>2019-09-26 19:32:41 -0400
commit5c256b572ca09b5d15b67ba0236c8a2678dda19c (patch)
tree3484c66e20c459bbfabca2d8a0c78eb8098a47c3
parentcb70bd5638b606f15d57367d43e4a64954b6f943 (diff)
parent873fde8cd9dcb0d0cde47a762500983543de7402 (diff)
Merge pull request #5066 from ak503/libfrr_crash
zebra: if_is_loopback_or_vrf crash if if_lookup_by_index return NULL
-rw-r--r--zebra/zebra_rib.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 98e66cd017..f0601012b6 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1046,14 +1046,18 @@ static struct route_entry *rib_choose_best(struct route_entry *current,
struct nexthop *nexthop = NULL;
for (ALL_NEXTHOPS(alternate->ng, nexthop)) {
- if (if_is_loopback_or_vrf(if_lookup_by_index(
- nexthop->ifindex, alternate->vrf_id)))
+ struct interface *ifp = if_lookup_by_index(
+ nexthop->ifindex, alternate->vrf_id);
+
+ if (ifp && if_is_loopback_or_vrf(ifp))
return alternate;
}
for (ALL_NEXTHOPS(current->ng, nexthop)) {
- if (if_is_loopback_or_vrf(if_lookup_by_index(
- nexthop->ifindex, current->vrf_id)))
+ struct interface *ifp = if_lookup_by_index(
+ nexthop->ifindex, current->vrf_id);
+
+ if (ifp && if_is_loopback_or_vrf(ifp))
return current;
}