From: Mitesh Kanjariya Date: Wed, 11 Apr 2018 09:29:46 +0000 (-0700) Subject: bgpd: modify route install/withdraw logic for evpn type-5 routes in vrf X-Git-Tag: frr-6.1-dev~455^2~12 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=2b659f33296f425e54410ceb08741da5d5d53d00;p=mirror%2Ffrr.git bgpd: modify route install/withdraw logic for evpn type-5 routes in vrf We install type-5 routes as ipv4/ipv6 unicast routes in the vrf table. along with these routes, we also install the RMAC and the nexthop Neigh entries. There might be scenarios were the bestpath has changed and we are now pointing to a new nexthop with a different RMAC. As per BGP logic, we just send an update for the route and the nexthop is replaced. However, this causes problem because the RMAC and neigh entry corresponding to the previous nexthop are still lingering in the system. We need to clear those entries for proper functoning. Signed-off-by: Mitesh Kanjariya --- diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 2a4eab0adc..19af159be0 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2336,10 +2336,18 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn, if (new_select && new_select->type == ZEBRA_ROUTE_BGP && (new_select->sub_type == BGP_ROUTE_NORMAL || new_select->sub_type == BGP_ROUTE_AGGREGATE - || new_select->sub_type == BGP_ROUTE_IMPORTED)) + || new_select->sub_type == BGP_ROUTE_IMPORTED)) { + + /* if this is an evpn imported type-5 prefix, + * we need to withdraw the route first to clear + * the nh neigh and the RMAC entry. + */ + if (old_select && + is_route_parent_evpn(old_select)) + bgp_zebra_withdraw(p, old_select, bgp, safi); bgp_zebra_announce(rn, p, new_select, bgp, afi, safi); - else { + } else { /* Withdraw the route from the kernel. */ if (old_select && old_select->type == ZEBRA_ROUTE_BGP && (old_select->sub_type == BGP_ROUTE_NORMAL