From a33b4d3f4c0bd4c0df222d388f2f6a20717717c6 Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Wed, 12 May 2021 11:58:37 -0400 Subject: [PATCH] lib: handle type2/5 routes in optimized route-map Handle matching type2/5 evpn routes via lookup in the optimized route-maps used by plists. Convert the evpn_prefix to ipv4/v6 prefix to perform longest matching on in the tree. Signed-off-by: Stephen Worley --- lib/routemap.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/routemap.c b/lib/routemap.c index 9529b79419..7c733821cf 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -1820,7 +1820,24 @@ route_map_get_index(struct route_map *map, const struct prefix *prefix, struct route_map_index *index = NULL, *best_index = NULL; struct route_map_index *head_index = NULL; struct route_table *table = NULL; - unsigned char family = prefix->family; + struct prefix conv; + unsigned char family; + + /* + * Handling for matching evpn_routes in the prefix table. + * + * We convert type2/5 prefix to ipv4/6 prefix to do longest + * prefix matching on. + */ + if (prefix->family == AF_EVPN) { + if (evpn_prefix2prefix(prefix, &conv) != 0) + return NULL; + + prefix = &conv; + } + + + family = prefix->family; if (family == AF_INET) table = map->ipv4_prefix_table; -- 2.39.5