From nobody Mon Feb 2 07:26:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1768289841; cv=none; d=zohomail.com; s=zohoarc; b=gm1up7vgkmOyAnAnmj2XyyY7cP17LV+X+4j0woP2BSsB4E3zGoiYKJ8sAhUSI6nXJiXjUUdDARWwoOs3ZmEKZuCZ1QH5ESSLYyWIfQLLYQAo4tkR7yIyboYuwI8Yuo8hLHemjy9BGA/gG00fel6J51NH8zsRcOq3JSD5/B8kvVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768289841; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=etaXAoNJdeB5FbTo207BjSP7E7AQ0R9OHOeVyQ3S7Jg=; b=fCT5gHm9okS287wTzYhLYmE0gkB0SiyJZZK6qsfFTuUt1xjMDYWkC2qZ8Erb0fTot0hzyOzwICvRsC5CBg5ouYkK+w3opU7DZ5EC7VaC0Au3De7NNxH7fBqKrnmpNCDe5b2brDFG+tKpp4sJSHov27/bJWUxRTxHE45DDEVnuBI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1768289841395215.91220310455287; Mon, 12 Jan 2026 23:37:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 83A4241896; Tue, 13 Jan 2026 02:37:20 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id EC89841A4A; Tue, 13 Jan 2026 02:35:32 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id D1D2E41894; Tue, 13 Jan 2026 02:35:18 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B1AC5417CE for ; Tue, 13 Jan 2026 02:35:17 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-177-DIL5zZBfNWSmjvtr9re2Fg-1; Tue, 13 Jan 2026 02:35:16 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2C5CF18005B2 for ; Tue, 13 Jan 2026 07:35:15 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.80.83]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BF5661800998 for ; Tue, 13 Jan 2026 07:35:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768289717; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=etaXAoNJdeB5FbTo207BjSP7E7AQ0R9OHOeVyQ3S7Jg=; b=dEvMSEVxHYWS2DcWWmOLA5mkyliu4Vz0SBU+PqauRTL6wseCaHvCuJgL7zB3Ni7lxTeHV6 tvF7a4+w+xjaa+Gz6aeXhKjnXsckknl9tuqq0oUY4dj3w1v5c/e+i9T8vQM7zfapmN18KT dYF+J2f0bVJZhEH69K2YjDnYoPdQiIk= X-MC-Unique: DIL5zZBfNWSmjvtr9re2Fg-1 X-Mimecast-MFC-AGG-ID: DIL5zZBfNWSmjvtr9re2Fg_1768289715 To: devel@lists.libvirt.org Subject: [PATCH 1/3] util: fix equivalence of AF_UNSPEC virSocketAddrs Date: Tue, 13 Jan 2026 02:35:11 -0500 Message-ID: <20260113073513.189733-2-laine@redhat.com> In-Reply-To: <20260113073513.189733-1-laine@redhat.com> References: <20260113073513.189733-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: hKhA89LT82rKyheMUtYwNtExbwG7ONRqHQGpWf5efAs_1768289715 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BQ5RHD4VVYVFVVO4QWOVYD4J6HENYPUI X-Message-ID-Hash: BQ5RHD4VVYVFVVO4QWOVYD4J6HENYPUI X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; 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: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Laine Stump via Devel Reply-To: Laine Stump X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1768289844341158500 Content-Type: text/plain; charset="utf-8"; x-default="true" If a virSocketAddr has family AF_UNSPEC that means it is unspecified/empty. If two virSocketAddrs are AF_UNSPEC then they are equal, but virSocketAddrEqual() was countint that as *not* equal. This doesn't make a difference for current uses of the function since they all check that at least one of the virSocketAddrs is *not* AF_UNSPEC before calling virSocketAddrEqual(), but an upcoming patch using virSocketAddrEqual() will not be making that check, so let's fix the utility function. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/util/virsocketaddr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c index f53768878e..4d4a6b2a0f 100644 --- a/src/util/virsocketaddr.c +++ b/src/util/virsocketaddr.c @@ -369,6 +369,8 @@ virSocketAddrEqual(const virSocketAddr *s1, const virSo= cketAddr *s2) return false; =20 switch (s1->data.stor.ss_family) { + case AF_UNSPEC: + return true; case AF_INET: return (memcmp(&s1->data.inet4.sin_addr.s_addr, &s2->data.inet4.sin_addr.s_addr, --=20 2.52.0 From nobody Mon Feb 2 07:26:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1768289901; cv=none; d=zohomail.com; s=zohoarc; b=bSe6/RTOiZWpHFMKY2qZsfEjSusnkCFU89KY7lDyDCqiKY94woxxEnamlorMNxB5jLIgBE8JeGu5sM+LuMi7PCujn9j4nMGMOdSyopmKvHAAg69MD26Y9Eu/zC8DlbSKlnVkDDVSDSYsNM9JPqVIjkXGe8xWJHCfW3MqCgDj2Mw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768289901; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=UBZE1gheJwcxxCvcKwFI/ax9oR7CMxZCIg6cMLqhXMA=; b=c7D/zvxJXF3jSQ3odw8Ftkv0Moa1fblJ61uMwV82/fuGPLWxKM/sQMcbMbLwCg56ZhED43asYhlQhodvcQSRM9dRATX5NspQ2o/dD77ZqraMepr7uROo9nDz16DWm95PaNXgYSIGdwxtPWzPQQ5HZsxzAsyHKynBSGHwiqt0jgU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1768289901377245.49721492680385; Mon, 12 Jan 2026 23:38:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 477CA418B0; Tue, 13 Jan 2026 02:38:20 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 0646D4189D; Tue, 13 Jan 2026 02:35:38 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 6857D41895; Tue, 13 Jan 2026 02:35:19 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id AA7FC41866 for ; Tue, 13 Jan 2026 02:35:18 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-685-B3FjpJa4M3ScHKjI4i5K8Q-1; Tue, 13 Jan 2026 02:35:16 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CAA5A195423A for ; Tue, 13 Jan 2026 07:35:15 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.80.83]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 72DCA1800665 for ; Tue, 13 Jan 2026 07:35:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768289718; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=UBZE1gheJwcxxCvcKwFI/ax9oR7CMxZCIg6cMLqhXMA=; b=DVvKl24/j1PHXhiULTxQdGaS3ORZf+GQMdJ1nXcR3ZrjJnDQy+IL4e9OnJVI/bWWiOUW7E /a5tPGGTQ86aR0C9SBXcnUU68MysN7WSSZwk037aiu1GGB8R5WigEEADzYYP2o72dIQjU2 d7oEW1mv9GxmrwaeuZvKWGBseDQI+CQ= X-MC-Unique: B3FjpJa4M3ScHKjI4i5K8Q-1 X-Mimecast-MFC-AGG-ID: B3FjpJa4M3ScHKjI4i5K8Q_1768289715 To: devel@lists.libvirt.org Subject: [PATCH 2/3] conf: new function virDomainNetPortForwardIsEqual() Date: Tue, 13 Jan 2026 02:35:12 -0500 Message-ID: <20260113073513.189733-3-laine@redhat.com> In-Reply-To: <20260113073513.189733-1-laine@redhat.com> References: <20260113073513.189733-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: dttbXjlwnWj-gfxx-13TJNVDoOqKl6TUVMx2xqHx9vs_1768289715 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZK7SP4ZUS7R624VKX3OE3RSRQIMONDGD X-Message-ID-Hash: ZK7SP4ZUS7R624VKX3OE3RSRQIMONDGD X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; 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: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Laine Stump via Devel Reply-To: Laine Stump X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1768289902516158500 Content-Type: text/plain; charset="utf-8"; x-default="true" This function checks two arrays of virDomainNetPortForwards for equality. It seemed silly to send a separate #elements for each array just to check for their equality, but I could easily be convinced to do it that way (rather than having the caller check for equal #element and then just send it once). Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 53 ++++++++++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 57 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9ca5c2450c..d00a43e969 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21037,6 +21037,59 @@ virDomainNetBackendIsEqual(virDomainNetBackend *sr= c, return true; } =20 +static bool +virDomainNetPortForwardRangeIsEqual(virDomainNetPortForwardRange *r1, + virDomainNetPortForwardRange *r2) +{ + if (!r1 && !r2) + return true; + if (!(r1 && r2)) + return false; + + return (r1->start =3D=3D r2->start && + r1->end =3D=3D r2->end && + r1->to =3D=3D r2->to && + r1->exclude =3D=3D r2->exclude); +} + + +bool +virDomainNetPortForwardsIsEqual(virDomainNetPortForward **pfs1, + virDomainNetPortForward **pfs2, + size_t npfs) +{ + size_t i; + + if (!pfs1 && !pfs2) + return true; + if (!(pfs1 && pfs2)) + return false; + + for (i =3D 0; i < npfs; i++) { + virDomainNetPortForward *pf1 =3D pfs1[0]; + virDomainNetPortForward *pf2 =3D pfs2[0]; + + if (!pf1 && !pf2) + continue; + if (!(pf1 && pf2)) + return false; + + if (STRNEQ_NULLABLE(pf1->dev, pf2->dev) || + pf1->proto !=3D pf2->proto || + !virSocketAddrEqual(&pf1->address, &pf2->address) || + pf1->nRanges !=3D pf2->nRanges) { + return false; + } + + for (i =3D 0; i < pf1->nRanges; i++) { + if (!virDomainNetPortForwardRangeIsEqual(pf1->ranges[i], pf2->= ranges[i])) + return false; + } + } + + return true; +} + =20 static bool virDomainNetDefCheckABIStability(virDomainNetDef *src, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cb35ff06bd..83d49969d3 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -4099,6 +4099,9 @@ void virDomainNetInsert(virDomainDef *def, virDomainN= etDef *net); void virDomainNetUpdate(virDomainDef *def, size_t netidx, virDomainNetDef = *newnet); bool virDomainNetBackendIsEqual(virDomainNetBackend *src, virDomainNetBackend *dst); +bool virDomainNetPortForwardsIsEqual(virDomainNetPortForward **pfs1, + virDomainNetPortForward **pfs2, + size_t npfs); 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 4e57e4a8f6..ab2ab8afd2 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -577,6 +577,7 @@ virDomainNetModelTypeFromString; virDomainNetModelTypeToString; virDomainNetNotifyActualDevice; virDomainNetPortForwardFree; +virDomainNetPortForwardsIsEqual; virDomainNetReleaseActualDevice; virDomainNetRemove; virDomainNetRemoveByObj; --=20 2.52.0 From nobody Mon Feb 2 07:26:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1768289939; cv=none; d=zohomail.com; s=zohoarc; b=kxNskG7ZStRaFsENwlcr7CT00U9t0H7TerzzbaMcn1rXJslVQUIJJGwQfcyPprAGWEeZWNunDk7SptZjHYfGYCi3aTL9NeclKhu+kZl/ID92SpezwFZLzfjcI7rK7qaHwxOh6fpg7NgjKSPUwnAHlvhRdbsLwis43AG8Cozhkis= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768289939; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=hMONm2ytG91vmOA8v4hXa1c4C2r+X3zLyNzarkx5vuI=; b=lowWR6+o8taE5W1BzhuVp7hy3yVnJIuRbNl+7LTJxwOEeK9WnmWp5e2kcga5Y2JR8yde9i74BiqO4GQHd+dFSdRbwg+uj6Jaz2lJlQlM7NnjJh8WlyuLBgzPNLL7RemMy62HHfNwxogiDMCjdzUgLUTfAZ0stUf9clkC0WsTPGM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 17682899394431018.4666318085503; Mon, 12 Jan 2026 23:38:59 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 9CE4D41896; Tue, 13 Jan 2026 02:38:58 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 8877441B6B; Tue, 13 Jan 2026 02:35:42 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 00A8F41894; Tue, 13 Jan 2026 02:35:19 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 28DB7417CE for ; Tue, 13 Jan 2026 02:35:19 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-530-LDT8SVozO0exPsupAviNiw-1; Tue, 13 Jan 2026 02:35:17 -0500 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 75D7D18003FC for ; Tue, 13 Jan 2026 07:35:16 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.80.83]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1DABB18007D2 for ; Tue, 13 Jan 2026 07:35:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768289718; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=hMONm2ytG91vmOA8v4hXa1c4C2r+X3zLyNzarkx5vuI=; b=bO5q3/wJTzNX1IZC3+xWgw/3z88WQt9NHvj0C6/CkW6o57cC8UIopWBN3W8qx6DfmWYVzT JWkazD8jWAhaE9wGIAdAnv/8THBQceBRr72c+V8awd2BFWu8tZNHbR8z+wAAZXOQE4RmzJ eE/O7MUT6ubak23gciLrdqcAulmNbc0= X-MC-Unique: LDT8SVozO0exPsupAviNiw-1 X-Mimecast-MFC-AGG-ID: LDT8SVozO0exPsupAviNiw_1768289716 To: devel@lists.libvirt.org Subject: [PATCH 3/3] qemu: forbid modifying network device portForwards with update-device Date: Tue, 13 Jan 2026 02:35:13 -0500 Message-ID: <20260113073513.189733-4-laine@redhat.com> In-Reply-To: <20260113073513.189733-1-laine@redhat.com> References: <20260113073513.189733-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: iC1pR5-0cP5tQt1jLmJ6ge3vujW2QPDztXp0D4tb8ak_1768289716 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: M65G6WOETSF4CSOSHJISYZHP3AO44VOY X-Message-ID-Hash: M65G6WOETSF4CSOSHJISYZHP3AO44VOY X-MailFrom: laine@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; 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: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Laine Stump via Devel Reply-To: Laine Stump X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1768289940675158500 Content-Type: text/plain; charset="utf-8"; x-default="true" Prior to this patch, a network device of a running domain could be updated to change the portForwards list, and libvirt wouldn't complain, but the change would be silently ignored. This list is only used by the passt backend, and passt can only change the list of portForwards by killing and re-running the passt process, which we don't want to do because that would destroy any open tcp session flows in passt (ie. it would disrupt guest network traffic); we don't want to do *that*, but we should at least let the user know that their requested change isn't possible. This patch checks if the portForwards list of the updated network device exactly matches the portForwards list of the current network device, and fails the update if they don't match. Resolves: https://issues.redhat.com/browse/RHEL-7338 Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/qemu/qemu_hotplug.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index fccbef5d0c..cfc586e17d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3966,6 +3966,15 @@ qemuDomainChangeNet(virQEMUDriver *driver, goto cleanup; } =20 + if (olddev->nPortForwards !=3D newdev->nPortForwards || + !virDomainNetPortForwardsIsEqual(olddev->portForwards, + newdev->portForwards, + olddev->nPortForwards)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("cannot modify network device portForward setting= s")); + goto cleanup; + } + /* allocate new actual device to compare to old - we will need to * free it if we fail for any reason */ --=20 2.52.0