summaryrefslogtreecommitdiff
path: root/bgpd/bgp_zebra.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_zebra.c')
-rw-r--r--bgpd/bgp_zebra.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index c1b388b05d..fc7590dcc2 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -1132,6 +1132,7 @@ static bool update_ipv4nh_for_route_install(int nh_othervrf, struct bgp *nh_bgp,
api_nh->type = NEXTHOP_TYPE_IPV4;
else {
api_nh->type = NEXTHOP_TYPE_IPV4_IFINDEX;
+ SET_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN);
SET_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_ONLINK);
api_nh->ifindex = nh_bgp->l3vni_svi_ifindex;
}
@@ -1170,6 +1171,7 @@ static bool update_ipv6nh_for_route_install(int nh_othervrf, struct bgp *nh_bgp,
api_nh->type = NEXTHOP_TYPE_IPV6;
else {
api_nh->type = NEXTHOP_TYPE_IPV6_IFINDEX;
+ SET_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN);
SET_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_ONLINK);
api_nh->ifindex = nh_bgp->l3vni_svi_ifindex;
}
@@ -1268,7 +1270,6 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
mpls_label_t label;
struct bgp_sid_info *sid_info;
int nh_othervrf = 0;
- bool is_evpn;
bool nh_updated = false;
bool do_wt_ecmp;
uint64_t cum_bw = 0;
@@ -1319,11 +1320,6 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
tag = info->attr->tag;
- /* If the route's source is EVPN, flag as such. */
- is_evpn = is_route_parent_evpn(info);
- if (is_evpn)
- SET_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE);
-
if (peer->sort == BGP_PEER_IBGP || peer->sort == BGP_PEER_CONFED
|| info->sub_type == BGP_ROUTE_AGGREGATE) {
SET_FLAG(api.flags, ZEBRA_FLAG_IBGP);
@@ -1364,6 +1360,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
for (; mpinfo; mpinfo = bgp_path_info_mpath_next(mpinfo)) {
uint32_t nh_weight;
+ bool is_evpn;
if (valid_nh_count >= multipath_num)
break;
@@ -1430,6 +1427,8 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
BGP_ORIGINAL_UPDATE(bgp_orig, mpinfo, bgp);
if (nh_family == AF_INET) {
+ is_evpn = is_route_parent_evpn(mpinfo);
+
nh_updated = update_ipv4nh_for_route_install(
nh_othervrf, bgp_orig,
&mpinfo_cp->attr->nexthop, mpinfo_cp->attr,
@@ -1441,6 +1440,8 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
nexthop = bgp_path_info_to_ipv6_nexthop(mpinfo_cp,
&ifindex);
+ is_evpn = is_route_parent_evpn(mpinfo);
+
if (!nexthop)
nh_updated = update_ipv4nh_for_route_install(
nh_othervrf, bgp_orig,
@@ -1465,9 +1466,9 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
|| mpinfo->peer->sort == BGP_PEER_CONFED))
allow_recursion = true;
- if (mpinfo->extra
- && bgp_is_valid_label(&mpinfo->extra->label[0])
- && !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) {
+ if (mpinfo->extra &&
+ bgp_is_valid_label(&mpinfo->extra->label[0]) &&
+ !CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN)) {
mpls_lse_decode(mpinfo->extra->label[0], &label, &ttl,
&exp, &bos);
@@ -1485,8 +1486,8 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
api_nh->weight = nh_weight;
- if (mpinfo->extra && !sid_zero(&mpinfo->extra->sid[0].sid)
- && !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) {
+ if (mpinfo->extra && !sid_zero(&mpinfo->extra->sid[0].sid) &&
+ !CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN)) {
sid_info = &mpinfo->extra->sid[0];
memcpy(&api_nh->seg6_segs, &sid_info->sid,
@@ -1613,19 +1614,21 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
label_buf[0] = '\0';
eth_buf[0] = '\0';
segs_buf[0] = '\0';
- if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_LABEL)
- && !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE))
+ if (CHECK_FLAG(api_nh->flags,
+ ZAPI_NEXTHOP_FLAG_LABEL) &&
+ !CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN))
snprintf(label_buf, sizeof(label_buf),
"label %u", api_nh->labels[0]);
- if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_SEG6)
- && !CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) {
+ if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_SEG6) &&
+ !CHECK_FLAG(api_nh->flags,
+ ZAPI_NEXTHOP_FLAG_EVPN)) {
inet_ntop(AF_INET6, &api_nh->seg6_segs,
sid_buf, sizeof(sid_buf));
snprintf(segs_buf, sizeof(segs_buf), "segs %s",
sid_buf);
}
- if (CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)
- && !is_zero_mac(&api_nh->rmac))
+ if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN) &&
+ !is_zero_mac(&api_nh->rmac))
snprintf(eth_buf, sizeof(eth_buf), " RMAC %s",
prefix_mac2str(&api_nh->rmac,
buf1, sizeof(buf1)));
@@ -1730,10 +1733,6 @@ void bgp_zebra_withdraw(const struct prefix *p, struct bgp_path_info *info,
api.tableid = info->attr->rmap_table_id;
}
- /* If the route's source is EVPN, flag as such. */
- if (is_route_parent_evpn(info))
- SET_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE);
-
if (bgp_debug_zebra(p))
zlog_debug("Tx route delete VRF %u %pFX", bgp->vrf_id,
&api.prefix);