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 0E9901FF0E1 for ; Mon, 16 Nov 2026 02:00:51 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id AF0FA2172C; Mon, 16 Nov 2026 02:00:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794790826; x=1795395626; darn=lists.proxmox.com; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zk0xcP7jwhAITu/Cor8zodTHS5ll7Si44dV2rdZUAeA=; b=ZpSGbNh6u3x4EYMXfu989r7rLsxatyWMgFKdbGCZnhiQ3SPv/BVTz59d2+ILvaWwNG tXlSnxjDrjnIccll44b+CeeHS8bjITieD8yIRoPSYgSCl8Zz+htUeisbLGNKtZbK8maw UrbEfGI9HnlSmjYfZACbRT5zGZUlXm6ya9ZE2wVYwf8wfjmBA8awRETPdeYv70HYdwXU hygGqPP92Hf+eucTnEfHKcalQd5HOiX+xExG33y9sLGNHY13JiZE+BRY5myGHwlG6+h1 ilbjj9zbUV9q8TbNdmSu9f/dT9ILrP+DbCxR/jrx4h76Mv6x3wnMzsZLcbqwyqmwXVnk YmMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794790826; x=1795395626; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=zk0xcP7jwhAITu/Cor8zodTHS5ll7Si44dV2rdZUAeA=; b=Bpqm+iTc/9XHRrW1y8Cn4NkwC/aengmPaoUAfW1QI5fLEYTw66JS8aEAWN3OOQ3yli eb/mq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asN1M0hksWjLBTpZvbnbKKfJ4/FASogZQa/kdBjL6QA7gB15KS0h8U8/oyYg== X-Received: by 2002:a05:6122:54e:b0:5e9:76c4:cf19 with SMTP id 71dfb90a1353d-5ee34a54d7amr2580430e0c.8.1794790826448; Sun, 15 Nov 2026 17:00:26 -0800 (PST) From: Lucas Barros To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v2 2/3] cloudinit: only use the first search domain for the FQDN Date: Sun, 15 Nov 2026 22:00:12 -0300 Message-ID: <20261116010014.88737-3-lucasbarros.kam@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261116010014.88737-1-lucasbarros.kam@gmail.com> References: <20261116010014.88737-1-lucasbarros.kam@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.086 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no 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: Q3AGTCJLMDALM6R7QVCWOV74LTOZUJZR X-Message-ID-Hash: Q3AGTCJLMDALM6R7QVCWOV74LTOZUJZR X-MailFrom: lucasbarros.kam@gmail.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 CC: t.lamprecht@proxmox.com, Lucas Barros X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The 'searchdomain' option takes a list of domains, separated by spaces, and the DNS configuration passed to the guest already splits it like that. The FQDN for the user-data, however, is built by appending the whole value to the name of the VM, so with 'searchdomain: a.example b.example' the guest gets 'fqdn: vm.a.example b.example', which is not a valid host name, and with manage_etc_hosts the second domain can end up in /etc/hosts as a name for the guest's own address. Use only the first domain for the FQDN, which is the same result as before for a single domain. Signed-off-by: Lucas Barros --- changes since v1: * new patch. It is not caused by 3/3, it is about the VM's own 'searchdomain' option, but it is the same mistake as in 1/3 and I found it while going through the users. Can be applied on its own. Tested with 'qm cloudinit dump user' on a PVE 9 node: 'searchdomain: x.example y.example' gave 'fqdn: vm.x.example y.example' before and gives 'fqdn: vm.x.example' now; one domain and no searchdomain give the same output as before. The network config still gets both domains as search list. I did not boot a guest with it. This patch was prepared with the help of an LLM based coding assistant; I reviewed the change and ran the tests mentioned above myself. src/PVE/QemuServer/Cloudinit.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PVE/QemuServer/Cloudinit.pm b/src/PVE/QemuServer/Cloudinit.pm index f7f8c8e1..7febdcb2 100644 --- a/src/PVE/QemuServer/Cloudinit.pm +++ b/src/PVE/QemuServer/Cloudinit.pm @@ -116,8 +116,9 @@ sub get_hostname_fqdn { if ($hostname =~ /\./) { $fqdn = $hostname; $hostname =~ s/\..*$//; - } elsif (my $search = $conf->{searchdomain}) { - $fqdn = "$hostname.$search"; + } elsif (my ($domain) = split(' ', $conf->{searchdomain} // '')) { + # 'searchdomain' can hold a list, only the first domain belongs to the FQDN + $fqdn = "$hostname.$domain"; } else { $fqdn = $hostname; } -- 2.50.1 (Apple Git-155)