From nobody Mon May 6 20:21:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1676495212; cv=none; d=zohomail.com; s=zohoarc; b=WQl9WC1WaBpz5Q2eyb953bRaxW4hJ42aCuUoVO1vB2v2hwSESxDkg3h5n5q7wQCVpeO+/Z4mZzj5i79AyRItnlAkpFiIcZhwEQie3GyrT8W1JRVDvsfiIGTOs9zuPxMyTRg+b7Q2Bf2SvmtCWrnOI3t5LaHj30dJSc23XCWDj0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676495212; 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=X8MxxMfQoH9Nw+Ruc9H3sUWf/0PYZE9cmkcI/E2YAGs=; b=RrdIxrvdN8tliXMYi9adFfNf417/FZTq52fXugI3XlpC/3VmVkwkma8Enw8mHXXZQ6I3r2owQ20uQphqB6UCGrKZr/qisFP4q1x739wxrHrkm/QebyMLUacg/f+QIBjeIQz5GV8hd7Ub6CrihzboAtMnOCXdDUnvwsGaTbsPWFY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1676495212599457.6348235156181; Wed, 15 Feb 2023 13:06:52 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-245-OTkM7e_SOSinv7WUyQ1q9w-1; Wed, 15 Feb 2023 16:06:49 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 102383C0E479; Wed, 15 Feb 2023 21:06:45 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C553492B0E; Wed, 15 Feb 2023 21:06:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 032E81946589; Wed, 15 Feb 2023 21:06:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1484D1946588 for ; Wed, 15 Feb 2023 21:06:42 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id ECEBA1121318; Wed, 15 Feb 2023 21:06:41 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.2.16.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id D450D1121314 for ; Wed, 15 Feb 2023 21:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676495211; 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=X8MxxMfQoH9Nw+Ruc9H3sUWf/0PYZE9cmkcI/E2YAGs=; b=BEa0J/ma8Q8vTBwcB2sRSADoobkiTTwfgm7NeqrUb2aO2/Xm9NaE3jnq7173wlq0cUuyKV t9Grz0ktNG24D922stOlMAwwrsfuhLJSG1dVM7zzLX0SW+mq/I2xnnu1hJiqZeuAIaENQ7 bG3WOesRo4zFhyUhR/Yuv2tPlkUOKvw= X-MC-Unique: OTkM7e_SOSinv7WUyQ1q9w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH] qemu: forbid updating any attributes of an interface with update-device Date: Wed, 15 Feb 2023 16:06:41 -0500 Message-Id: <20230215210641.188932-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676495214347100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Changing any of the attributes of an 's would require removing and re-adding the interface for the new setting to take effect, so fail any update-device that changes anything in Resolves: https://bugzilla.redhat.com/2169245 Signed-off-by: Laine Stump Reviewed-by: Martin Kletzander --- src/conf/domain_conf.c | 14 ++++++++++++++ src/conf/domain_conf.h | 2 ++ src/libvirt_private.syms | 1 + src/qemu/qemu_hotplug.c | 9 +++++++++ 4 files changed, 26 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3dfc5c87af..aa7bed7dc3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19853,6 +19853,20 @@ virDomainFsDefCheckABIStability(virDomainFSDef *sr= c, } =20 =20 +bool +virDomainNetBackendIsEqual(virDomainNetBackend *src, + virDomainNetBackend *dst) +{ + if (src->type !=3D dst->type || + STRNEQ_NULLABLE(src->tap, dst->tap) || + STRNEQ_NULLABLE(src->vhost, dst->vhost) || + STRNEQ_NULLABLE(src->logFile, dst->logFile)) { + return false; + } + return true; +} + + static bool virDomainNetDefCheckABIStability(virDomainNetDef *src, virDomainNetDef *dst) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7d58efb011..bd8ce562d9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3862,6 +3862,8 @@ virDomainNetDef *virDomainNetFindByName(virDomainDef = *def, const char *ifname); bool virDomainHasNet(virDomainDef *def, virDomainNetDef *net); int virDomainNetInsert(virDomainDef *def, virDomainNetDef *net); int virDomainNetUpdate(virDomainDef *def, size_t netidx, virDomainNetDef *= newnet); +bool virDomainNetBackendIsEqual(virDomainNetBackend *src, + virDomainNetBackend *dst); int virDomainNetDHCPInterfaces(virDomainDef *def, virDomainInterfacePtr **= ifaces); int virDomainNetARPInterfaces(virDomainDef *def, virDomainInterfacePtr **i= faces); virDomainNetDef *virDomainNetRemove(virDomainDef *def, size_t i); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 97c3d86217..c6c47dbfac 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -528,6 +528,7 @@ virDomainMouseModeTypeToString; virDomainNetAllocateActualDevice; virDomainNetAppendIPAddress; virDomainNetARPInterfaces; +virDomainNetBackendIsEqual; virDomainNetBandwidthUpdate; virDomainNetDefActualFromNetworkPort; virDomainNetDefActualToNetworkPort; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c490e2b97a..b4cddef9f5 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3675,6 +3675,15 @@ qemuDomainChangeNet(virQEMUDriver *driver, goto cleanup; } =20 + /* nothing in can be modified in an existing interface - + * the entire device will need to be removed and re-added. + */ + if (!virDomainNetBackendIsEqual(&olddev->backend, &newdev->backend)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("cannot modify network device backend settings")); + goto cleanup; + } + /* allocate new actual device to compare to old - we will need to * free it if we fail for any reason */ --=20 2.39.1