From 1276ce38331b2cc190bd67392b07685d1d35d1ff Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Tue, 9 Jul 2019 10:59:14 +0200 Subject: [PATCH] bgpd: withdraw fib entry on appropriate table identifier There are cases where the table identifier is set on a bgp entry, mainly due to route-map, and associate fib entry needs to be removed. This change encompasses also the route-map reconfiguration that leads to removing the previous entry, whereas bgp update had been triggered ( this happens when software inbound reconfiguration is handled). Signed-off-by: Philippe Guibert --- bgpd/bgp_route.c | 7 +++++++ bgpd/bgp_zebra.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f0629fca08..3f30441f7b 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -3165,6 +3165,13 @@ int bgp_update(struct peer *peer, struct prefix *p, uint32_t addpath_id, goto filtered; } + if (pi && pi->attr && + pi->attr->rmap_table_id != new_attr.rmap_table_id) { + if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED)) + /* remove from RIB previous entry */ + bgp_zebra_withdraw(p, pi, bgp, safi); + } + if (peer->sort == BGP_PEER_EBGP) { /* If we receive the graceful-shutdown community from an eBGP diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index c9dd0f4bcb..7923f076c1 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1499,6 +1499,11 @@ void bgp_zebra_withdraw(struct prefix *p, struct bgp_path_info *info, api.safi = safi; api.prefix = *p; + if (info->attr->rmap_table_id) { + SET_FLAG(api.message, ZAPI_MESSAGE_TABLEID); + 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); -- 2.39.5