From nobody Tue Feb 10 01:58:47 2026 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 1544111928144591.871188087232; Thu, 6 Dec 2018 07:58:48 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E131C81DEC; Thu, 6 Dec 2018 15:58:45 +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 A648D105705C; Thu, 6 Dec 2018 15:58:45 +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 547BB3F605; Thu, 6 Dec 2018 15:58:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB6FwWPC022496 for ; Thu, 6 Dec 2018 10:58:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5DD605D77E; Thu, 6 Dec 2018 15:58:32 +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 E312A5D6A6; Thu, 6 Dec 2018 15:58:31 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Thu, 6 Dec 2018 10:58:22 -0500 Message-Id: <20181206155823.3246-2-laine@laine.org> In-Reply-To: <20181206155823.3246-1-laine@laine.org> References: <20181206155823.3246-1-laine@laine.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: kolomaxes@gmail.com Subject: [libvirt] [PATCH v2 1/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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 06 Dec 2018 15:58:46 +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: J=C3=A1n Tomko --- src/lxc/lxc_controller.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index e853d02d65..07342cbc77 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -367,7 +367,10 @@ static int virLXCControllerGetNICIndexes(virLXCControl= lerPtr 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) { + virDomainNetType actualType + =3D virDomainNetGetActualType(ctrl->def->nets[i]); + + switch (actualType) { case VIR_DOMAIN_NET_TYPE_BRIDGE: case VIR_DOMAIN_NET_TYPE_NETWORK: case VIR_DOMAIN_NET_TYPE_ETHERNET: @@ -396,11 +399,11 @@ static int virLXCControllerGetNICIndexes(virLXCContro= llerPtr ctrl) case VIR_DOMAIN_NET_TYPE_HOSTDEV: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type %s"), - virDomainNetTypeToString(ctrl->def->nets[i]->ty= pe)); + virDomainNetTypeToString(actualType)); goto cleanup; case VIR_DOMAIN_NET_TYPE_LAST: default: - virReportEnumRangeError(virDomainNetType, ctrl->def->nets[i]->= type); + virReportEnumRangeError(virDomainNetType, actualType); goto cleanup; } } --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list