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 4593F1FF0BC for ; Mon, 16 Nov 2026 17:15:27 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2556021958; Mon, 16 Nov 2026 17:12:54 +0100 (CET) From: Gabriel Goller To: pve-devel@lists.proxmox.com Subject: [PATCH pve-manager v3 32/32] network: generate SDN DHCP config after ifreload Date: Mon, 16 Nov 2026 17:11:52 +0100 Message-ID: <20261116161154.343743-33-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: 1794845522183 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.224 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: IEULQTVK7TNKFT5SNXQ4Z6XOZPO5Z5AU X-Message-ID-Hash: IEULQTVK7TNKFT5SNXQ4Z6XOZPO5Z5AU 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: dnsmasq instances of SDN zones with a dedicated VRF are started inside that VRF, so the VRF has to be created by ifreload before the DHCP config is generated and the instances are restarted. Otherwise dnsmasq fails to start on the first apply after enabling the VRF. pve-sdn-commit needs the same order. At boot, networking.service brings up the old SDN config, so the VRF of a zone changed while the node was offline only exists after its ifreload. Signed-off-by: Gabriel Goller --- PVE/API2/Network.pm | 5 ++++- bin/pve-sdn-commit | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm index df89d26243d0..8fb187972587 100644 --- a/PVE/API2/Network.pm +++ b/PVE/API2/Network.pm @@ -942,7 +942,6 @@ __PACKAGE__->register_method({ if ($have_sdn) { PVE::Network::SDN::generate_etc_network_config(); - PVE::Network::SDN::generate_dhcp_config(); PVE::Network::SDN::WireGuard::generate_wireguard_config(); } @@ -954,6 +953,10 @@ __PACKAGE__->register_method({ }; PVE::Tools::run_command(['ifreload', '-a'], errfunc => $err); + # needs the zone VRFs created by ifreload, because dnsmasq is started inside + # them with 'ip vrf exec' + PVE::Network::SDN::generate_dhcp_config() if $have_sdn; + if (defined($regenerate_frr)) { # SDN (or a manual invocation) is requesting a # specific behavior, so we abide by the parameter set. diff --git a/bin/pve-sdn-commit b/bin/pve-sdn-commit index aa7e9b29056a..ab4175b87fa7 100644 --- a/bin/pve-sdn-commit +++ b/bin/pve-sdn-commit @@ -108,7 +108,6 @@ my $new_config_has_frr = PVE::Network::SDN::running_config_has_frr(); my $regenerate_frr = ($previous_config_has_frr || $new_config_has_frr); PVE::Network::SDN::generate_etc_network_config(); -PVE::Network::SDN::generate_dhcp_config(); my $err = sub { my $line = shift; @@ -119,6 +118,10 @@ my $err = sub { PVE::Tools::run_command(['ifreload', '-a'], errfunc => $err); +# needs the zone VRFs created by ifreload, because dnsmasq is started inside +# them with 'ip vrf exec' +PVE::Network::SDN::generate_dhcp_config(); + PVE::Network::SDN::generate_frr_config(1) if $regenerate_frr; exit 0; -- 2.47.3