summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c50
1 files changed, 33 insertions, 17 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 1204da92fb..26dd48733e 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -305,6 +305,8 @@ struct nexthop *route_entry_nexthop_ipv6_ifindex_add(struct route_entry *re,
nexthop->type = NEXTHOP_TYPE_IPV6_IFINDEX;
nexthop->gate.ipv6 = *ipv6;
nexthop->ifindex = ifindex;
+ if (CHECK_FLAG(re->flags, ZEBRA_FLAG_EVPN_ROUTE))
+ SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK);
route_entry_nexthop_add(re, nexthop);
@@ -421,6 +423,10 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
re->nexthop_mtu = 0;
}
+ /* Next hops (remote VTEPs) for EVPN routes are fully resolved. */
+ if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN_RVTEP))
+ return 1;
+
/* Skip nexthops that have been filtered out due to route-map */
/* The nexthops are specific to this route and so the same */
/* nexthop for a different route may not have this flag set */
@@ -679,7 +685,8 @@ struct route_entry *rib_match_ipv4_multicast(vrf_id_t vrf_id,
char buf[BUFSIZ];
inet_ntop(AF_INET, &addr, buf, BUFSIZ);
- zlog_debug("%s: %s: found %s, using %s", __func__, buf,
+ zlog_debug("%s: %s: vrf: %u found %s, using %s",
+ __func__, buf, vrf_id,
mre ? (ure ? "MRIB+URIB" : "MRIB")
: ure ? "URIB" : "nothing",
re == ure ? "URIB" : re == mre ? "MRIB" : "none");
@@ -859,9 +866,7 @@ static unsigned nexthop_active_check(struct route_node *rn,
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV4_IFINDEX:
family = AFI_IP;
- if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN_RVTEP))
- SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
- else if (nexthop_active(AFI_IP, re, nexthop, set, rn))
+ if (nexthop_active(AFI_IP, re, nexthop, set, rn))
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
else
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
@@ -1604,9 +1609,9 @@ static void rib_process(struct route_node *rn)
if (re != old_selected) {
if (IS_ZEBRA_DEBUG_RIB)
zlog_debug(
- "%s: %s: imported via import-table but denied "
+ "%s: %u:%s: imported via import-table but denied "
"by the ip protocol table route-map",
- __func__, buf);
+ __func__, vrf_id, buf);
rib_unlink(rn, re);
} else
SET_FLAG(re->status,
@@ -1860,6 +1865,7 @@ static const u_char meta_queue_map[ZEBRA_ROUTE_MAX] = {
[ZEBRA_ROUTE_VNC_DIRECT_RH] = 3,
[ZEBRA_ROUTE_BGP_DIRECT] = 3,
[ZEBRA_ROUTE_BGP_DIRECT_EXT] = 3,
+ [ZEBRA_ROUTE_BGP_VPN] = 3,
[ZEBRA_ROUTE_BABEL] = 2,
[ZEBRA_ROUTE_ALL] = 4, // Shouldn't happen but for safety
};
@@ -2187,9 +2193,9 @@ void _route_entry_dump(const char *func, union prefixconstptr pp,
for (ALL_NEXTHOPS(re->ng, nexthop)) {
inet_ntop(p->family, &nexthop->gate, straddr, INET6_ADDRSTRLEN);
- zlog_debug("%s: %s %s[%u] with flags %s%s%s", func,
+ zlog_debug("%s: %s %s[%u] vrf %u with flags %s%s%s", func,
(nexthop->rparent ? " NH" : "NH"), straddr,
- nexthop->ifindex,
+ nexthop->ifindex, nexthop->vrf_id,
(CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE)
? "ACTIVE "
: ""),
@@ -2217,7 +2223,8 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)
/* Lookup table. */
table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id);
if (!table) {
- zlog_err("%s: zebra_vrf_table() returned NULL", __func__);
+ zlog_err("%s:%u zebra_vrf_table() returned NULL",
+ __func__, vrf_id);
return;
}
@@ -2226,7 +2233,7 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)
/* No route for this prefix. */
if (!rn) {
- zlog_debug("%s: lookup failed for %s", __func__,
+ zlog_debug("%s:%u lookup failed for %s", __func__, vrf_id,
prefix2str((struct prefix *)p, prefix_buf,
sizeof(prefix_buf)));
return;
@@ -2237,8 +2244,9 @@ void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id)
/* let's go */
RNODE_FOREACH_RE (rn, re) {
- zlog_debug("%s: rn %p, re %p: %s, %s", __func__, (void *)rn,
- (void *)re,
+ zlog_debug("%s:%u rn %p, re %p: %s, %s",
+ __func__, vrf_id,
+ (void *)rn, (void *)re,
(CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)
? "removed"
: "NOT removed"),
@@ -2262,7 +2270,8 @@ void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id)
rib_dest_t *dest;
if (NULL == (table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id))) {
- zlog_err("%s: zebra_vrf_table() returned NULL", __func__);
+ zlog_err("%s:%u zebra_vrf_table() returned NULL",
+ __func__, vrf_id);
return;
}
@@ -2554,10 +2563,17 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type,
struct ipaddr vtep_ip;
memset(&vtep_ip, 0, sizeof(struct ipaddr));
- vtep_ip.ipa_type = IPADDR_V4;
- memcpy(&(vtep_ip.ipaddr_v4),
- &(tmp_nh->gate.ipv4),
- sizeof(struct in_addr));
+ if (afi == AFI_IP) {
+ vtep_ip.ipa_type = IPADDR_V4;
+ memcpy(&(vtep_ip.ipaddr_v4),
+ &(tmp_nh->gate.ipv4),
+ sizeof(struct in_addr));
+ } else {
+ vtep_ip.ipa_type = IPADDR_V6;
+ memcpy(&(vtep_ip.ipaddr_v6),
+ &(tmp_nh->gate.ipv6),
+ sizeof(struct in6_addr));
+ }
zebra_vxlan_evpn_vrf_route_del(re->vrf_id, rmac,
&vtep_ip, p);
}