summaryrefslogtreecommitdiff
path: root/lib/routemap.c
diff options
context:
space:
mode:
authorStephen Worley <sworley@nvidia.com>2021-05-12 11:58:37 -0400
committerStephen Worley <sworley@nvidia.com>2022-08-23 12:41:25 -0400
commita33b4d3f4c0bd4c0df222d388f2f6a20717717c6 (patch)
tree39f1b39341b4f821e4e0b4c3eafda7aa4e4e88ef /lib/routemap.c
parent0f33e6dfca3528bdd1b079e2f54df493f565481a (diff)
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 <sworley@nvidia.com>
Diffstat (limited to 'lib/routemap.c')
-rw-r--r--lib/routemap.c19
1 files changed, 18 insertions, 1 deletions
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;