From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 08AC31FF0B2 for ; Tue, 08 Sep 2026 14:38:51 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id E1D0821591; Tue, 08 Sep 2026 14:38:48 +0200 (CEST) From: Gabriel Goller 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 Message-ID: <20260908123841.271714-1-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1788871118004 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.318 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: XWB2OCUJPFZKXCDGMPHTHLBAH7H247UP X-Message-ID-Hash: XWB2OCUJPFZKXCDGMPHTHLBAH7H247UP X-MailFrom: g.goller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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