From db77a5018d961b807c83043621244970efd98495 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 17 May 2019 07:29:47 -0400 Subject: [PATCH] bgpd: Routemap processing was testing for an impossible flag The flag PEER_FLAG_RSERVER_CLIENT is never set on peer->flags and as such testing the flag for not being set will never cause the if statement to be not entered. Conversely setting update to 0 and then testing if (update && ... will always cause another if statement to be never called, remove it as well. Signed-off-by: Donald Sharp --- bgpd/bgp_routemap.c | 52 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 9ff4196dae..b0ae9d78d1 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3090,8 +3090,6 @@ static void bgp_route_map_process_peer(const char *rmap_name, struct route_map *map, struct peer *peer, int afi, int safi, int route_update) { - - int update; struct bgp_filter *filter; if (!peer || !rmap_name) @@ -3102,52 +3100,16 @@ static void bgp_route_map_process_peer(const char *rmap_name, * in is for non-route-server clients, * out is for all peers */ - if (!CHECK_FLAG(peer->flags, PEER_FLAG_RSERVER_CLIENT)) { - if (filter->map[RMAP_IN].name - && (strcmp(rmap_name, filter->map[RMAP_IN].name) == 0)) { - filter->map[RMAP_IN].map = map; - - if (route_update && peer->status == Established) { - if (CHECK_FLAG(peer->af_flags[afi][safi], - PEER_FLAG_SOFT_RECONFIG)) { - if (bgp_debug_update(peer, NULL, NULL, - 1)) - zlog_debug( - "Processing route_map %s update on " - "peer %s (inbound, soft-reconfig)", - rmap_name, peer->host); - - bgp_soft_reconfig_in(peer, afi, safi); - } else if ( - CHECK_FLAG(peer->cap, - PEER_CAP_REFRESH_OLD_RCV) - || CHECK_FLAG( - peer->cap, - PEER_CAP_REFRESH_NEW_RCV)) { - - if (bgp_debug_update(peer, NULL, NULL, - 1)) - zlog_debug( - "Processing route_map %s update on " - "peer %s (inbound, route-refresh)", - rmap_name, peer->host); - bgp_route_refresh_send(peer, afi, safi, - 0, 0, 0); - } - } - } - } - - if (CHECK_FLAG(peer->flags, PEER_FLAG_RSERVER_CLIENT)) { - update = 0; + if (filter->map[RMAP_IN].name + && (strcmp(rmap_name, filter->map[RMAP_IN].name) == 0)) { + filter->map[RMAP_IN].map = map; - if (update && route_update && peer->status == Established) { + if (route_update && peer->status == Established) { if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG)) { if (bgp_debug_update(peer, NULL, NULL, 1)) zlog_debug( - "Processing route_map %s update on " - "peer %s (import, soft-reconfig)", + "Processing route_map %s update on peer %s (inbound, soft-reconfig)", rmap_name, peer->host); bgp_soft_reconfig_in(peer, afi, safi); @@ -3157,13 +3119,11 @@ static void bgp_route_map_process_peer(const char *rmap_name, PEER_CAP_REFRESH_NEW_RCV)) { if (bgp_debug_update(peer, NULL, NULL, 1)) zlog_debug( - "Processing route_map %s update on " - "peer %s (import, route-refresh)", + "Processing route_map %s update on peer %s (inbound, route-refresh)", rmap_name, peer->host); bgp_route_refresh_send(peer, afi, safi, 0, 0, 0); } - /* DD: Else, what else do we do ? Reset peer ? */ } } -- 2.39.5