]> git.proxmox.com Git - pve-network.git/blobdiff - PVE/Network/SDN/Zones/Plugin.pm
controllers: improve bgp-evpn
[pve-network.git] / PVE / Network / SDN / Zones / Plugin.pm
index 6fc13eb4228626f77e531a096e2244460bff36f6..aa795a39d001b4b87166f4ae95529c7add2ec483 100644 (file)
@@ -274,10 +274,17 @@ sub get_local_route_ip {
 
 
 sub find_local_ip_interface_peers {
-    my ($peers) = @_;
+    my ($peers, $iface) = @_;
 
     my $network_config = PVE::INotify::read_file('interfaces');
     my $ifaces = $network_config->{ifaces};
+    
+    #if iface is defined, return ip if exist (if not,try to find it on other ifaces)
+    if ($iface) {
+       my $ip = $ifaces->{$iface}->{address};
+       return ($ip,$iface) if $ip;
+    }
+
     #is a local ip member of peers list ?
     foreach my $address (@{$peers}) {
        while (my $interface = each %$ifaces) {