diff options
author | Donald Sharp <sharpd@nvidia.com> | 2020-10-01 17:18:45 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2021-01-16 01:34:33 +0100 |
commit | cfcd844c0b6fa01bbacf94bd2a18af7bb9e3ea54 (patch) | |
tree | ff5580ae21edf53842d3546b3eaf582ce96bb6b6 /zebra/zebra_routemap.c | |
parent | zebra: Allow rib_update_table to receive a specified route type (diff) | |
download | frr-cfcd844c0b6fa01bbacf94bd2a18af7bb9e3ea54.tar.xz frr-cfcd844c0b6fa01bbacf94bd2a18af7bb9e3ea54.zip |
zebra: Limit routemap changes to reconsider only routes associated with that rm
Current code when a route map changes schedules a rerun of all routes in the
particular table. So if you modify the `ip protocol XX route-map FOO`
route-map `FOO` all routes will be rechecked. This is extremely expensive.
Modify zebra to only update the routes associated with the route-map. So
if we have 800k bgp routes and 50 ospf routes and we are route-map'ing
the ospf routes we'll only look at 50 routes.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra/zebra_routemap.c')
-rw-r--r-- | zebra/zebra_routemap.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index e99232d55..42d27b369 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -268,7 +268,7 @@ static int ip_protocol_rm_add(struct zebra_vrf *zvrf, const char *rmap, table = zebra_vrf_table(afi, safi, zvrf->vrf->vrf_id); if (table) rib_update_table(table, RIB_UPDATE_RMAP_CHANGE, - ZEBRA_ROUTE_ALL); + rtype); } return CMD_SUCCESS; @@ -296,7 +296,7 @@ static int ip_protocol_rm_del(struct zebra_vrf *zvrf, const char *rmap, table = zebra_vrf_table(afi, safi, zvrf->vrf->vrf_id); if (table) rib_update_table(table, RIB_UPDATE_RMAP_CHANGE, - ZEBRA_ROUTE_ALL); + rtype); } XFREE(MTYPE_ROUTE_MAP_NAME, PROTO_RM_NAME(zvrf, afi, rtype)); } @@ -1456,8 +1456,6 @@ static void zebra_rib_table_rm_update(const char *rmap) struct vrf *vrf = NULL; struct zebra_vrf *zvrf = NULL; char *rmap_name; - char afi_ip = 0; - char afi_ipv6 = 0; struct route_map *old = NULL; RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { @@ -1488,17 +1486,12 @@ static void zebra_rib_table_rm_update(const char *rmap) PROTO_RM_MAP(zvrf, AFI_IP, i)); /* There is single rib table for all protocols */ - if (afi_ip == 0) { - table = zvrf->table[AFI_IP] - [SAFI_UNICAST]; - if (table) { - - afi_ip = 1; - rib_update_table( - table, - RIB_UPDATE_RMAP_CHANGE, - ZEBRA_ROUTE_ALL); - } + table = zvrf->table[AFI_IP][SAFI_UNICAST]; + if (table) { + rib_update_table( + table, + RIB_UPDATE_RMAP_CHANGE, + i); } } rmap_name = PROTO_RM_NAME(zvrf, AFI_IP6, i); @@ -1518,17 +1511,12 @@ static void zebra_rib_table_rm_update(const char *rmap) PROTO_RM_MAP(zvrf, AFI_IP6, i)); /* There is single rib table for all protocols */ - if (afi_ipv6 == 0) { - table = zvrf->table[AFI_IP6] - [SAFI_UNICAST]; - if (table) { - - afi_ipv6 = 1; - rib_update_table( - table, - RIB_UPDATE_RMAP_CHANGE, - ZEBRA_ROUTE_ALL); - } + table = zvrf->table[AFI_IP6][SAFI_UNICAST]; + if (table) { + rib_update_table( + table, + RIB_UPDATE_RMAP_CHANGE, + i); } } } |