Skip to content

Commit 439b739

Browse files
committed
lib: Do not convert EVPN prefixes into IPv4/IPv6 if not needed
Convert only when this is really needed, e.g. `match ip address prefix-list ...`. Otherwise, we can't have mixed match clauses, like: ``` match ip address prefix-list p1 match evpn route-type prefix ``` This won't work, because the prefix is already converted, and we can't extract route type, vni, etc. from the original EVPN prefix. Signed-off-by: Donatas Abraitis <[email protected]>
1 parent 2fd5e51 commit 439b739

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

lib/routemap.c

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2548,7 +2548,6 @@ route_map_result_t route_map_apply_ext(struct route_map *map,
25482548
struct route_map_index *index = NULL;
25492549
struct route_map_rule *set = NULL;
25502550
bool skip_match_clause = false;
2551-
struct prefix conv;
25522551

25532552
if (recursion > RMAP_RECURSION_LIMIT) {
25542553
if (map)
@@ -2571,31 +2570,14 @@ route_map_result_t route_map_apply_ext(struct route_map *map,
25712570

25722571
map->applied++;
25732572

2574-
/*
2575-
* Handling for matching evpn_routes in the prefix table.
2576-
*
2577-
* We convert type2/5 prefix to ipv4/6 prefix to do longest
2578-
* prefix matching on.
2579-
*/
25802573
if (prefix->family == AF_EVPN) {
2581-
if (evpn_prefix2prefix(prefix, &conv) != 0) {
2582-
if (unlikely(CHECK_FLAG(rmap_debug,
2583-
DEBUG_ROUTEMAP_DETAIL)))
2584-
zlog_debug(
2585-
"Unable to convert EVPN prefix %pFX into IPv4/IPv6 prefix. Falling back to non-optimized route-map lookup",
2586-
prefix);
2587-
} else {
2588-
if (unlikely(CHECK_FLAG(rmap_debug,
2589-
DEBUG_ROUTEMAP_DETAIL)))
2590-
zlog_debug(
2591-
"Converted EVPN prefix %pFX into %pFX for optimized route-map lookup",
2592-
prefix, &conv);
2593-
2594-
prefix = &conv;
2595-
}
2574+
index = map->head;
2575+
} else {
2576+
skip_match_clause = true;
2577+
index = route_map_get_index(map, prefix, match_object,
2578+
&match_ret);
25962579
}
25972580

2598-
index = route_map_get_index(map, prefix, match_object, &match_ret);
25992581
if (index) {
26002582
index->applied++;
26012583
if (unlikely(CHECK_FLAG(rmap_debug, DEBUG_ROUTEMAP)))
@@ -2619,7 +2601,6 @@ route_map_result_t route_map_apply_ext(struct route_map *map,
26192601
ret = RMAP_DENYMATCH;
26202602
goto route_map_apply_end;
26212603
}
2622-
skip_match_clause = true;
26232604

26242605
for (; index; index = index->next) {
26252606
if (!skip_match_clause) {

0 commit comments

Comments
 (0)