From nobody Thu Apr 25 09:23:13 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 1544063729454672.2314536526013; Wed, 5 Dec 2018 18:35:29 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8360E20262; Thu, 6 Dec 2018 02:35:26 +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 13A09194B3; Thu, 6 Dec 2018 02:35:26 +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 AE31B3F7CD; Thu, 6 Dec 2018 02:35:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB62ZLji026818 for ; Wed, 5 Dec 2018 21:35:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 61F5660CD1; Thu, 6 Dec 2018 02:35:21 +0000 (UTC) Received: from vhost2.laine.org (ovpn-117-189.phx2.redhat.com [10.3.117.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 016371895D; Thu, 6 Dec 2018 02:35:20 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com, kolomaxes@gmail.com Date: Wed, 5 Dec 2018 21:35:12 -0500 Message-Id: <20181206023513.2912-2-laine@laine.org> In-Reply-To: <20181206023513.2912-1-laine@laine.org> References: <20181206023513.2912-1-laine@laine.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] lxc: stop incorrectly validating interface type 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 06 Dec 2018 02:35:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit 017dfa27d changed a few switch statements in the LXC code to have all possible enum values, and in the process changed the switch statement in virLXCControllerGetNICIndexes() such that it returned error status for any interfaces that weren't implemented with a veth pair when it should have just been ignoring those interfaces. Since the interface type will have already been validated before reaching this function, we shouldn't be doing any validation at all - just add the ifindex of the parent veth if its a veth pair, and ignore it otherwise. Resolves: https://bugzilla.redhat.com/1656463 Signed-off-by: Laine Stump --- src/lxc/lxc_controller.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index e853d02d65..1c20f451af 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -364,6 +364,16 @@ static int virLXCControllerGetNICIndexes(virLXCControl= lerPtr ctrl) size_t i; int ret =3D -1; =20 + /* Gather the ifindexes of the "parent" veths for all interfaces + * implemented with a veth pair. These will be used when calling + * virCgroupNewMachine (and eventually the dbus method + * CreateMachineWithNetwork). ifindexes for the child veths, and + * for macvlan interfaces, *should not* be in this list, as they + * will be moved into the container. Only the interfaces that will + * remain outside the container, but are used for communication + * with the container, should be added to the list. + */ + VIR_DEBUG("Getting nic indexes"); for (i =3D 0; i < ctrl->def->nnets; i++) { int nicindex =3D -1; @@ -394,14 +404,9 @@ static int virLXCControllerGetNICIndexes(virLXCControl= lerPtr ctrl) case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_HOSTDEV: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported net type %s"), - virDomainNetTypeToString(ctrl->def->nets[i]->ty= pe)); - goto cleanup; case VIR_DOMAIN_NET_TYPE_LAST: default: - virReportEnumRangeError(virDomainNetType, ctrl->def->nets[i]->= type); - goto cleanup; + break; } } =20 --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 09:23:13 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 1544063745639467.45767380684606; Wed, 5 Dec 2018 18:35:45 -0800 (PST) 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 894A1369D3; Thu, 6 Dec 2018 02:35:43 +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 57F4F648BA; Thu, 6 Dec 2018 02:35:43 +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 117E03F774; Thu, 6 Dec 2018 02:35:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB62ZM49026828 for ; Wed, 5 Dec 2018 21:35:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 45C3D18823; Thu, 6 Dec 2018 02:35:22 +0000 (UTC) Received: from vhost2.laine.org (ovpn-117-189.phx2.redhat.com [10.3.117.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9057B6109E; Thu, 6 Dec 2018 02:35:21 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com, kolomaxes@gmail.com Date: Wed, 5 Dec 2018 21:35:13 -0500 Message-Id: <20181206023513.2912-3-laine@laine.org> In-Reply-To: <20181206023513.2912-1-laine@laine.org> References: <20181206023513.2912-1-laine@laine.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] lxc: check actual type of interface not config type 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: , 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.30]); Thu, 06 Dec 2018 02:35:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" virLXCControllerGetNICIndexes() was deciding whether or not to add the ifindex for an interface's ifname to the list of ifindexes sent to CreateMachineWithNetwork based on the interface type stored in the config. This would be incorrect in the case of where the network was giving out macvlan interfaces tied to a physical device (i.e. when the actual interface type was "direct"). Instead of checking the setting of "net->type", we should be checking the setting of virDomainNetGetActualType(net). I don't think this caused any actual misbehavior, it was just technically wrong. Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrang=C3=A9 --- src/lxc/lxc_controller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 1c20f451af..dad6abed3b 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -377,7 +377,8 @@ static int virLXCControllerGetNICIndexes(virLXCControll= erPtr ctrl) VIR_DEBUG("Getting nic indexes"); for (i =3D 0; i < ctrl->def->nnets; i++) { int nicindex =3D -1; - switch (ctrl->def->nets[i]->type) { + + switch (virDomainNetGetActualType(ctrl->def->nets[i])) { case VIR_DOMAIN_NET_TYPE_BRIDGE: case VIR_DOMAIN_NET_TYPE_NETWORK: case VIR_DOMAIN_NET_TYPE_ETHERNET: --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list