From: Donald Sharp Date: Tue, 11 Jul 2017 17:39:08 +0000 (-0400) Subject: pimd: Stop looking when we find a matching nexthop X-Git-Tag: frr-4.0-dev~468^2~20 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=1b5f8a1a21fb271c5d9c9faa9ca8749fb9038f6f;p=mirror_frr.git pimd: Stop looking when we find a matching nexthop When we receive a new ecmp path and the old nexthop is still valid. There existed some cases where we would continue looking for a nexthop( and thus loose the fact that we had found it ) after found. Ticket: CM-16983 Signed-off-by: Donald Sharp Reviewed-by: Don Slice --- diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index 9f80e0ab0..ff0d7b6f3 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -489,9 +489,12 @@ int pim_ecmp_nexthop_search(struct pim_instance *pim, // If the current nexthop is not valid, candidate to // choose new Nexthop. for (nh_node = pnc->nexthop; nh_node; - nh_node = nh_node->next) + nh_node = nh_node->next) { curr_route_valid = (nexthop->interface->ifindex == nh_node->ifindex); + if (curr_route_valid) + break; + } if (curr_route_valid && !pim_if_connected_to_source(nexthop->interface, @@ -734,17 +737,6 @@ int pim_parse_nexthop_update(int command, struct zclient *zclient, break; } - if (PIM_DEBUG_PIM_NHT) { - char p_str[PREFIX2STR_BUFFER]; - prefix2str(&p, p_str, sizeof(p_str)); - zlog_debug( - "%s: NHT addr %s(%s) %d-nhop via %s type %d distance:%u metric:%u ", - __PRETTY_FUNCTION__, p_str, - pim->vrf->name, i + 1, - inet_ntoa(nexthop->gate.ipv4), - nexthop->type, distance, metric); - } - ifp = if_lookup_by_index(nexthop->ifindex, pim->vrf_id); if (!ifp) { if (PIM_DEBUG_PIM_NHT) { @@ -761,6 +753,18 @@ int pim_parse_nexthop_update(int command, struct zclient *zclient, continue; } + if (PIM_DEBUG_PIM_NHT) { + char p_str[PREFIX2STR_BUFFER]; + prefix2str(&p, p_str, sizeof(p_str)); + zlog_debug( + "%s: NHT addr %s(%s) %d-nhop via %s(%s) type %d distance:%u metric:%u ", + __PRETTY_FUNCTION__, p_str, + pim->vrf->name, i + 1, + inet_ntoa(nexthop->gate.ipv4), + ifp->name, nexthop->type, distance, + metric); + } + if (!ifp->info) { if (PIM_DEBUG_PIM_NHT) { char buf[NEXTHOP_STRLEN];