From nobody Thu Nov 6 13:18:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148959462181138.110027911811926; Wed, 15 Mar 2017 09:17:01 -0700 (PDT) Received: from localhost ([::1]:38339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coBbf-00006p-9C for importer@patchew.org; Wed, 15 Mar 2017 12:16:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coBax-00006V-Lu for qemu-devel@nongnu.org; Wed, 15 Mar 2017 12:16:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coBat-0004p0-Hu for qemu-devel@nongnu.org; Wed, 15 Mar 2017 12:16:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48392) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1coBat-0004on-8I for qemu-devel@nongnu.org; Wed, 15 Mar 2017 12:16:11 -0400 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 424755A6E for ; Wed, 15 Mar 2017 16:16:11 +0000 (UTC) Received: from t460.redhat.com (ovpn-117-127.ams2.redhat.com [10.36.117.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3AD22D5C1; Wed, 15 Mar 2017 16:16:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 424755A6E Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=berrange@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 424755A6E From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Wed, 15 Mar 2017 16:16:03 +0000 Message-Id: <20170315161603.30135-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 15 Mar 2017 16:16:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for 2.9] migration: use "" as the default for tls-creds/hostname X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster , "Dr . David Alan Gilbert" , Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The tls-creds parameter has a default value of NULL indicating that TLS should not be used. Setting it to non-NULL enables use of TLS. Once tls-creds are set to a non-NULL value via the monitor, it isn't possible to set them back to NULL again, due to current implementation limitations. The empty string is not a valid QObject identifier, so this switches to use "" as the default, indicating that TLS will not be used The tls-hostname parameter has a default value of NULL indicating the the hostname from the migrate connection URI should be used. Again, once tls-hostname is set non-NULL, to override the default hostname for x509 cert validation, it isn't possible to reset it back to NULL via the monitor. The empty string is not a valid hostname, so this switches to use "" as the default, indicating that the migrate URI hostname should be used. Using "" as the default for both, also means that the monitor commands "info migrate_parameters" / "query-migrate-parameters" will report existance of tls-creds/tls-parameters even when set to their default values. Signed-off-by: Daniel P. Berrange Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Eric Blake --- migration/migration.c | 4 ++++ migration/tls.c | 2 +- qapi-schema.json | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 3dab684..54060f7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -110,6 +110,8 @@ MigrationState *migrate_get_current(void) =20 if (!once) { qemu_mutex_init(¤t_migration.src_page_req_mutex); + current_migration.parameters.tls_creds =3D g_strdup(""); + current_migration.parameters.tls_hostname =3D g_strdup(""); once =3D true; } return ¤t_migration; @@ -458,6 +460,7 @@ void migration_channel_process_incoming(MigrationState = *s, ioc, object_get_typename(OBJECT(ioc))); =20 if (s->parameters.tls_creds && + *s->parameters.tls_creds && !object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) { Error *local_err =3D NULL; @@ -480,6 +483,7 @@ void migration_channel_connect(MigrationState *s, ioc, object_get_typename(OBJECT(ioc)), hostname); =20 if (s->parameters.tls_creds && + *s->parameters.tls_creds && !object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) { Error *local_err =3D NULL; diff --git a/migration/tls.c b/migration/tls.c index 203c11d..45bec44 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -141,7 +141,7 @@ void migration_tls_channel_connect(MigrationState *s, return; } =20 - if (s->parameters.tls_hostname) { + if (s->parameters.tls_hostname && *s->parameters.tls_hostname) { hostname =3D s->parameters.tls_hostname; } if (!hostname) { diff --git a/qapi-schema.json b/qapi-schema.json index 32b4a4b..eb9bf67 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1036,6 +1036,8 @@ # credentials must be for a 'server' endpoint. Setting this # will enable TLS for all migrations. The default is unset, # resulting in unsecured migration at the QEMU level. (Since 2= .7) +# An empty string means that QEMU will use plain text mode for +# migration, rather than TLS (Since 2.9) # # @tls-hostname: #optional hostname of the target host for the migration. = This # is required when using x509 based TLS credentials and the @@ -1043,6 +1045,8 @@ # example if using fd: or exec: based migration, the # hostname must be provided so that the server's x509 # certificate identity can be validated. (Since 2.7) +# An empty string means that QEMU will use the hostname +# associated with the migration URI, if any. (Since 2.9) # # @max-bandwidth: to set maximum speed for migration. maximum speed in # bytes per second. (Since 2.8) --=20 2.9.3