forked from Mirror/frr
lib, zebra: Fix EVPN nexthop config order
Delay EVPN route addition to synchronize with rib_delete(), which now uses early route queue. Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
This commit is contained in:
parent
49f0484113
commit
cea3f7f25a
|
@ -797,6 +797,7 @@ void nexthop_copy_no_recurse(struct nexthop *copy,
|
||||||
memcpy(©->gate, &nexthop->gate, sizeof(nexthop->gate));
|
memcpy(©->gate, &nexthop->gate, sizeof(nexthop->gate));
|
||||||
memcpy(©->src, &nexthop->src, sizeof(nexthop->src));
|
memcpy(©->src, &nexthop->src, sizeof(nexthop->src));
|
||||||
memcpy(©->rmap_src, &nexthop->rmap_src, sizeof(nexthop->rmap_src));
|
memcpy(©->rmap_src, &nexthop->rmap_src, sizeof(nexthop->rmap_src));
|
||||||
|
memcpy(©->rmac, &nexthop->rmac, sizeof(nexthop->rmac));
|
||||||
copy->rparent = rparent;
|
copy->rparent = rparent;
|
||||||
if (nexthop->nh_label)
|
if (nexthop->nh_label)
|
||||||
nexthop_add_labels(copy, nexthop->nh_label_type,
|
nexthop_add_labels(copy, nexthop->nh_label_type,
|
||||||
|
|
|
@ -125,6 +125,12 @@ struct nexthop {
|
||||||
vni_t vni;
|
vni_t vni;
|
||||||
} nh_encap;
|
} nh_encap;
|
||||||
|
|
||||||
|
/* EVPN router's MAC.
|
||||||
|
* Don't support multiple RMAC from the same VTEP yet, so it's not
|
||||||
|
* included in hash key.
|
||||||
|
*/
|
||||||
|
struct ethaddr rmac;
|
||||||
|
|
||||||
/* SR-TE color used for matching SR-TE policies */
|
/* SR-TE color used for matching SR-TE policies */
|
||||||
uint32_t srte_color;
|
uint32_t srte_color;
|
||||||
|
|
||||||
|
|
|
@ -1558,7 +1558,6 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh,
|
||||||
uint16_t backup_nexthop_num)
|
uint16_t backup_nexthop_num)
|
||||||
{
|
{
|
||||||
struct nexthop *nexthop = NULL;
|
struct nexthop *nexthop = NULL;
|
||||||
struct ipaddr vtep_ip;
|
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
int i;
|
int i;
|
||||||
char nhbuf[INET6_ADDRSTRLEN] = "";
|
char nhbuf[INET6_ADDRSTRLEN] = "";
|
||||||
|
@ -1594,13 +1593,8 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh,
|
||||||
* the nexthop and associated MAC need to be installed.
|
* the nexthop and associated MAC need to be installed.
|
||||||
*/
|
*/
|
||||||
if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN)) {
|
if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN)) {
|
||||||
memset(&vtep_ip, 0, sizeof(vtep_ip));
|
|
||||||
vtep_ip.ipa_type = IPADDR_V4;
|
|
||||||
memcpy(&(vtep_ip.ipaddr_v4), &(api_nh->gate.ipv4),
|
|
||||||
sizeof(struct in_addr));
|
|
||||||
zebra_rib_queue_evpn_route_add(
|
|
||||||
api_nh->vrf_id, &api_nh->rmac, &vtep_ip, p);
|
|
||||||
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN);
|
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN);
|
||||||
|
nexthop->rmac = api_nh->rmac;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NEXTHOP_TYPE_IPV6:
|
case NEXTHOP_TYPE_IPV6:
|
||||||
|
@ -1628,13 +1622,8 @@ static struct nexthop *nexthop_from_zapi(const struct zapi_nexthop *api_nh,
|
||||||
* the nexthop and associated MAC need to be installed.
|
* the nexthop and associated MAC need to be installed.
|
||||||
*/
|
*/
|
||||||
if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN)) {
|
if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN)) {
|
||||||
memset(&vtep_ip, 0, sizeof(vtep_ip));
|
|
||||||
vtep_ip.ipa_type = IPADDR_V6;
|
|
||||||
memcpy(&vtep_ip.ipaddr_v6, &(api_nh->gate.ipv6),
|
|
||||||
sizeof(struct in6_addr));
|
|
||||||
zebra_rib_queue_evpn_route_add(
|
|
||||||
api_nh->vrf_id, &api_nh->rmac, &vtep_ip, p);
|
|
||||||
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN);
|
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN);
|
||||||
|
nexthop->rmac = api_nh->rmac;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NEXTHOP_TYPE_BLACKHOLE:
|
case NEXTHOP_TYPE_BLACKHOLE:
|
||||||
|
|
|
@ -2706,6 +2706,8 @@ static void process_subq_early_route_add(struct zebra_early_route *ere)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
struct nexthop *tmp_nh;
|
||||||
|
|
||||||
/* Lookup nhe from route information */
|
/* Lookup nhe from route information */
|
||||||
nhe = zebra_nhg_rib_find_nhe(ere->re_nhe, ere->afi);
|
nhe = zebra_nhg_rib_find_nhe(ere->re_nhe, ere->afi);
|
||||||
if (!nhe) {
|
if (!nhe) {
|
||||||
|
@ -2723,6 +2725,22 @@ static void process_subq_early_route_add(struct zebra_early_route *ere)
|
||||||
early_route_memory_free(ere);
|
early_route_memory_free(ere);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
for (ALL_NEXTHOPS(nhe->nhg, tmp_nh)) {
|
||||||
|
if (CHECK_FLAG(tmp_nh->flags, NEXTHOP_FLAG_EVPN)) {
|
||||||
|
struct ipaddr vtep_ip = {};
|
||||||
|
|
||||||
|
if (ere->afi == AFI_IP) {
|
||||||
|
vtep_ip.ipa_type = IPADDR_V4;
|
||||||
|
vtep_ip.ipaddr_v4 = tmp_nh->gate.ipv4;
|
||||||
|
} else {
|
||||||
|
vtep_ip.ipa_type = IPADDR_V6;
|
||||||
|
vtep_ip.ipaddr_v6 = tmp_nh->gate.ipv6;
|
||||||
|
}
|
||||||
|
zebra_rib_queue_evpn_route_add(
|
||||||
|
re->vrf_id, &tmp_nh->rmac, &vtep_ip,
|
||||||
|
&ere->p);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue