From nobody Fri May 3 03:44:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505209041534476.3123409281676; Tue, 12 Sep 2017 02:37:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31D046906B; Tue, 12 Sep 2017 09:37:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 099586062A; Tue, 12 Sep 2017 09:37:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C160718045C2; Tue, 12 Sep 2017 09:37:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8C9X3Hw005406 for ; Tue, 12 Sep 2017 05:33:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 518F117AA0; Tue, 12 Sep 2017 09:33:03 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5F9C6062A; Tue, 12 Sep 2017 09:33:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 31D046906B Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 12 Sep 2017 11:32:49 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH 1/5] rng: Drop useless X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 12 Sep 2017 09:37:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If we have with just one value to chose from, it's no choice. Signed-off-by: Michal Privoznik --- docs/schemas/domaincommon.rng | 72 +++++++++++---------------------------= ---- docs/schemas/nodedev.rng | 4 +-- docs/schemas/storagecommon.rng | 4 +-- 3 files changed, 20 insertions(+), 60 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 06c5a91b3..a8e32014b 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1554,9 +1554,7 @@ - - rbd - + rbd @@ -1617,9 +1615,7 @@ - - nbd - + nbd @@ -1631,9 +1627,7 @@ - - gluster - + gluster @@ -2370,9 +2364,7 @@ - - unix - + unix @@ -2475,9 +2467,7 @@ - - udp - + udp @@ -2967,9 +2957,7 @@ - - keep - + keep @@ -3693,9 +3681,7 @@ - - - + @@ -3730,9 +3716,7 @@ - - - + @@ -3985,9 +3969,7 @@ - - tpm-tis - + tpm-tis @@ -4106,9 +4088,7 @@ - - usb - + usb @@ -4121,9 +4101,7 @@ - - usb - + usb @@ -4286,9 +4264,7 @@ - - adapter - + adapter - - iscsi - + iscsi @@ -4338,9 +4312,7 @@ - - vhost - + vhost @@ -4357,9 +4329,7 @@ mdev - - vfio-pci - + vfio-pci @@ -4821,9 +4791,7 @@ - - slic - + slic @@ -5035,9 +5003,7 @@ - - virtio - + virtio @@ -5162,9 +5128,7 @@ - - copy - + copy diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 5bcf31787..2704eeb25 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -220,9 +220,7 @@ - - vfio-pci - + vfio-pci diff --git a/docs/schemas/storagecommon.rng b/docs/schemas/storagecommon.rng index 316fbaee3..717f3c603 100644 --- a/docs/schemas/storagecommon.rng +++ b/docs/schemas/storagecommon.rng @@ -34,9 +34,7 @@ - - passphrase - + passphrase --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 03:44:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505209061886879.14652024264; Tue, 12 Sep 2017 02:37:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE20A81DFF; Tue, 12 Sep 2017 09:37:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A6FA17CCF; Tue, 12 Sep 2017 09:37:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5EE703FACF; Tue, 12 Sep 2017 09:37:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8C9X4lA005415 for ; Tue, 12 Sep 2017 05:33:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B0E16062A; Tue, 12 Sep 2017 09:33:04 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E4CC6BF78; Tue, 12 Sep 2017 09:33:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BE20A81DFF Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 12 Sep 2017 11:32:50 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH 2/5] rng: Fix formatting X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 12 Sep 2017 09:37:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some elements are offset just one space compared to their parent, some are misaligned completely, and so on. Signed-off-by: Michal Privoznik --- docs/schemas/capability.rng | 28 +++++++++--------- docs/schemas/domaincommon.rng | 66 +++++++++++++++++++++------------------= ---- docs/schemas/network.rng | 2 +- docs/schemas/nodedev.rng | 4 +-- docs/schemas/nwfilter.rng | 54 +++++++++++++++++------------------ docs/schemas/storagepool.rng | 4 +-- 6 files changed, 79 insertions(+), 79 deletions(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 071090c2d..e1ab5c224 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -57,21 +57,21 @@ - - - - - - - - - - - + + + + + + + + + - - - + + + + + =20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index a8e32014b..c9a4f7a9a 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -532,7 +532,7 @@ - + @@ -1866,7 +1866,7 @@ - + @@ -2362,21 +2362,21 @@ vhostuser - - - unix - - - - - - - server - client - - - - + + + unix + + + + + + + server + client + + + + @@ -2660,14 +2660,14 @@ - - - + + + - - - + + + @@ -3981,14 +3981,14 @@ =20 - - - - passthrough - - - - + + + + passthrough + + + + =20 @@ -4001,7 +4001,7 @@ - + =20 @@ -4254,7 +4254,7 @@ scsi - + diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1048dabf3..f37c422bf 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -324,7 +324,7 @@ - + =20 diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 2704eeb25..6b063cc22 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -228,7 +228,7 @@ - + =20 @@ -531,7 +531,7 @@ - + diff --git a/docs/schemas/nwfilter.rng b/docs/schemas/nwfilter.rng index dbe6af76c..7cfc05fa2 100644 --- a/docs/schemas/nwfilter.rng +++ b/docs/schemas/nwfilter.rng @@ -18,7 +18,7 @@ - + @@ -360,7 +360,7 @@ - + @@ -377,9 +377,9 @@ - - - + + + @@ -387,9 +387,9 @@ - - - + + + @@ -398,9 +398,9 @@ - - - + + + @@ -409,14 +409,14 @@ - - - + + + - - - + + + @@ -794,13 +794,13 @@ - + =20 - + @@ -854,7 +854,7 @@ ([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]<= /param> - + =20 @@ -864,7 +864,7 @@ ([a-fA-F0-9]{0,4}:){2,7}([a-fA-F0-9]*)(([0= -2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9])? - + =20 @@ -879,7 +879,7 @@ ([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]<= /param> - + =20 @@ -894,7 +894,7 @@ ([a-fA-F0-9]{0,4}:){2,7}([a-fA-F0-9]*) - + =20 @@ -1062,10 +1062,10 @@ =20 - - -1000 - 1000 - + + -1000 + 1000 + diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng index 8386f29aa..f0117bd69 100644 --- a/docs/schemas/storagepool.rng +++ b/docs/schemas/storagepool.rng @@ -521,7 +521,7 @@ - + @@ -538,7 +538,7 @@ - + --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 03:44:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505209082588165.48886626755552; Tue, 12 Sep 2017 02:38:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 70FC869070; Tue, 12 Sep 2017 09:38:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 501936062A; Tue, 12 Sep 2017 09:38:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 155D03FAD1; Tue, 12 Sep 2017 09:38:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8C9X5l3005428 for ; Tue, 12 Sep 2017 05:33:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 705E06062A; Tue, 12 Sep 2017 09:33:05 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4DEC17DC5; Tue, 12 Sep 2017 09:33:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 70FC869070 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 12 Sep 2017 11:32:51 +0200 Message-Id: <2ba523aa668451ea5d776db7d24c49f4dad86b4a.1505208693.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH 3/5] qemuBuildHostNetStr: Don't leak buffer X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 12 Sep 2017 09:38:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If there was an error when constructing the buffer, NULL is returned. The buffer is never freed though. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e57a3278e..d553df57f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3805,13 +3805,13 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, virDomainNetType netType =3D virDomainNetGetActualType(net); virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); size_t i; + char *ret =3D NULL; =20 if (net->script && netType !=3D VIR_DOMAIN_NET_TYPE_ETHERNET) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("scripts are not supported on interfaces of type = %s"), virDomainNetTypeToString(netType)); - virObjectUnref(cfg); - return NULL; + goto cleanup; } =20 switch (netType) { @@ -3919,13 +3919,16 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, virBufferAsprintf(&buf, "sndbuf=3D%lu,", net->tune.sndbuf); } =20 - virObjectUnref(cfg); =20 virBufferTrim(&buf, ",", -1); if (virBufferCheckError(&buf) < 0) - return NULL; + goto cleanup; =20 - return virBufferContentAndReset(&buf); + ret =3D virBufferContentAndReset(&buf); + cleanup: + virBufferFreeAndReset(&buf); + virObjectUnref(cfg); + return ret; } =20 =20 --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 03:44:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505209104563281.0501546240555; Tue, 12 Sep 2017 02:38:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48C3F13A54; Tue, 12 Sep 2017 09:38:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0708F5C1A1; Tue, 12 Sep 2017 09:38:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 38C50180884A; Tue, 12 Sep 2017 09:38:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8C9X6uv005438 for ; Tue, 12 Sep 2017 05:33:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6764B6062A; Tue, 12 Sep 2017 09:33:06 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCF3D17CD7; Tue, 12 Sep 2017 09:33:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 48C3F13A54 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 12 Sep 2017 11:32:52 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH 4/5] conf: Allow usernet to have an address X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 12 Sep 2017 09:38:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1075520 Currently, all that users can specify for an interface type of 'user' is the common attributes: PCI address, NIC model (and that's basically it). However, some need to configure other address range than the default one. Signed-off-by: Michal Privoznik --- Notes: Frankly, I'm not that convinced about this one. I mean, this puts IP addresses into net->hostIP while we are configuring guest side of the SLIRP. However, it just feels better to have the IP addresses under than under . Which actually is the other option. So it's either: =20 =20 for net->hostIP, or it's: =20 =20 for net->guestIP. I went for the former one, but I don't have a strong opinion on that. docs/formatdomain.html.in | 13 ++++++- docs/schemas/domaincommon.rng | 5 +++ src/conf/domain_conf.c | 5 +-- .../qemuxml2argv-net-user-addr.xml | 42 ++++++++++++++++++= ++++ .../qemuxml2xmlout-net-user-addr.xml | 1 + tests/qemuxml2xmltest.c | 1 + 6 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-user-addr.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-user-addr.x= ml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 8ca7637a4..65a8886ee 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4701,7 +4701,14 @@ starting from 10.0.2.15. The default router will be 10.0.2.2 and the DNS server will be 10.0.2.3. This networking is the only option for unprivileged users who need t= heir - VMs to have outgoing access. + VMs to have outgoing access. However, since + 3.8.0, it is possible to override the default network by + including source element. The element can have ip= + element for each IPv4 and IPv6. The element has family + attribute which accepts ipv4 and ipv6 valu= es. + Then there's address attribute for specifying IP address + corresponding to the family. Optionally, the default prefix length c= an be + overridden via prefix attribute.

=20
@@ -4711,6 +4718,10 @@
   ...
   <interface type=3D'user'>
     <mac address=3D"00:11:22:33:44:55"/>
+    <source>
+      <ip family=3D'ipv4' address=3D'172.17.2.0' prefix=3D'24'/>
+      <ip family=3D'ipv6' address=3D'2001:db8:ac10:fd01::' prefix=3D'64=
'/>
+    </source>
   </interface>
 </devices>
 ...
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index c9a4f7a9a..7b5292bd3 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2428,6 +2428,11 @@ user + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 676fc0f34..ef236757a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5214,12 +5214,13 @@ static int virDomainNetDefValidate(const virDomainNetDef *net) { if ((net->hostIP.nroutes || net->hostIP.nips) && - net->type !=3D VIR_DOMAIN_NET_TYPE_ETHERNET) { + net->type !=3D VIR_DOMAIN_NET_TYPE_ETHERNET && + net->type !=3D VIR_DOMAIN_NET_TYPE_USER) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid attempt to set network interface " "host-side IP route and/or address info on " "interface of type '%s'. This is only supported " - "on interfaces of type 'ethernet'"), + "on interfaces of type 'ethernet' and 'user'"), virDomainNetTypeToString(net->type)); return -1; } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-user-addr.xml b/tests/= qemuxml2argvdata/qemuxml2argv-net-user-addr.xml new file mode 100644 index 000000000..65362d8aa --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-user-addr.xml @@ -0,0 +1,42 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + +
+ + +
+ + + + + + + + +
+ + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-user-addr.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-net-user-addr.xml new file mode 120000 index 000000000..fd909ec24 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-user-addr.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/qemuxml2argv-net-user-addr.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 0a87cedf2..99b15ad0c 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -531,6 +531,7 @@ mymain(void) DO_TEST("misc-uuid", NONE); DO_TEST("net-vhostuser", NONE); DO_TEST("net-user", NONE); + DO_TEST("net-user-addr", NONE); DO_TEST("net-virtio", NONE); DO_TEST("net-virtio-device", NONE); DO_TEST("net-virtio-disable-offloads", NONE); --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 03:44:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505208793455681.6891415393616; Tue, 12 Sep 2017 02:33:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D295113A4E; Tue, 12 Sep 2017 09:33:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 12D175C1A1; Tue, 12 Sep 2017 09:33:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EC6F51809547; Tue, 12 Sep 2017 09:33:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8C9X74V005449 for ; Tue, 12 Sep 2017 05:33:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 84D3F6062A; Tue, 12 Sep 2017 09:33:07 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id D894C17CFA; Tue, 12 Sep 2017 09:33:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D295113A4E Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 12 Sep 2017 11:32:53 +0200 Message-Id: <69b01d745cb27077fb0df12214321ecc4b9047bc.1505208693.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: laine@laine.org Subject: [libvirt] [PATCH 5/5] qemu: Implement usernet address X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 12 Sep 2017 09:33:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1075520 Apart from generic checks, we need to constrain netmask/prefix lenght a bit. Thing is, with current implementation QEMU needs to be able to 'assign' some IP addresses to the virtual network. For instance, the default gateway is at x.x.x.2, dns is at x.x.x.3, the default DHCP range is x.x.x.15-x.x.x.30. Since we don't expose these settings yet, it's safer to require shorter prefix to have room for the defaults. Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 22 ++++++++++ src/qemu/qemu_domain.c | 49 ++++++++++++++++++= ++++ .../qemuxml2argv-net-user-addr.args | 25 +++++++++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 97 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-user-addr.args diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d553df57f..3e1bc5fa8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3805,6 +3805,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, virDomainNetType netType =3D virDomainNetGetActualType(net); virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); size_t i; + char *addr =3D NULL; char *ret =3D NULL; =20 if (net->script && netType !=3D VIR_DOMAIN_NET_TYPE_ETHERNET) { @@ -3873,6 +3874,26 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, break; =20 case VIR_DOMAIN_NET_TYPE_USER: + virBufferAsprintf(&buf, "user%c", type_sep); + for (i =3D 0; i < net->hostIP.nips; i++) { + const virNetDevIPAddr *ip =3D net->hostIP.ips[i]; + const char *prefix =3D ""; + + if (!(addr =3D virSocketAddrFormat(&ip->address))) + goto cleanup; + + if (VIR_SOCKET_ADDR_IS_FAMILY(&ip->address, AF_INET)) + prefix =3D "net=3D"; + if (VIR_SOCKET_ADDR_IS_FAMILY(&ip->address, AF_INET6)) + prefix =3D "ipv6-net"; + + virBufferAsprintf(&buf, "%s%s", prefix, addr); + if (ip->prefix) + virBufferAsprintf(&buf, "/%u", ip->prefix); + virBufferAddChar(&buf, ','); + } + break; + case VIR_DOMAIN_NET_TYPE_INTERNAL: virBufferAsprintf(&buf, "user%c", type_sep); break; @@ -3928,6 +3949,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net, cleanup: virBufferFreeAndReset(&buf); virObjectUnref(cfg); + VIR_FREE(addr); return ret; } =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 72031893f..bf0c7300c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3338,9 +3338,11 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef= *dev, void *opaque ATTRIBUTE_UNUSED) { int ret =3D -1; + size_t i; =20 if (dev->type =3D=3D VIR_DOMAIN_DEVICE_NET) { const virDomainNetDef *net =3D dev->data.net; + bool hasIPv4 =3D false, hasIPv6 =3D false; =20 if (net->guestIP.nroutes || net->guestIP.nips) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -3350,6 +3352,53 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef= *dev, goto cleanup; } =20 + if (net->type =3D=3D VIR_DOMAIN_NET_TYPE_USER) { + if (net->hostIP.nroutes) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Invalid attempt to set network interface= " + "guest-side IP address info, " + "not supported by QEMU")); + goto cleanup; + } + + for (i =3D 0; i < net->hostIP.nips; i++) { + const virNetDevIPAddr *ip =3D net->hostIP.ips[i]; + + if (VIR_SOCKET_ADDR_VALID(&ip->peer)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("peers are not supported by QEMU")); + goto cleanup; + } + + if (VIR_SOCKET_ADDR_IS_FAMILY(&ip->address, AF_INET)) { + if (hasIPv4) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only one IPv4 address allowed")); + goto cleanup; + } + hasIPv4 =3D true; + } + + if (VIR_SOCKET_ADDR_IS_FAMILY(&ip->address, AF_INET6)) { + if (hasIPv6) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only one IPv6 address allowed")); + goto cleanup; + } + hasIPv6 =3D true; + } + + /* QEMU needs some space to have + * some other 'hosts' on the network. */ + if ((hasIPv4 && ip->prefix > 27) || + (hasIPv6 && ip->prefix > 120)) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("prefix too long")); + goto cleanup; + } + } + } + if (STREQ_NULLABLE(net->model, "virtio")) { if (net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_= queue_size - 1)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-user-addr.args b/tests= /qemuxml2argvdata/qemuxml2argv-net-user-addr.args new file mode 100644 index 000000000..51aacedb3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-net-user-addr.args @@ -0,0 +1,25 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ +-device rtl8139,vlan=3D0,id=3Dnet0,mac=3D00:11:22:33:44:55,bus=3Dpci.0,add= r=3D0x3 \ +-net user,net=3D172.17.2.0/24,vlan=3D0,name=3Dhostnet0 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2c040e4c0..584df017a 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1159,6 +1159,7 @@ mymain(void) QEMU_CAPS_NETDEV, QEMU_CAPS_VHOSTUSER_MULTIQUEUE); DO_TEST("net-user", NONE); + DO_TEST("net-user-addr", NONE); DO_TEST("net-virtio", NONE); DO_TEST("net-virtio-device", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_TX_ALG); --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list