diff options
Diffstat (limited to 'zebra/zebra_nhg.c')
| -rw-r--r-- | zebra/zebra_nhg.c | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index de044c0ea0..1ac18c6fdd 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1681,17 +1681,37 @@ static void nexthop_set_resolved(afi_t afi, const struct nexthop *newhop, /* Copy labels of the resolved route and the parent resolving to it */ if (newhop->nh_label) { - for (i = 0; i < newhop->nh_label->num_labels; i++) + for (i = 0; i < newhop->nh_label->num_labels; i++) { + /* Be a bit picky about overrunning the local array */ + if (num_labels >= MPLS_MAX_LABELS) { + if (IS_ZEBRA_DEBUG_NHG || IS_ZEBRA_DEBUG_RIB) + zlog_debug("%s: too many labels in newhop %pNHv", + __func__, newhop); + break; + } labels[num_labels++] = newhop->nh_label->label[i]; + } + /* Use the "outer" type */ label_type = newhop->nh_label_type; } if (nexthop->nh_label) { - for (i = 0; i < nexthop->nh_label->num_labels; i++) + for (i = 0; i < nexthop->nh_label->num_labels; i++) { + /* Be a bit picky about overrunning the local array */ + if (num_labels >= MPLS_MAX_LABELS) { + if (IS_ZEBRA_DEBUG_NHG || IS_ZEBRA_DEBUG_RIB) + zlog_debug("%s: too many labels in nexthop %pNHv", + __func__, nexthop); + break; + } labels[num_labels++] = nexthop->nh_label->label[i]; + } - /* If the parent has labels, use its type */ - label_type = nexthop->nh_label_type; + /* If the parent has labels, use its type if + * we don't already have one. + */ + if (label_type == ZEBRA_LSP_NONE) + label_type = nexthop->nh_label_type; } if (num_labels) @@ -1776,40 +1796,24 @@ static int nexthop_active(afi_t afi, struct route_entry *re, return 1; /* - * Check to see if we should trust the passed in information - * for UNNUMBERED interfaces as that we won't find the GW - * address in the routing table. - * This check should suffice to handle IPv4 or IPv6 routes - * sourced from EVPN routes which are installed with the - * next hop as the remote VTEP IP. + * If the nexthop has been marked as 'onlink' we just need to make + * sure the nexthop's interface is known and is operational. */ if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK)) { ifp = if_lookup_by_index(nexthop->ifindex, nexthop->vrf_id); if (!ifp) { - if (IS_ZEBRA_DEBUG_RIB_DETAILED) - zlog_debug( - " %s: Onlink and interface: %u[%u] does not exist", - __func__, nexthop->ifindex, - nexthop->vrf_id); - return 0; - } - if (connected_is_unnumbered(ifp)) { - if (if_is_operative(ifp)) - return 1; - - if (IS_ZEBRA_DEBUG_RIB_DETAILED) - zlog_debug( - " %s: Onlink and interface %s is not operative", - __func__, ifp->name); + if (IS_ZEBRA_DEBUG_NHG_DETAIL) + zlog_debug("nexthop %pNHv marked onlink but nhif %u doesn't exist", + nexthop, nexthop->ifindex); return 0; } if (!if_is_operative(ifp)) { - if (IS_ZEBRA_DEBUG_RIB_DETAILED) - zlog_debug( - " %s: Interface %s is not unnumbered", - __func__, ifp->name); + if (IS_ZEBRA_DEBUG_NHG_DETAIL) + zlog_debug("nexthop %pNHv marked onlink but nhif %s is not operational", + nexthop, ifp->name); return 0; } + return 1; } if ((top->p.family == AF_INET && top->p.prefixlen == 32 @@ -2099,7 +2103,7 @@ static unsigned nexthop_active_check(struct route_node *rn, * in every case. */ if (!family) { - rib_table_info_t *info; + struct rib_table_info *info; info = srcdest_rnode_table_info(rn); family = info->afi; |
