From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 841071FF0BC for ; Mon, 16 Nov 2026 17:14:36 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 169F721863; Mon, 16 Nov 2026 17:12:51 +0100 (CET) From: Gabriel Goller To: pve-devel@lists.proxmox.com Subject: [PATCH pve-network v3 24/32] sdn: dhcp: only configure DHCP for zones on the local node Date: Mon, 16 Nov 2026 17:11:44 +0100 Message-ID: <20261116161154.343743-25-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261116161154.343743-1-g.goller@proxmox.com> References: <20261116161154.343743-1-g.goller@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794845521488 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.226 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: G3565NKLOSM3I2KFKICUNCF2QTYGXKB4 X-Message-ID-Hash: G3565NKLOSM3I2KFKICUNCF2QTYGXKB4 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: regenerate_config set up a dnsmasq instance for every zone with DHCP enabled, even on nodes that are not part of the zone. These instances did nothing, because the vnet interfaces do not exist on those nodes. It also meant that every node needed dnsmasq installed as soon as any zone used DHCP. Otherwise applying the SDN config failed there, even if none of the node's zones use DHCP. Signed-off-by: Gabriel Goller --- src/PVE/Network/SDN/Dhcp.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm index f6ce842c8cc2..10d7ee917da5 100644 --- a/src/PVE/Network/SDN/Dhcp.pm +++ b/src/PVE/Network/SDN/Dhcp.pm @@ -69,7 +69,16 @@ sub regenerate_config { my $plugins = PVE::Network::SDN::Dhcp::Plugin->lookup_types(); - my $any_zone_needs_dhcp = grep { $_->{dhcp} } values $zone_cfg->{ids}->%*; + my @dhcp_zone_ids; + for my $zoneid (sort keys $zone_cfg->{ids}->%*) { + my $zone = $zone_cfg->{ids}->{$zoneid}; + next if !$zone->{dhcp}; + # the zone's VRF and bridges only exist on its nodes + next if defined($zone->{nodes}) && !$zone->{nodes}->{$nodename}; + push @dhcp_zone_ids, $zoneid; + } + + my $any_zone_needs_dhcp = scalar(@dhcp_zone_ids); foreach my $plugin_name (@$plugins) { my $plugin = PVE::Network::SDN::Dhcp::Plugin->lookup($plugin_name); @@ -77,9 +86,8 @@ sub regenerate_config { die "Could not run before_regenerate for DHCP plugin $plugin_name $@\n" if $@; } - foreach my $zoneid (sort keys %{ $zone_cfg->{ids} }) { + foreach my $zoneid (@dhcp_zone_ids) { my $zone = $zone_cfg->{ids}->{$zoneid}; - next if !$zone->{dhcp}; my $dhcp_plugin_name = $zone->{dhcp}; my $dhcp_plugin = PVE::Network::SDN::Dhcp::Plugin->lookup($dhcp_plugin_name); -- 2.47.3