pimd: Fix pim_nexthop_lookup

There are situations where we may never look at a better
route for nexthop_lookup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-10-25 10:40:04 -04:00
parent a447fa9649
commit 518e5727b4

View File

@ -59,7 +59,7 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr, int nei
return -1; return -1;
} }
while (!found) while (!found && (i < num_ifindex))
{ {
first_ifindex = nexthop_tab[i].ifindex; first_ifindex = nexthop_tab[i].ifindex;
@ -77,7 +77,9 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr, int nei
return -2; return -2;
} }
if (!ifp->info && PIM_DEBUG_ZEBRA) if (!ifp->info)
{
if (PIM_DEBUG_ZEBRA)
{ {
char addr_str[INET_ADDRSTRLEN]; char addr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str)); pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
@ -85,8 +87,9 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr, int nei
__PRETTY_FUNCTION__, __PRETTY_FUNCTION__,
ifp->name, first_ifindex, addr_str); ifp->name, first_ifindex, addr_str);
} }
i++;
if (neighbor_needed && !pim_if_connected_to_source (ifp, addr)) }
else if (neighbor_needed && !pim_if_connected_to_source (ifp, addr))
{ {
struct pim_neighbor *nbr; struct pim_neighbor *nbr;