diff options
Diffstat (limited to 'bgpd/bgp_zebra.c')
| -rw-r--r-- | bgpd/bgp_zebra.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 5d43645c6e..12bc2e41bc 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1179,6 +1179,8 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, int nh_updated; bool do_wt_ecmp; uint64_t cum_bw = 0; + uint32_t nhg_id = 0; + bool is_add; /* Don't try to install if we're not connected to Zebra or Zebra doesn't * know of this instance. @@ -1257,7 +1259,17 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, if (do_wt_ecmp) cum_bw = bgp_path_info_mpath_cumbw(info); - for (mpinfo = info; mpinfo; mpinfo = bgp_path_info_mpath_next(mpinfo)) { + /* EVPN MAC-IP routes are installed with a L3 NHG id */ + if (bgp_evpn_path_es_use_nhg(bgp, info, &nhg_id)) { + mpinfo = NULL; + api.nhgid = nhg_id; + if (nhg_id) + SET_FLAG(api.message, ZAPI_MESSAGE_NHG); + } else { + mpinfo = info; + } + + for (; mpinfo; mpinfo = bgp_path_info_mpath_next(mpinfo)) { uint32_t nh_weight; if (valid_nh_count >= multipath_num) @@ -1395,6 +1407,8 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, valid_nh_count++; } + is_add = (valid_nh_count || nhg_id) ? true : false; + /* * When we create an aggregate route we must also * install a Null0 route in the RIB, so overwrite @@ -1428,9 +1442,10 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, zlog_debug( "Tx route %s VRF %u %pFX metric %u tag %" ROUTE_TAG_PRI - " count %d", + " count %d nhg %d", valid_nh_count ? "add" : "delete", bgp->vrf_id, - &api.prefix, api.metric, api.tag, api.nexthop_num); + &api.prefix, api.metric, api.tag, api.nexthop_num, + nhg_id); for (i = 0; i < api.nexthop_num; i++) { api_nh = &api.nexthops[i]; @@ -1487,8 +1502,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, __func__, buf_prefix, (recursion_flag ? "" : "NOT ")); } - zclient_route_send(valid_nh_count ? ZEBRA_ROUTE_ADD - : ZEBRA_ROUTE_DELETE, + zclient_route_send(is_add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, zclient, &api); } @@ -1820,7 +1834,6 @@ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type, vrf_bitmap_unset(zclient->redist[afi][type], bgp->vrf_id); } - if (bgp_install_info_to_zebra(bgp)) { /* Send distribute delete message to zebra. */ if (BGP_DEBUG(zebra, ZEBRA)) |
