if (a->srte_color > b->srte_color)
return 1;
- if (a->ifindex_ipv6_ll < b->ifindex_ipv6_ll)
+ if (a->ifindex < b->ifindex)
return -1;
- if (a->ifindex_ipv6_ll > b->ifindex_ipv6_ll)
+ if (a->ifindex > b->ifindex)
return 1;
return prefix_cmp(&a->prefix, &b->prefix);
bnc = XCALLOC(MTYPE_BGP_NEXTHOP_CACHE,
sizeof(struct bgp_nexthop_cache));
bnc->prefix = *prefix;
- bnc->ifindex_ipv6_ll = ifindex;
+ bnc->ifindex = ifindex;
bnc->srte_color = srte_color;
bnc->tree = tree;
LIST_INIT(&(bnc->paths));
bnc.prefix = *prefix;
bnc.srte_color = srte_color;
- bnc.ifindex_ipv6_ll = ifindex;
+ bnc.ifindex = ifindex;
return bgp_nexthop_cache_find(tree, &bnc);
}
json_object_string_add(
json_gate, "interfaceName",
ifindex2ifname(
- bnc->ifindex_ipv6_ll
- ? bnc->ifindex_ipv6_ll
- : nexthop->ifindex,
+ bnc->ifindex ? bnc->ifindex
+ : nexthop->ifindex,
bgp->vrf_id));
break;
case NEXTHOP_TYPE_IPV4:
json_object_string_add(
json_gate, "interfaceName",
ifindex2ifname(
- bnc->ifindex_ipv6_ll
- ? bnc->ifindex_ipv6_ll
- : nexthop->ifindex,
+ bnc->ifindex ? bnc->ifindex
+ : nexthop->ifindex,
bgp->vrf_id));
break;
case NEXTHOP_TYPE_IPV4_IFINDEX:
json_object_string_add(
json_gate, "interfaceName",
ifindex2ifname(
- bnc->ifindex_ipv6_ll
- ? bnc->ifindex_ipv6_ll
- : nexthop->ifindex,
+ bnc->ifindex ? bnc->ifindex
+ : nexthop->ifindex,
bgp->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
case NEXTHOP_TYPE_IPV6_IFINDEX:
vty_out(vty, " gate %pI6", &nexthop->gate.ipv6);
if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX &&
- bnc->ifindex_ipv6_ll)
+ bnc->ifindex)
vty_out(vty, ", if %s\n",
- ifindex2ifname(bnc->ifindex_ipv6_ll,
+ ifindex2ifname(bnc->ifindex,
bgp->vrf_id));
else if (nexthop->ifindex)
vty_out(vty, ", if %s\n",
case NEXTHOP_TYPE_IPV4_IFINDEX:
vty_out(vty, " gate %pI4", &nexthop->gate.ipv4);
if (nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX &&
- bnc->ifindex_ipv6_ll)
+ bnc->ifindex)
vty_out(vty, ", if %s\n",
- ifindex2ifname(bnc->ifindex_ipv6_ll,
+ ifindex2ifname(bnc->ifindex,
bgp->vrf_id));
else if (nexthop->ifindex)
vty_out(vty, ", if %s\n",
break;
case NEXTHOP_TYPE_IFINDEX:
vty_out(vty, " if %s\n",
- ifindex2ifname(bnc->ifindex_ipv6_ll
- ? bnc->ifindex_ipv6_ll
- : nexthop->ifindex,
+ ifindex2ifname(bnc->ifindex ? bnc->ifindex
+ : nexthop->ifindex,
bgp->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
if (nexthop->type == NEXTHOP_TYPE_IFINDEX ||
nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX ||
nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) {
- ifp = if_lookup_by_index(bnc->ifindex_ipv6_ll
- ? bnc->ifindex_ipv6_ll
- : nexthop->ifindex,
- bnc->bgp->vrf_id);
+ ifp = if_lookup_by_index(
+ bnc->ifindex ? bnc->ifindex : nexthop->ifindex,
+ bnc->bgp->vrf_id);
}
if (!ifp)
continue;
for (nexthop = bnc->nexthop; nexthop; nexthop = nexthop->next) {
if (nexthop->type != NEXTHOP_TYPE_BLACKHOLE) {
- ifp = if_lookup_by_index(bnc->ifindex_ipv6_ll
- ? bnc->ifindex_ipv6_ll
- : nexthop->ifindex,
- bnc->bgp->vrf_id);
+ ifp = if_lookup_by_index(
+ bnc->ifindex ? bnc->ifindex : nexthop->ifindex,
+ bnc->bgp->vrf_id);
if (ifp && (ifp->ll_type == ZEBRA_LLT_IPGRE ||
ifp->ll_type == ZEBRA_LLT_IP6GRE))
break;
if (LIST_EMPTY(&(bnc->paths)) && !bnc->nht_info) {
if (BGP_DEBUG(nht, NHT))
zlog_debug("%s: freeing bnc %pFX(%d)(%u)(%s)", __func__,
- &bnc->prefix, bnc->ifindex_ipv6_ll,
- bnc->srte_color, bnc->bgp->name_pretty);
+ &bnc->prefix, bnc->ifindex, bnc->srte_color,
+ bnc->bgp->name_pretty);
/* only unregister if this is the last nh for this prefix*/
if (!bnc_existing_for_prefix(bnc))
unregister_zebra_rnh(bnc);
if (BGP_DEBUG(nht, NHT)) {
zlog_debug(
"Found bnc: %pFX(%u)(%u)(%p) for peer: %s(%s) %p",
- &bnc->prefix, bnc->ifindex_ipv6_ll,
+ &bnc->prefix, bnc->ifindex,
bnc->srte_color, bnc, peer->host,
peer->bgp->name_pretty, peer);
}
bnc->bgp = bgp_nexthop;
if (BGP_DEBUG(nht, NHT))
zlog_debug("Allocated bnc %pFX(%d)(%u)(%s) peer %p",
- &bnc->prefix, bnc->ifindex_ipv6_ll,
- bnc->srte_color, bnc->bgp->name_pretty,
- peer);
+ &bnc->prefix, bnc->ifindex, bnc->srte_color,
+ bnc->bgp->name_pretty, peer);
} else {
if (BGP_DEBUG(nht, NHT))
zlog_debug(
"Found existing bnc %pFX(%d)(%s) flags 0x%x ifindex %d #paths %d peer %p",
- &bnc->prefix, bnc->ifindex_ipv6_ll,
- bnc->bgp->name_pretty, bnc->flags,
- bnc->ifindex_ipv6_ll, bnc->path_count,
- bnc->nht_info);
+ &bnc->prefix, bnc->ifindex,
+ bnc->bgp->name_pretty, bnc->flags, bnc->ifindex,
+ bnc->path_count, bnc->nht_info);
}
if (pi && is_route_parent_evpn(pi))
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
}
- if (peer && (bnc->ifindex_ipv6_ll != ifindex)) {
+ if (peer && (bnc->ifindex != ifindex)) {
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
- bnc->ifindex_ipv6_ll = ifindex;
+ bnc->ifindex = ifindex;
}
if (bgp_route->inst_type == BGP_INSTANCE_TYPE_VIEW) {
SET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
zlog_debug(
"%s(%u): Rcvd NH update %pFX(%u)(%u) - metric %d/%d #nhops %d/%d flags %s",
bnc->bgp->name_pretty, bnc->bgp->vrf_id, &nhr->prefix,
- bnc->ifindex_ipv6_ll, bnc->srte_color, nhr->metric,
- bnc->metric, nhr->nexthop_num, bnc->nexthop_num,
+ bnc->ifindex, bnc->srte_color, nhr->metric, bnc->metric,
+ nhr->nexthop_num, bnc->nexthop_num,
bgp_nexthop_dump_bnc_flags(bnc, bnc_buf,
sizeof(bnc_buf)));
}
struct interface *ifp, bool up)
{
struct bgp_nexthop_cache *bnc;
- struct nexthop *nhop;
- uint8_t other_nh_count;
- bool nhop_found;
frr_each (bgp_nexthop_cache, table, bnc) {
- other_nh_count = 0;
- nhop_found = bnc->ifindex_ipv6_ll == ifp->ifindex;
- for (nhop = bnc->nexthop; nhop; nhop = nhop->next) {
- if (nhop->ifindex == bnc->ifindex_ipv6_ll)
- continue;
-
- if (nhop->ifindex != ifp->ifindex) {
- other_nh_count++;
- continue;
- }
- if (nhop->vrf_id != ifp->vrf->vrf_id) {
- other_nh_count++;
- continue;
- }
- nhop_found = true;
- }
-
- if (!nhop_found)
- /* The event interface does not match the nexthop cache
- * entry */
- continue;
-
- if (!up && other_nh_count > 0)
- /* Down event ignored in case of multiple next-hop
- * interfaces. The other might interfaces might be still
- * up. The cases where all interfaces are down or a bnc
- * is invalid are processed by a separate zebra rnh
- * messages.
- */
+ if (bnc->ifindex != ifp->ifindex)
continue;
bnc->last_update = monotime(NULL);
if (!bnc)
return;
- if (bnc->ifindex_ipv6_ll)
+ if (bnc->ifindex)
event_add_event(bm->master, bgp_nht_ifp_initial, bnc->bgp,
- bnc->ifindex_ipv6_ll, NULL);
+ bnc->ifindex, NULL);
}
void bgp_parse_nexthop_update(int command, vrf_id_t vrf_id)
if (bnc->flags & BGP_NEXTHOP_REGISTERED)
return;
- if (bnc->ifindex_ipv6_ll) {
+ if (bnc->ifindex) {
SET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
return;
}
if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED))
return;
- if (bnc->ifindex_ipv6_ll) {
+ if (bnc->ifindex) {
UNSET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
return;
}
zlog_debug(
"NH update for %pFX(%d)(%u)(%s) - flags %s chgflags %s- evaluate paths",
- &bnc->prefix, bnc->ifindex_ipv6_ll, bnc->srte_color,
+ &bnc->prefix, bnc->ifindex, bnc->srte_color,
bnc->bgp->name_pretty,
bgp_nexthop_dump_bnc_flags(bnc, bnc_buf,
sizeof(bnc_buf)),