From nobody Thu Apr 25 13:32:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1610490682; cv=none; d=zohomail.com; s=zohoarc; b=TZ+yNvBgDdqohtP69isDw7ln/T4xVaeVb7aQna9lXCE0NBAGUHRP0adKRs0zGw6nr9mvNQvhnI9gMgxOaC7v9m0tYRnZJ31xZd9PrwZ3WHQnubg/85IlQRcQTH9RRWObonTxLHoz67Lz31+h+uMK/gXVBVepIQQsneqVZDHj43g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610490682; 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=l59QdpzWctxlI/dMxMxF42lErTwPEMpP1zz1c2ey6x4=; b=PffurskcVXCuh8wF0pJODoDjU1E757DkLw5mrbWMSm9r3F2JWYiOeyDzxetP/bDnhSysD8ioQdoaVzzXMIJIg8ij/XHoomjVAzfccedLXDfad0UPT49nFss4HPq8G5iii6o/T0+roObYHtoIyUbzAxTOnszuMoxD2xixLwtZsic= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161049068241071.08481338968716; Tue, 12 Jan 2021 14:31:22 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-66-zAtaY2oTNnGvxF09o7Agvg-1; Tue, 12 Jan 2021 17:31:18 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E9DD802B40; Tue, 12 Jan 2021 22:31: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 ED0B35D9D2; Tue, 12 Jan 2021 22:31:09 +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 908BF180954D; Tue, 12 Jan 2021 22:31:05 +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 10CMV3R7019612 for ; Tue, 12 Jan 2021 17:31:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id DBAF26F96B; Tue, 12 Jan 2021 22:31:03 +0000 (UTC) Received: from vhost2.laine.org (ovpn-114-243.phx2.redhat.com [10.3.114.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3B4960CEB for ; Tue, 12 Jan 2021 22:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610490681; 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=l59QdpzWctxlI/dMxMxF42lErTwPEMpP1zz1c2ey6x4=; b=CAaqcCbPwwbNA5K7HVPnvhF8jX22Qxhh2F2ExzF5Bqs1eV+R03Ti9Vi7JeegYKYMKE3Bko oOs5jcFBbGqj8tmiKVaQhI/CqZHKNew9bhxsfUxNeLz0YrqcSgEzTYwk8mhl96aS9tshfl sRtCAtruItWlmwy8hmKVHmUhTMKq16U= X-MC-Unique: zAtaY2oTNnGvxF09o7Agvg-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH] qemu: don't set interface MTU when managed='no' Date: Tue, 12 Jan 2021 17:30:58 -0500 Message-Id: <20210112223058.90157-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" managed=3D'no' on an allows an unprivileged libvirt to use a pre-created tap/macvtap device that libvirt has permission to open/read/write, but no permission to modify (i.e. set the MTU or MAC address). But when the XML had an setting (which was put there in order to tell the *guest* OS what MTU to set for the emulated device at the other end of the tap) We were attempting to set the MTU of the tap device on the host, paying no attention to the setting of 'managed'. That would of course end in failure. This patch only sets the MTU if managed=3D'no' is *not* set (so, if it is 'yes', or just not set at all). Note that MTU of the tap is also set when connecting the tap to a bridge device, but managed=3D'no' is only allowed for Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_hotplug.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6f970a3128..3eff09a9d3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8149,7 +8149,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, } } =20 - if (net->mtu && + if (net->mtu && net->managed_tap !=3D VIR_TRISTATE_BOOL_NO && virNetDevSetMTU(net->ifname, net->mtu) < 0) goto cleanup; =20 diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f336a90c8e..95f2bd0aca 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1387,7 +1387,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, } } =20 - if (net->mtu && + if (net->mtu && net->managed_tap !=3D VIR_TRISTATE_BOOL_NO && virNetDevSetMTU(net->ifname, net->mtu) < 0) goto cleanup; =20 --=20 2.29.2