diff options
author | Mitesh Kanjariya <mitesh@marvel-07.cumulusnetworks.com> | 2018-04-16 10:09:03 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-05-09 01:24:15 +0200 |
commit | 7e4ed18ef5c034d09567c2d2cf26f806e134e698 (patch) | |
tree | 6cc9b4d3e31958a2dcb32bfbc580c5c6c960a743 /bgpd/bgp_route.c | |
parent | bgpd: write route-map to config for advertise type5 commands (diff) | |
download | frr-7e4ed18ef5c034d09567c2d2cf26f806e134e698.tar.xz frr-7e4ed18ef5c034d09567c2d2cf26f806e134e698.zip |
bgpd: apply advertise ipv4 unicast route-map while advertising type-5 routes
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>
Diffstat (limited to '')
-rw-r--r-- | bgpd/bgp_route.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4802a4caa..2a4eab0ad 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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); } |