From nobody Sun Feb 8 11:16:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1666083491; cv=none; d=zohomail.com; s=zohoarc; b=LXRfLrDhoEZq5Kon9teV4eS08LYx7holQxjBdfnFjDjEIWUvhanKOkW8UaMxgCdqcil1GSzgiHG7Nrl0JmPpLPKjkH+dSMBCbU23ESU1W5ufI2zRI0HjtUrO7AQz8iPH+qGJtAH3TXniHkCPUEFysJS67vHumIaCqAc8gH6JZl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666083491; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FqNkREYYYpRSbgkbV7oS1Mzou4Vm9oMiahyF78r+trE=; b=kHo5v0xoB2n8IMDlSgg2ysTFWoswMVLouR4vPl1OkTx1/uEfn7NmXiZmdPrZ2EHV3lSC9rkA2zNNXjtKjWrbN5bVz+XfAYx8r+ADTSr2u0tEFhX6I6vJEwf8ksUxS37KaRLTzT3Nygh2HtOtmdbqtFJpThA8H99xdbAQVi0rI8A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1666083491279881.4456435681064; Tue, 18 Oct 2022 01:58:11 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-517-W9MCTzpYP5KbDJcKTInbkg-1; Tue, 18 Oct 2022 04:58:00 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5FDE018E5355; Tue, 18 Oct 2022 08:57:57 +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 130A4146820E; Tue, 18 Oct 2022 08:57:57 +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 3405F19465B7; Tue, 18 Oct 2022 08:57:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 318B919465A3 for ; Tue, 18 Oct 2022 08:57:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0720F4081B9E; Tue, 18 Oct 2022 08:57:54 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A123E40EC001 for ; Tue, 18 Oct 2022 08:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666083490; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FqNkREYYYpRSbgkbV7oS1Mzou4Vm9oMiahyF78r+trE=; b=MBXV8xUeDzIxIJwoN6acYHsw2h8UdLnKTnb9unK4kjwRCQ2JQk1R+/PIIBY6w24YZ6kZ2q 2iUvtHQ/kosdfPEBZU2lSylk6KZQHDMnT9KmNUx988zkgSnZdl1lQNN4j7nIkJSsslxHGU 8IJ9LOiNYFNyGZr00KtP+lB4mcViIOg= X-MC-Unique: W9MCTzpYP5KbDJcKTInbkg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/5] qemu: Refresh rx-filters more often Date: Tue, 18 Oct 2022 10:57:49 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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.7 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: 1666083492764100009 Content-Type: text/plain; charset="utf-8"; x-default="true" There are couple of scenarios where we need to reflect MAC change done in the guest: 1) domain restore from a file (here, we don't store updated MAC in the save file and thus on restore create the macvtap with the original MAC), 2) reconnecting to a running domain (here, the guest might have changed the MAC while we were not running), 3) migration (here, guest might change the MAC address but we fail to respond to it, Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 9 ++++++--- src/qemu/qemu_domain.h | 3 ++- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_process.c | 27 +++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1b93ebe579..b408ec0607 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11975,14 +11975,17 @@ syncNicRxFilterMulticast(char *ifname, =20 int qemuDomainSyncRxFilter(virDomainObj *vm, - virDomainNetDef *def) + virDomainNetDef *def, + virDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv =3D vm->privateData; g_autoptr(virNetDevRxFilter) guestFilter =3D NULL; g_autoptr(virNetDevRxFilter) hostFilter =3D NULL; int rc; =20 - qemuDomainObjEnterMonitor(vm); + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) + return -1; + rc =3D qemuMonitorQueryRxFilter(priv->mon, def->info.alias, &guestFilt= er); qemuDomainObjExitMonitor(vm); if (rc < 0) @@ -11990,7 +11993,7 @@ qemuDomainSyncRxFilter(virDomainObj *vm, =20 if (virDomainNetGetActualType(def) =3D=3D VIR_DOMAIN_NET_TYPE_DIRECT) { if (virNetDevGetRxFilter(def->ifname, &hostFilter)) { - VIR_WARN("Couldn't get current RX filter for device %s while r= esponding to NIC_RX_FILTER_CHANGED", + VIR_WARN("Couldn't get current RX filter for device %s", def->ifname); return -1; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index f436861efc..37e0a90452 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1101,4 +1101,5 @@ qemuDomainObjWait(virDomainObj *vm); =20 int qemuDomainSyncRxFilter(virDomainObj *vm, - virDomainNetDef *def); + virDomainNetDef *def, + virDomainAsyncJob asyncJob); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d5fb2913be..803d2c1771 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3662,7 +3662,7 @@ processNicRxFilterChangedEvent(virDomainObj *vm, VIR_DEBUG("process NIC_RX_FILTER_CHANGED event for network " "device %s in domain %s", def->info.alias, vm->def->name); =20 - if (qemuDomainSyncRxFilter(vm, def) < 0) + if (qemuDomainSyncRxFilter(vm, def, VIR_ASYNC_JOB_NONE) < 0) goto endjob; =20 endjob: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1a9175f40f..fe98601fce 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7756,6 +7756,26 @@ qemuProcessLaunch(virConnectPtr conn, } =20 =20 +static int +qemuProcessRefreshRxFilters(virDomainObj *vm, + virDomainAsyncJob asyncJob) +{ + size_t i; + + for (i =3D 0; i < vm->def->nnets; i++) { + virDomainNetDef *def =3D vm->def->nets[i]; + + if (!virDomainNetGetActualTrustGuestRxFilters(def)) + continue; + + if (qemuDomainSyncRxFilter(vm, def, asyncJob) < 0) + return -1; + } + + return 0; +} + + /** * qemuProcessRefreshState: * @driver: qemu driver data @@ -7787,6 +7807,10 @@ qemuProcessRefreshState(virQEMUDriver *driver, if (qemuProcessRefreshDisks(vm, asyncJob) < 0) return -1; =20 + VIR_DEBUG("Updating rx-filter data"); + if (qemuProcessRefreshRxFilters(vm, asyncJob) < 0) + return -1; + return 0; } =20 @@ -8807,6 +8831,9 @@ qemuProcessReconnect(void *opaque) if (qemuSecurityReserveLabel(driver->securityManager, obj->def, obj->p= id) < 0) goto error; =20 + if (qemuProcessRefreshRxFilters(obj, VIR_ASYNC_JOB_NONE) < 0) + goto error; + qemuProcessNotifyNets(obj->def); =20 qemuProcessFiltersInstantiate(obj->def); --=20 2.37.3