]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: apply advertise ipv4 unicast route-map while advertising type-5 routes
authorMitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com>
Mon, 16 Apr 2018 08:09:03 +0000 (01:09 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 8 May 2018 23:24:15 +0000 (19:24 -0400)
A newly added ipv4/ipv6 route in BGP RIB might be advertised as type-5 EVPN route.
The user might have configured a route-map for advertising type-5 routes.
We need to apply this route-map while advertising ipv4/ipv6 routes as type-5.

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
bgpd/bgp_route.c

index 4802a4caa54895cb89e026f7b0364ee54885d1e6..2a4eab0adcfd53a6f453ff448eabf2b26862c739 100644 (file)
@@ -2353,12 +2353,30 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
        /* advertise/withdraw type-5 routes */
        if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) {
                if (advertise_type5_routes(bgp, afi) && new_select &&
-                   (!new_select->extra || !new_select->extra->parent))
-                       bgp_evpn_advertise_type5_route(bgp, &rn->p,
-                                                      new_select->attr,
-                                                      afi, safi);
-               else if (advertise_type5_routes(bgp, afi) && old_select &&
-                        (!old_select->extra || !old_select->extra->parent))
+                   (!new_select->extra || !new_select->extra->parent)) {
+
+                       /* apply the route-map */
+                       if (bgp->adv_cmd_rmap[afi][safi].map) {
+                               int ret = 0;
+
+                               ret =
+                                       route_map_apply(
+                                               bgp->adv_cmd_rmap[afi][safi].map,
+                                               &rn->p, RMAP_BGP, new_select);
+                               if (ret == RMAP_MATCH)
+                                       bgp_evpn_advertise_type5_route(bgp,
+                                                                      &rn->p,
+                                                                      new_select->attr,
+                                                                      afi, safi);
+                       } else {
+                               bgp_evpn_advertise_type5_route(bgp,
+                                                              &rn->p,
+                                                              new_select->attr,
+                                                              afi, safi);
+
+                       }
+               } else if (advertise_type5_routes(bgp, afi) && old_select &&
+                        (!old_select->extra || !old_select->extra->parent))
                        bgp_evpn_withdraw_type5_route(bgp, &rn->p, afi, safi);
        }