public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH network] sdn: zones: ignore failed peer route lookups
Date: Tue,  8 Sep 2026 14:38:40 +0200	[thread overview]
Message-ID: <20260908123841.271714-1-g.goller@proxmox.com> (raw)

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





                 reply	other threads:[~2026-09-08 12:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260908123841.271714-1-g.goller@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal