]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: route-map fails to filter type-5 routes
authorNitin Soni <nsoni@cumulusnetworks.com>
Thu, 24 Jan 2019 09:43:48 +0000 (01:43 -0800)
committerNitin Soni <nsoni@cumulusnetworks.com>
Thu, 24 Jan 2019 09:43:48 +0000 (01:43 -0800)
Route-map filtering is based on the value of
"bgp->adv_cmd_rmap[afi][safi].map". For example, we advertise routes in
bgp_evpn_advertise_type5_routes() based on the value of
"bgp->adv_cmd_rmap[afi][safi].map". This variable gets populated in vty
handler bgp_evpn_advertise_type5. This variable will not get populated
if we have not yet applied the route-map configuration. The fix is to
correctly populate "bgp->adv_cmd_rmap[afi][safi].map" in
bgp_route_map_process_update() if it has not been populated before.

Ticket: CM-23263
Signed-off-by: Nitin Soni <nsoni@cumulusnetworks.com>
Reviewed-by: CCR-8163
bgpd/bgp_routemap.c

index d7ee2aa19ff44c89aa808461517501acfdfe35e5..4953032f97bcd4dec6d0d04037907b2027e6a702 100644 (file)
@@ -3325,12 +3325,18 @@ static void bgp_route_map_process_update(struct bgp *bgp, const char *rmap_name,
                               != 0)
                        continue;
 
+               /* Make sure the route-map is populated here if not already done */
+               bgp->adv_cmd_rmap[afi][safi].map = map;
+
                if (BGP_DEBUG(zebra, ZEBRA))
                        zlog_debug(
                                "Processing route_map %s update on advertise type5 route command",
                                rmap_name);
-               bgp_evpn_withdraw_type5_routes(bgp, afi, safi);
-               bgp_evpn_advertise_type5_routes(bgp, afi, safi);
+
+               if (route_update) {
+                       bgp_evpn_withdraw_type5_routes(bgp, afi, safi);
+                       bgp_evpn_advertise_type5_routes(bgp, afi, safi);
+               }
        }
 }