[pve-devel] [PATCH pve-network 2/4] controllers: evpn: bugfix: use prefix-list in route-map instead evpn match

Alexandre Derumier aderumier at odiso.com
Sun Dec 3 16:46:08 CET 2023


"match evpn" in route-map is broken since 8.5.0
https://github.com/FRRouting/frr/issues/14419

the patch
https://github.com/FRRouting/frr/commit/272c6d5db128ff7450fe9fcd16c046160594deb3
is converting type-2 && type-5 evpn routes to prefix-prefix.
(fixing prefix-list not working previously, but breaking "match evpn")

So, simply use prefix-list now, as "match epvn" was a workaround anyway.

reported on the forum, where user have routing loop between the 2 exit-nodes:
https://forum.proxmox.com/threads/sdn-with-evpn-controller-routing-loop-when-using-multiple-exit-nodes.137362/

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 26 ++++++++++++++-----
 .../evpn/exitnode/expected_controller_config  | 13 +++++++---
 .../expected_controller_config                | 13 +++++++---
 .../expected_controller_config                | 12 +++++++--
 .../exitnode_snat/expected_controller_config  | 13 +++++++---
 .../expected_controller_config                | 20 ++++++++++----
 6 files changed, 74 insertions(+), 23 deletions(-)

diff --git a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index e536226..f1605a3 100644
--- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -188,22 +188,34 @@ sub generate_controller_zone_config {
 
     if ($is_gateway) {
 
+	$config->{frr_prefix_list}->{'only_default'}->{1} = "permit 0.0.0.0/0";
+	$config->{frr_prefix_list_v6}->{'only_default_v6'}->{1} = "permit ::/0";
+
 	if (!$exitnodes_primary || $exitnodes_primary eq $local_node) {
-	    #filter default type5 route coming from other exit nodes on primary node or both nodes if no primary is defined.
+	    #filter default route coming from other exit nodes on primary node or both nodes if no primary is defined.
+	    my $routemap_config_v6 = ();
+	    push @{$routemap_config_v6}, "match ip address prefix-list only_default_v6";
+	    my $routemap_v6 = { rule => $routemap_config_v6, action => "deny" };
+	    unshift(@{$config->{frr_routemap}->{'MAP_VTEP_IN'}}, $routemap_v6);
+
 	    my $routemap_config = ();
-	    push @{$routemap_config}, "match evpn vni $vrfvxlan";
-	    push @{$routemap_config}, "match evpn route-type prefix";
+	    push @{$routemap_config}, "match ip address prefix-list only_default";
 	    my $routemap = { rule => $routemap_config, action => "deny" };
 	    unshift(@{$config->{frr_routemap}->{'MAP_VTEP_IN'}}, $routemap);
+
 	} elsif ($exitnodes_primary ne $local_node) {
+	    my $routemap_config_v6 = ();
+	    push @{$routemap_config_v6}, "match ipv6 address prefix-list only_default_v6";
+	    push @{$routemap_config_v6}, "set metric 200";
+	    my $routemap_v6 = { rule => $routemap_config_v6, action => "permit" };
+	    unshift(@{$config->{frr_routemap}->{'MAP_VTEP_OUT'}}, $routemap_v6);
+
 	    my $routemap_config = ();
-	    push @{$routemap_config}, "match evpn vni $vrfvxlan";
-	    push @{$routemap_config}, "match evpn route-type prefix";
+	    push @{$routemap_config}, "match ip address prefix-list only_default";
 	    push @{$routemap_config}, "set metric 200";
 	    my $routemap = { rule => $routemap_config, action => "permit" };
 	    unshift(@{$config->{frr_routemap}->{'MAP_VTEP_OUT'}}, $routemap);
-        }
-
+	}
 
 	if (!$exitnodes_local_routing) {
 	    @controller_config = ();
diff --git a/src/test/zones/evpn/exitnode/expected_controller_config b/src/test/zones/evpn/exitnode/expected_controller_config
index 598233f..f327e34 100644
--- a/src/test/zones/evpn/exitnode/expected_controller_config
+++ b/src/test/zones/evpn/exitnode/expected_controller_config
@@ -56,12 +56,19 @@ router bgp 65000 vrf vrf_myzone
  exit-address-family
 exit
 !
+ip prefix-list only_default seq 1 permit 0.0.0.0/0
+!
+ipv6 prefix-list only_default_v6 seq 1 permit ::/0
+!
 route-map MAP_VTEP_IN deny 1
- match evpn vni 1000
- match evpn route-type prefix
+ match ip address prefix-list only_default
+exit
+!
+route-map MAP_VTEP_IN deny 2
+ match ip address prefix-list only_default_v6
 exit
 !
-route-map MAP_VTEP_IN permit 2
+route-map MAP_VTEP_IN permit 3
 exit
 !
 route-map MAP_VTEP_OUT permit 1
diff --git a/src/test/zones/evpn/exitnode_local_routing/expected_controller_config b/src/test/zones/evpn/exitnode_local_routing/expected_controller_config
index 8c8e485..5b96cd8 100644
--- a/src/test/zones/evpn/exitnode_local_routing/expected_controller_config
+++ b/src/test/zones/evpn/exitnode_local_routing/expected_controller_config
@@ -40,12 +40,19 @@ router bgp 65000 vrf vrf_myzone
  exit-address-family
 exit
 !
+ip prefix-list only_default seq 1 permit 0.0.0.0/0
+!
+ipv6 prefix-list only_default_v6 seq 1 permit ::/0
+!
 route-map MAP_VTEP_IN deny 1
- match evpn vni 1000
- match evpn route-type prefix
+ match ip address prefix-list only_default
+exit
+!
+route-map MAP_VTEP_IN deny 2
+ match ip address prefix-list only_default_v6
 exit
 !
-route-map MAP_VTEP_IN permit 2
+route-map MAP_VTEP_IN permit 3
 exit
 !
 route-map MAP_VTEP_OUT permit 1
diff --git a/src/test/zones/evpn/exitnode_primary/expected_controller_config b/src/test/zones/evpn/exitnode_primary/expected_controller_config
index ec73a38..b7f2db5 100644
--- a/src/test/zones/evpn/exitnode_primary/expected_controller_config
+++ b/src/test/zones/evpn/exitnode_primary/expected_controller_config
@@ -56,16 +56,24 @@ router bgp 65000 vrf vrf_myzone
  exit-address-family
 exit
 !
+ip prefix-list only_default seq 1 permit 0.0.0.0/0
+!
+ipv6 prefix-list only_default_v6 seq 1 permit ::/0
+!
 route-map MAP_VTEP_IN permit 1
 exit
 !
 route-map MAP_VTEP_OUT permit 1
- match evpn vni 1000
- match evpn route-type prefix
+ match ip address prefix-list only_default
  set metric 200
 exit
 !
 route-map MAP_VTEP_OUT permit 2
+ match ipv6 address prefix-list only_default_v6
+ set metric 200
+exit
+!
+route-map MAP_VTEP_OUT permit 3
 exit
 !
 line vty
diff --git a/src/test/zones/evpn/exitnode_snat/expected_controller_config b/src/test/zones/evpn/exitnode_snat/expected_controller_config
index 598233f..f327e34 100644
--- a/src/test/zones/evpn/exitnode_snat/expected_controller_config
+++ b/src/test/zones/evpn/exitnode_snat/expected_controller_config
@@ -56,12 +56,19 @@ router bgp 65000 vrf vrf_myzone
  exit-address-family
 exit
 !
+ip prefix-list only_default seq 1 permit 0.0.0.0/0
+!
+ipv6 prefix-list only_default_v6 seq 1 permit ::/0
+!
 route-map MAP_VTEP_IN deny 1
- match evpn vni 1000
- match evpn route-type prefix
+ match ip address prefix-list only_default
+exit
+!
+route-map MAP_VTEP_IN deny 2
+ match ip address prefix-list only_default_v6
 exit
 !
-route-map MAP_VTEP_IN permit 2
+route-map MAP_VTEP_IN permit 3
 exit
 !
 route-map MAP_VTEP_OUT permit 1
diff --git a/src/test/zones/evpn/exitnodenullroute/expected_controller_config b/src/test/zones/evpn/exitnodenullroute/expected_controller_config
index 7dc8517..1728c02 100644
--- a/src/test/zones/evpn/exitnodenullroute/expected_controller_config
+++ b/src/test/zones/evpn/exitnodenullroute/expected_controller_config
@@ -84,17 +84,27 @@ router bgp 65000 vrf vrf_myzone2
  exit-address-family
 exit
 !
+ip prefix-list only_default seq 1 permit 0.0.0.0/0
+!
+ipv6 prefix-list only_default_v6 seq 1 permit ::/0
+!
 route-map MAP_VTEP_IN deny 1
- match evpn vni 1001
- match evpn route-type prefix
+ match ip address prefix-list only_default
 exit
 !
 route-map MAP_VTEP_IN deny 2
- match evpn vni 1000
- match evpn route-type prefix
+ match ip address prefix-list only_default_v6
+exit
+!
+route-map MAP_VTEP_IN deny 3
+ match ip address prefix-list only_default
+exit
+!
+route-map MAP_VTEP_IN deny 4
+ match ip address prefix-list only_default_v6
 exit
 !
-route-map MAP_VTEP_IN permit 3
+route-map MAP_VTEP_IN permit 5
 exit
 !
 route-map MAP_VTEP_OUT permit 1
-- 
2.39.2




More information about the pve-devel mailing list