Merge pull request #5076 from ak503/libfrr_crash_7_2

7.2: zebra: if_is_loopback_or_vrf crash if if_lookup_by_index return …
This commit is contained in:
Donald Sharp 2019-10-02 10:13:24 -04:00 committed by GitHub
commit 8309f3f3da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}