From 518e5727b40b97827b92555bf8d867d642c91bc4 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 25 Oct 2016 10:40:04 -0400 Subject: [PATCH] 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 --- pimd/pim_rpf.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index ffedd84103..d32d65fd4c 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -59,7 +59,7 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr, int nei return -1; } - while (!found) + while (!found && (i < num_ifindex)) { first_ifindex = nexthop_tab[i].ifindex; @@ -77,16 +77,19 @@ int pim_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr, int nei return -2; } - if (!ifp->info && PIM_DEBUG_ZEBRA) + if (!ifp->info) { - char addr_str[INET_ADDRSTRLEN]; - pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); - zlog_debug("%s: multicast not enabled on input interface %s (ifindex=%d, RPF for source %s)", - __PRETTY_FUNCTION__, - ifp->name, first_ifindex, addr_str); + if (PIM_DEBUG_ZEBRA) + { + char addr_str[INET_ADDRSTRLEN]; + pim_inet4_dump("", addr, addr_str, sizeof(addr_str)); + zlog_debug("%s: multicast not enabled on input interface %s (ifindex=%d, RPF for source %s)", + __PRETTY_FUNCTION__, + 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; -- 2.39.5