[pve-devel] [PATCH V2 pve-network 5/7] zones: evpn: fix exitnodes for snat

Alexandre Derumier aderumier at odiso.com
Thu Dec 3 10:19:40 CET 2020


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Network/SDN/Controllers/EvpnPlugin.pm | 3 ++-
 PVE/Network/SDN/Zones/EvpnPlugin.pm       | 9 ++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index b997cca..6927921 100644
--- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -144,7 +144,8 @@ sub generate_controller_zone_config {
 	push(@{$config->{frr}->{router}->{"bgp $asn vrf $vrf"}->{"address-family"}->{"l2vpn evpn"}}, "route-target export $autortas:$vrfvxlan");
     }
 
-    my $is_gateway = grep { $_ eq $local_node } PVE::Tools::split_list($exitnodes);
+    my $is_gateway = $exitnodes->{$local_node};
+
     if ($is_gateway) {
 
 	@controller_config = ();
diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm b/PVE/Network/SDN/Zones/EvpnPlugin.pm
index d833641..e6ee839 100644
--- a/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -100,12 +100,11 @@ sub generate_sdn_config {
 	    push @iface_config, "address $gateway/$mask" if !defined($address->{$gateway});
 	    $address->{$gateway} = 1;
 	}
+
 	if ($subnet->{snat}) {
-	    my $gatewaynodes = $controller->{'gateway-nodes'};
-	    my $is_evpn_gateway = "";
-	    foreach my $evpn_gatewaynode (PVE::Tools::split_list($gatewaynodes)) {
-		$is_evpn_gateway = 1 if $evpn_gatewaynode eq $local_node;
-	    }
+
+	    my $is_evpn_gateway = $plugin_config->{'exitnodes'}->{$local_node};
+
             #find outgoing interface
             my ($outip, $outiface) = PVE::Network::SDN::Zones::Plugin::get_local_route_ip('8.8.8.8');
             if ($outip && $outiface && $is_evpn_gateway) {
-- 
2.20.1





More information about the pve-devel mailing list