]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Do not convert EVPN prefixes into IPv4/IPv6 if not needed
authorDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 15 Feb 2024 10:07:43 +0000 (12:07 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 23 Feb 2024 07:37:52 +0000 (09:37 +0200)
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 <donatas@opensourcerouting.org>
(cherry picked from commit 439b739495e86912c8b9ec36b84e55311c549ba0)

lib/routemap.c

index 683943eb6d31ed5f689a4cc24dc6556c50fa1b31..ed7c4ed72cbb0ccca5a5304c603a2b0b52980117 100644 (file)
@@ -2553,7 +2553,6 @@ route_map_result_t route_map_apply_ext(struct route_map *map,
        struct route_map_index *index = NULL;
        struct route_map_rule *set = NULL;
        bool skip_match_clause = false;
-       struct prefix conv;
 
        if (recursion > RMAP_RECURSION_LIMIT) {
                flog_warn(
@@ -2571,27 +2570,14 @@ route_map_result_t route_map_apply_ext(struct route_map *map,
 
        map->applied++;
 
-       /*
-        * 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) {
-                       zlog_debug(
-                               "Unable to convert EVPN prefix %pFX into IPv4/IPv6 prefix. Falling back to non-optimized route-map lookup",
-                               prefix);
-               } else {
-                       zlog_debug(
-                               "Converted EVPN prefix %pFX into %pFX for optimized route-map lookup",
-                               prefix, &conv);
-
-                       prefix = &conv;
-               }
+               index = map->head;
+       } else {
+               skip_match_clause = true;
+               index = route_map_get_index(map, prefix, match_object,
+                                           &match_ret);
        }
 
-       index = route_map_get_index(map, prefix, match_object, &match_ret);
        if (index) {
                index->applied++;
                if (rmap_debug)
@@ -2615,7 +2601,6 @@ route_map_result_t route_map_apply_ext(struct route_map *map,
                        ret = RMAP_DENYMATCH;
                goto route_map_apply_end;
        }
-       skip_match_clause = true;
 
        for (; index; index = index->next) {
                if (!skip_match_clause) {