From nobody Sun Feb 8 21:48:04 2026 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=1663577736; cv=none; d=zohomail.com; s=zohoarc; b=UQK6ZxRQDJSkmwVLBViNnkqyty+wUFe49bhZAVORMvh1YOAZgnFHoLQct1tswTBVKbL21sflmq40G+el6arPOObO/N133/4tZtzS5YwUVcFY/ww4CsIydThGj06g8mk8sB6iqYaEuhMdtgWb2RyFm/6/8lXD/6gIEwcu+pBriOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663577736; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TBuyZJwcldlNVllNltN7CdZJsdSw8lg41GTaP/dXOKI=; b=WSN12z11Yg1j2R/ZTEjIDd3THByBO6N4I4op0tDVqQ1XxtAeBjjWQjoMx3ARrGnTe0PpEJMC5FtgtVa702sogN2qRSRRnJSrTAtc0kREujj65IHroiRXJfzrhDB9Rk0ISp7rUid6Da82mTRZDtsrAr+BvxbsUzpnhtdDpEv7tQg= 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 1663577736534197.3817817953053; Mon, 19 Sep 2022 01:55:36 -0700 (PDT) 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-633-6C7sCQQdPU-Ej9h8RP4l4A-1; Mon, 19 Sep 2022 04:55:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CDFED3817A7A; Mon, 19 Sep 2022 08:55:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB6FC1121315; Mon, 19 Sep 2022 08:55:29 +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 A9C4F19465A3; Mon, 19 Sep 2022 08:55:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 92E771946594 for ; Mon, 19 Sep 2022 08:55:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 758EC40C6EC3; Mon, 19 Sep 2022 08:55:28 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0B5740C6EC2 for ; Mon, 19 Sep 2022 08:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663577735; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=TBuyZJwcldlNVllNltN7CdZJsdSw8lg41GTaP/dXOKI=; b=Jd+V162yJ1qgYTvB+CditBmnf9JukyIniuodR2DbjtTJ4ngoBlnYsZ2chiGCkRuKY4Qo01 8pSaQ5YKrWyHTu4D9JwldZvj2KpfECLyWPcGjmKiNOsqjvoLDr0GRUspNd7r7I+gSVP+rt RJyvLmicGh1mqDK9sogxDTHUVdfDXsw= X-MC-Unique: 6C7sCQQdPU-Ej9h8RP4l4A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/37] virDomainNetDefParseXML: Separate and localize parsing of 'backend/@vhost' Date: Mon, 19 Sep 2022 10:54:50 +0200 Message-Id: <8a3c1ec90081f2eda5177a43b7e3c08a3eb4c443.1663577577.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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.3 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: 1663577737016100005 Content-Type: text/plain; charset="utf-8" Move it into an independent block and move temporary variables locally. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 390263d806..0e25d585c8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8869,9 +8869,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, g_autofree char *vhostuser_mode =3D NULL; g_autofree char *vhostuser_path =3D NULL; g_autofree char *vhostuser_type =3D NULL; - g_autofree char *vhost_path =3D NULL; g_autofree char *tap =3D NULL; - g_autofree char *vhost =3D NULL; g_autofree char *switchid =3D NULL; g_autofree char *connectionid =3D NULL; const char *prefix =3D xmlopt ? xmlopt->config.netPrefix : NULL; @@ -9039,9 +9037,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, if ((tap =3D virXPathString("string(./backend/@tap)", ctxt))) def->backend.tap =3D virFileSanitizePath(tap); - if ((vhost =3D virXPathString("string(./backend/@vhost)", ctxt))) - vhost_path =3D virFileSanitizePath(vhost); - mac_node =3D virXPathNode("./mac", ctxt); if ((macaddr =3D virXMLPropString(mac_node, "address"))) { @@ -9484,7 +9479,14 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, &def->driver.virtio.guest.ufo) < = 0) return NULL; } - def->backend.vhost =3D g_steal_pointer(&vhost_path); + } + + if (def->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV && + virDomainNetIsVirtioModel(def)) { + g_autofree char *vhost =3D virXPathString("string(./backend/@vhos= t)", ctxt); + + if (vhost) + def->backend.vhost =3D virFileSanitizePath(vhost); } def->linkstate =3D VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT; --=20 2.37.1