all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH network] sdn: zones: ignore failed peer route lookups
@ 2026-09-08 12:38 Gabriel Goller
  0 siblings, 0 replies; only message in thread
From: Gabriel Goller @ 2026-09-08 12:38 UTC (permalink / raw)
  To: pve-devel

If `ip route get` fails for a peer, find_local_ip_interface_peers()
dies and we stop generating the vnet config. Applying the result then
removes the bridge and vxlan interface.

This rarely happens because most setups have a default route, so the
lookup usually succeeds even if the peer cannot be reached.

When the `ip route get` lookup for a peer fails, ignore it and write the
peers to the config anyway. This is a lot better than failing silently
and removing the existing config. Also fix this for the evpn zone.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/SDN/Zones/EvpnPlugin.pm  | 2 ++
 src/PVE/Network/SDN/Zones/Plugin.pm      | 6 ++++--
 src/PVE/Network/SDN/Zones/VxlanPlugin.pm | 5 ++++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
index 65fdc67f2cba..5cbe6e8694dd 100644
--- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -178,6 +178,8 @@ sub generate_sdn_config {
 
         ($ifaceip, $iface) =
             PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers, $loopback);
+        log_warn("EVPN zone $zoneid, VNet $vnetid: no local address found for peers")
+            if !defined($ifaceip);
     } elsif ($controller->{fabric}) {
         my $config = PVE::Network::SDN::Fabrics::config(1);
 
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index 74a3384cd7ae..4a0c93d9db1f 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -368,9 +368,11 @@ sub find_local_ip_interface_peers {
 
     #if peer is remote, find source with ip route
     foreach my $address (@{$peers}) {
-        my ($ip, $interface) = get_local_route_ip($address);
-        return ($ip, $interface);
+        my ($ip, $interface) = eval { get_local_route_ip($address) };
+        return ($ip, $interface) if $ip;
     }
+
+    return;
 }
 
 sub find_bridge {
diff --git a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
index 1f0a3ad898db..bec716ffe3c3 100644
--- a/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
+++ b/src/PVE/Network/SDN/Zones/VxlanPlugin.pm
@@ -8,6 +8,7 @@ use PVE::Tools qw($IPV4RE);
 use PVE::INotify;
 use PVE::Network::SDN::Controllers::EvpnPlugin;
 use PVE::Exception qw(raise raise_param_exc);
+use PVE::RESTEnvironment qw(log_warn);
 
 use base('PVE::Network::SDN::Zones::Plugin');
 
@@ -93,6 +94,8 @@ sub generate_sdn_config {
         @peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'};
         ($ifaceip, $iface) =
             PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers);
+        log_warn("VXLAN zone $zoneid, VNet $vnetid: no local address found for peers")
+            if !defined($ifaceip);
     } elsif ($plugin_config->{fabric}) {
         my $local_node = PVE::INotify::nodename();
         my $config = PVE::Network::SDN::Fabrics::config(1);
@@ -131,7 +134,7 @@ sub generate_sdn_config {
     push @iface_config, "vxlan-id $tag";
 
     for my $address (sort @peers) {
-        next if $address eq $ifaceip;
+        next if defined($ifaceip) && $address eq $ifaceip;
         push @iface_config, "vxlan_remoteip $address";
     }
     push @iface_config, "vxlan-port $vxlanport" if $vxlanport;
-- 
2.47.3





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-08 12:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08 12:38 [PATCH network] sdn: zones: ignore failed peer route lookups Gabriel Goller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal