]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Stop looking when we find a matching nexthop
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 11 Jul 2017 17:39:08 +0000 (13:39 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 24 Jul 2017 17:52:57 +0000 (13:52 -0400)
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 <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
pimd/pim_nht.c

index 9f80e0ab022d8248a0a155bc5601b8b3844af437..ff0d7b6f3b230afce1c87c005c3af36af6448062 100644 (file)
@@ -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];