From nobody Sat May 4 11:14:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1685620119; cv=none; d=zohomail.com; s=zohoarc; b=h+6NM/WQBc1sjyEGgEIcBVMP8AmLbROfvmLQyYN1kNXwXXL0pRgT2g2ffmFjXaQjGS4i9fnbUZq8nwGA2GHmOyf7rYqrfmdluvdP3zjbH5hOkewHvfABop1PUw8CvuM/p3clKzA2hI042q1cWX4hEosopacrGt8JV3p4SozAxhQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685620119; 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=Ah3GNxFk+pvSaS7AOXy7eP/5I7IoNEQ4OeTdF3LKiVU=; b=fl1JAQ9u7pm/N3nQJM3dtnt4t56H0YzSQVcl9ueaPpkuutpSuxjJsT0PV9w50OvyhUjJIZ81WX1B/h7BuE94CvFIQQ1Fo7NSPb81ZpywytHkTJduKPHhl5RRuz6I0mnhTapVW3ltNxPJeQOSLOAJ7w28RVJcyyFEXLpj/IunNKA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1685620119661313.2841561454072; Thu, 1 Jun 2023 04:48:39 -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-280-eqDIqovuM0OAG4RU_-RvVA-1; Thu, 01 Jun 2023 07:48:35 -0400 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 2035E1C07583; Thu, 1 Jun 2023 11:48:33 +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 2E9B8492B00; Thu, 1 Jun 2023 11:48:31 +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 DD17E19465A0; Thu, 1 Jun 2023 11:48:30 +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 38DE81946595 for ; Thu, 1 Jun 2023 11:48:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A7E71112132D; Thu, 1 Jun 2023 11:48:04 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FFA5112132C for ; Thu, 1 Jun 2023 11:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685620118; 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=Ah3GNxFk+pvSaS7AOXy7eP/5I7IoNEQ4OeTdF3LKiVU=; b=LCLvAcARDSY0389nflh+ae06QWbPRNQdeyzn7fuOrUVXiufIPYiAeVBhg7XypWFTjyc018 uRoBaGzFCpb3Qv6jhiIUVCbAwTr7qxjkLiYF8Bo5he7Pchk6CgYrE7iSnY7i2f3Roe/fiT aCnZzQcRHqhd8/IfPjJK5K6gQfcqPsE= X-MC-Unique: eqDIqovuM0OAG4RU_-RvVA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu_passt: Format portForward device even without address Date: Thu, 1 Jun 2023 13:47:56 +0200 Message-Id: <479ccd4230d23ff03f9f40cb9c76774bc7569d60.1685620076.git.mprivozn@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: 1685620120818100001 Content-Type: text/plain; charset="utf-8"; x-default="true" It's almost like we've anticipated this. Our XML parser and formatter handles @address and @dev attributes of element completely independent of each other. And as of commit 2023_03_29.b10b983~3 passt allows handling these two separately too. All that's left is generate the cmd line according to this new fact. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2210287 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_passt.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c index 0712ca0b16..99636a3a49 100644 --- a/src/qemu/qemu_passt.c +++ b/src/qemu/qemu_passt.c @@ -221,6 +221,7 @@ qemuPasstStart(virDomainObj *vm, for (i =3D 0; i < net->nPortForwards; i++) { virDomainNetPortForward *pf =3D net->portForwards[i]; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + bool emitsep =3D false; =20 if (pf->proto =3D=3D VIR_DOMAIN_NET_PROTO_TCP) { virCommandAddArg(cmd, "--tcp-ports"); @@ -240,12 +241,16 @@ qemuPasstStart(virDomainObj *vm, return -1; =20 virBufferAddStr(&buf, addr); + emitsep =3D true; + } =20 - if (pf->dev) - virBufferAsprintf(&buf, "%%%s", pf->dev); + if (pf->dev) { + virBufferAsprintf(&buf, "%%%s", pf->dev); + emitsep =3D true; + } =20 + if (emitsep) virBufferAddChar(&buf, '/'); - } =20 if (!pf->nRanges) { virBufferAddLit(&buf, "all"); --=20 2.39.3