From nobody Tue May 14 23:25:28 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1701791257169118.86863268051036; Tue, 5 Dec 2023 07:47:37 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0D72217DF; Tue, 5 Dec 2023 10:47:36 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4833A17EF; Tue, 5 Dec 2023 10:46:18 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id B956417EA; Tue, 5 Dec 2023 10:46:05 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 08D9A180B for ; Tue, 5 Dec 2023 10:45:27 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-411-Grh4T6JvPW29UWcCbfJ4LA-1; Tue, 05 Dec 2023 10:44:10 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 663163C36633 for ; Tue, 5 Dec 2023 15:42:57 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11AA51121312 for ; Tue, 5 Dec 2023 15:42:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: Grh4T6JvPW29UWcCbfJ4LA-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 1/2] qemuMonitorJSONQueryRxFilter: Allow @filter to be NULL Date: Tue, 5 Dec 2023 16:42:53 +0100 Message-ID: <08387ee9d681c2a2a91cbeb3bc46d618d18a7f19.1701790962.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: N3STCIS54THOEWK4KBQB63CXFNBGEZBT X-Message-ID-Hash: N3STCIS54THOEWK4KBQB63CXFNBGEZBT X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1701791258485100001 Sometimes it may be handy to just issue the query-rx-filter monitor command without actually parsing the output. Adapt qemuMonitorJSONQueryRxFilter() to this behavior. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_monitor.c | 12 ++++++++++++ src/qemu/qemu_monitor_json.c | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ec586b9036..dfad4ee1ea 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2536,6 +2536,18 @@ qemuMonitorRemoveNetdev(qemuMonitor *mon, } =20 =20 +/** + * qemuMonitorQueryRxFilter: + * @mon: monitor object + * @alias: alias of the network interface + * @filter: where to store the result (can be NULL) + * + * Issues query-rx-filter command for given device (@alias) and stores par= sed + * output at @filter (if not NULL). If @filter is NULL, the command is exe= cuted + * but nothing is parsed. + * + * Returns 0 on success, -1 otherwise. + */ int qemuMonitorQueryRxFilter(qemuMonitor *mon, const char *alias, virNetDevRxFilter **filter) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a9133793f6..1574723624 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3753,7 +3753,8 @@ qemuMonitorJSONQueryRxFilter(qemuMonitor *mon, const = char *alias, if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0) return -1; =20 - if (qemuMonitorJSONQueryRxFilterParse(reply, filter) < 0) + if (filter && + qemuMonitorJSONQueryRxFilterParse(reply, filter) < 0) return -1; =20 return 0; --=20 2.41.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Tue May 14 23:25:28 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1701791187106534.8532955174207; Tue, 5 Dec 2023 07:46:27 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id CC66A17D1; Tue, 5 Dec 2023 10:46:25 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0824F17E0; Tue, 5 Dec 2023 10:45:09 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id E21EF17DD; Tue, 5 Dec 2023 10:45:05 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 507C217D1 for ; Tue, 5 Dec 2023 10:45:05 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-384-KL9kLK9TOWGOFhQaP4ASjw-1; Tue, 05 Dec 2023 10:45:03 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EEC5A10AF7EA for ; Tue, 5 Dec 2023 15:42:57 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99A951121312 for ; Tue, 5 Dec 2023 15:42:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: KL9kLK9TOWGOFhQaP4ASjw-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 2/2] qemuDomainChangeNet: Reflect trustGuestRxFilters change Date: Tue, 5 Dec 2023 16:42:54 +0100 Message-ID: <46d4d54fe350867c7108e0797f204e40f3472fe8.1701790962.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: UVT4L6COP4BJHZ673WLR552O64OOYLI5 X-Message-ID-Hash: UVT4L6COP4BJHZ673WLR552O64OOYLI5 X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1701791189113100001 On device-update, when user requests change of trustGuestRxFilters we currently do nothing. Nor error out, nor act on the request. While we can just throw an error, implementing this is pretty trivial. Resolves: https://issues.redhat.com/browse/RHEL-735 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 51 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 4e2fc724c0..75e1d39b60 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3625,6 +3625,43 @@ qemuDomainChangeNetLinkState(virDomainObj *vm, return ret; } =20 +static int +qemuDomainQueryRxFilterDummy(virDomainObj *vm, + virDomainNetDef *dev, + bool trustGuestRxFilters) +{ + qemuDomainObjPrivate *priv =3D vm->privateData; + + VIR_DEBUG("dev: %s, trustGuestRxFilters: %d", + NULLSTR(dev->info.alias), trustGuestRxFilters); + + /* Transition from "yes" to "no" is simple, just record the new + * setting and processNicRxFilterChangedEvent() will ignore + * NIC_RX_FILTER_CHANGED event. + * Transition from "no" to "yes" requires issuing query-rx-filter + * monitor command to enable the event delivery again. + */ + if (trustGuestRxFilters) { + int rc; + + if (!dev->info.alias) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("can't query rx filters: device alias not fou= nd")); + return -1; + } + + qemuDomainObjEnterMonitor(vm); + rc =3D qemuMonitorQueryRxFilter(priv->mon, dev->info.alias, NULL); + qemuDomainObjExitMonitor(vm); + if (rc < 0) + return -1; + } + + /* modify the device configuration */ + dev->trustGuestRxFilters =3D trustGuestRxFilters; + return 0; +} + static int qemuDomainChangeNet(virQEMUDriver *driver, virDomainObj *vm, @@ -3644,6 +3681,7 @@ qemuDomainChangeNet(virQEMUDriver *driver, bool needCoalesceChange =3D false; bool needVlanUpdate =3D false; bool needIsolatedPortChange =3D false; + bool needQueryRxFilter =3D false; int ret =3D -1; int changeidx =3D -1; g_autoptr(virConnect) conn =3D NULL; @@ -3999,6 +4037,11 @@ qemuDomainChangeNet(virQEMUDriver *driver, needIsolatedPortChange =3D true; } =20 + if (virDomainNetGetActualTrustGuestRxFilters(olddev) !=3D + virDomainNetGetActualTrustGuestRxFilters(newdev)) { + needQueryRxFilter =3D true; + } + if (olddev->linkstate !=3D newdev->linkstate) needLinkStateChange =3D true; =20 @@ -4091,6 +4134,14 @@ qemuDomainChangeNet(virQEMUDriver *driver, needReplaceDevDef =3D true; } =20 + if (needQueryRxFilter) { + if (qemuDomainQueryRxFilterDummy(vm, olddev, + virDomainNetGetActualTrustGuestRx= Filters(newdev)) < 0) { + goto cleanup; + } + needReplaceDevDef =3D true; + } + if (needLinkStateChange && qemuDomainChangeNetLinkState(vm, olddev, newdev->linkstate) < 0) { goto cleanup; --=20 2.41.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org