}
static int update_ipv4nh_for_route_install(int nh_othervrf,
+ struct bgp *nh_bgp,
struct in_addr *nexthop,
struct attr *attr,
bool is_evpn,
struct zapi_nexthop *api_nh)
{
api_nh->gate.ipv4 = *nexthop;
+ api_nh->vrf_id = nh_bgp->vrf_id;
/* Need to set fields appropriately for EVPN routes imported into
* a VRF (which are programmed as onlink on l3-vni SVI) as well as
* connected routes leaked into a VRF.
*/
- if (is_evpn)
+ if (is_evpn) {
api_nh->type = NEXTHOP_TYPE_IPV4_IFINDEX;
- else if (nh_othervrf &&
+ api_nh->ifindex = nh_bgp->l3vni_svi_ifindex;
+ } else if (nh_othervrf &&
api_nh->gate.ipv4.s_addr == INADDR_ANY) {
api_nh->type = NEXTHOP_TYPE_IFINDEX;
api_nh->ifindex = attr->nh_ifindex;
}
static int
-update_ipv6nh_for_route_install(int nh_othervrf, struct in6_addr *nexthop,
+update_ipv6nh_for_route_install(int nh_othervrf, struct bgp *nh_bgp,
+ struct in6_addr *nexthop,
ifindex_t ifindex, struct bgp_path_info *pi,
struct bgp_path_info *best_pi, bool is_evpn,
struct zapi_nexthop *api_nh)
struct attr *attr;
attr = pi->attr;
+ api_nh->vrf_id = nh_bgp->vrf_id;
- if (is_evpn)
+ if (is_evpn) {
api_nh->type = NEXTHOP_TYPE_IPV6_IFINDEX;
- else if (nh_othervrf) {
+ api_nh->ifindex = nh_bgp->l3vni_svi_ifindex;
+ } else if (nh_othervrf) {
if (IN6_IS_ADDR_UNSPECIFIED(nexthop)) {
api_nh->type = NEXTHOP_TYPE_IFINDEX;
api_nh->ifindex = attr->nh_ifindex;
continue;
api_nh = &api.nexthops[valid_nh_count];
- api_nh->vrf_id = nh_othervrf ? info->extra->bgp_orig->vrf_id
- : bgp->vrf_id;
if (nh_family == AF_INET) {
if (bgp_debug_zebra(&api.prefix)) {
if (mpinfo->extra) {
nh_updated = update_ipv4nh_for_route_install(
nh_othervrf,
+ nh_othervrf ?
+ info->extra->bgp_orig : bgp,
&mpinfo_cp->attr->nexthop,
mpinfo_cp->attr, is_evpn, api_nh);
} else {
nexthop = bgp_path_info_to_ipv6_nexthop(mpinfo_cp,
&ifindex);
nh_updated = update_ipv6nh_for_route_install(
- nh_othervrf, nexthop, ifindex,
+ nh_othervrf, nh_othervrf ?
+ info->extra->bgp_orig : bgp,
+ nexthop, ifindex,
mpinfo, info, is_evpn, api_nh);
}
case NEXTHOP_TYPE_IPV4_IFINDEX:
memset(&vtep_ip, 0, sizeof(struct ipaddr));
- if (CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) {
- ifindex = get_l3vni_svi_ifindex(vrf_id);
- } else {
- ifindex = api_nh->ifindex;
- }
-
+ ifindex = api_nh->ifindex;
if (IS_ZEBRA_DEBUG_RECV) {
char nhbuf[INET6_ADDRSTRLEN] = {0};
break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
memset(&vtep_ip, 0, sizeof(struct ipaddr));
- if (CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) {
- ifindex = get_l3vni_svi_ifindex(vrf_id);
- } else {
- ifindex = api_nh->ifindex;
- }
-
+ ifindex = api_nh->ifindex;
nexthop = route_entry_nexthop_ipv6_ifindex_add(
re, &api_nh->gate.ipv6, ifindex,
api_nh->vrf_id);