From nobody Mon Apr 29 11:42:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584022857; cv=none; d=zohomail.com; s=zohoarc; b=YQaagFUW4h8QXN8AL3ivNXcvz3jdYE0JIVLxeOVhdp+bBbks5dVt/YHD5TAgby5rh7d79FXzwm0m6a1ss0wPOFuP4UOhOljKU9bkI8VwoY06R6qLcpyCiEcQ2LB7MAy6wQ+srsjyU6yTqHcydmpUw214FxY1F1lRDEpHbz1VmUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584022857; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=WTYwHuSgJTqhdKTz/WmDS6sm5PhN4KQ0qkRUu4lvg+I=; b=WCn/TRVseZUnC2cxzcprxXO0dKtXcqLz/fp4mQGC20Ww8T1g6sMXzqW/Ce2s0LUXEX7KOURAVwSHIgu7fEaQdRWAjpBSRYnzbyqY12kVEiSY+//w6KpRlQdnN0zix1zlaYsa45zukAYDRbkUCm+SjzRKqU3ZR7XGjWHGr1hU+Co= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1584022857038797.7769539747923; Thu, 12 Mar 2020 07:20:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-324-kXn5Uan8Pw-mHF_gkIpt0w-1; Thu, 12 Mar 2020 10:20:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9233118AB2C2; Thu, 12 Mar 2020 14:20:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4A1B19756; Thu, 12 Mar 2020 14:20:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 917C585EC0; Thu, 12 Mar 2020 14:20:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02CEKVwf024062 for ; Thu, 12 Mar 2020 10:20:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id E8F5173874; Thu, 12 Mar 2020 14:20:31 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 703029A6A for ; Thu, 12 Mar 2020 14:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584022853; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=WTYwHuSgJTqhdKTz/WmDS6sm5PhN4KQ0qkRUu4lvg+I=; b=CccCC2hOy2X0rMRyWtS7x5ixNvZPEnyvXOLgs4krJnBD5QIhkCG/FQ+Y0ixYccchq0P8+p 7OKM0onoeTO8yhijGLl6P9p9hHen7qr4/brJgXVixBpzXCb6rOkSoHAHr5BWwPNgMw0Kfp 8ds5KFPyd8ley0BaCdoTfwAOa7GLe0k= X-MC-Unique: kXn5Uan8Pw-mHF_gkIpt0w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2] conf: Don't generate machine names with a dot Date: Thu, 12 Mar 2020 15:20:23 +0100 Message-Id: <5348817cbd0e972efd495648f7374d6171212ee4.1584022628.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" According to the linked BZ, machined expects either valid hostname or valid FQDN (see systemd commit v239-3092-gd65652f1f2). While in case of multiple dots, a trailing one doesn't violate FQDN, it does violate the rule in case of something simple, like "domain.". But it's safe to remove it in both cases. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1808499 Fixes: 45464db8ba502764cf37ec9335770248bdb3d9a8 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- v2 of: https://www.redhat.com/archives/libvir-list/2020-February/msg01138.html diff to v1: - Adjusted commit message as suggested by Jano - Fixed ".-" and "-." occurrences too, again suggested by Jano src/conf/domain_conf.c | 6 +++--- tests/virsystemdtest.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d2d97daf80..246a78d39b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30933,7 +30933,7 @@ virDomainMachineNameAppendValid(virBufferPtr buf, if (strlen(virBufferCurrentContent(buf)) >=3D 64) break; =20 - if (*name =3D=3D '.') { + if (*name =3D=3D '.' || *name =3D=3D '-') { if (!skip_dot) virBufferAddChar(buf, *name); skip_dot =3D true; @@ -30948,8 +30948,8 @@ virDomainMachineNameAppendValid(virBufferPtr buf, virBufferAddChar(buf, *name); } =20 - /* trailing dashes are not allowed */ - virBufferTrimChars(buf, "-"); + /* trailing dashes or dots are not allowed */ + virBufferTrimChars(buf, "-."); } =20 #undef HOSTNAME_CHARS diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c index 1e36298189..f48a714cca 100644 --- a/tests/virsystemdtest.c +++ b/tests/virsystemdtest.c @@ -746,7 +746,8 @@ mymain(void) TEST_MACHINE("kstest-network-device-default-httpks_(c9eed63e-981e-48ec= -acdc-56b3f8c5f678)", 100, "qemu-100-kstest-network-device-default-httpksc9eed63e-98= 1e-48ec"); TEST_MACHINE("kstest-network-device-default-httpks_(c9eed63e-981e-48ec= --cdc-56b3f8c5f678)", 10, - "qemu-10-kstest-network-device-default-httpksc9eed63e-981= e-48ec"); + "qemu-10-kstest-network-device-default-httpksc9eed63e-981= e-48ec-c"); + TEST_MACHINE("demo.-.test.", 11, "qemu-11-demo.test"); =20 # define TESTS_PM_SUPPORT_HELPER(name, function) \ do { \ --=20 2.24.1