diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 9549af5f14bc..54d737457ab3 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -663,7 +663,7 @@ static int nhlfe_nexthop_active_ipv4(struct zebra_nhlfe *nhlfe, route_unlock_node(rn); - /* Locate a valid connected route. */ + /* Locate a valid route. */ RNODE_FOREACH_RE (rn, match) { if (CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED) || !CHECK_FLAG(match->flags, ZEBRA_FLAG_SELECTED)) @@ -671,12 +671,8 @@ static int nhlfe_nexthop_active_ipv4(struct zebra_nhlfe *nhlfe, for (match_nh = match->nhe->nhg.nexthop; match_nh; match_nh = match_nh->next) { - if ((match->type == ZEBRA_ROUTE_CONNECT || - match->type == ZEBRA_ROUTE_LOCAL) || - nexthop->ifindex == match_nh->ifindex) { - nexthop->ifindex = match_nh->ifindex; + if (nexthop->ifindex == match_nh->ifindex) return 1; - } } } @@ -713,11 +709,9 @@ static int nhlfe_nexthop_active_ipv6(struct zebra_nhlfe *nhlfe, route_unlock_node(rn); - /* Locate a valid connected route. */ + /* Locate a valid route. */ RNODE_FOREACH_RE (rn, match) { - if (((match->type == ZEBRA_ROUTE_CONNECT || - match->type == ZEBRA_ROUTE_LOCAL)) && - !CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED) && + if (!CHECK_FLAG(match->status, ROUTE_ENTRY_REMOVED) && CHECK_FLAG(match->flags, ZEBRA_FLAG_SELECTED)) break; } @@ -725,7 +719,9 @@ static int nhlfe_nexthop_active_ipv6(struct zebra_nhlfe *nhlfe, if (!match || !match->nhe->nhg.nexthop) return 0; - nexthop->ifindex = match->nhe->nhg.nexthop->ifindex; + if (nexthop->ifindex != match->nhe->nhg.nexthop->ifindex) + return 0; + return 1; }