From nobody Fri Apr 26 21:10:42 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543910890549704.096825184518; Tue, 4 Dec 2018 00:08:10 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FB77356F1; Tue, 4 Dec 2018 08:08:08 +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 8237E60123; Tue, 4 Dec 2018 08:08:07 +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 09B4C3F7CD; Tue, 4 Dec 2018 08:08:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB4884Oq030310 for ; Tue, 4 Dec 2018 03:08:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id 592A05C21C; Tue, 4 Dec 2018 08:08:04 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id D21F55C25D for ; Tue, 4 Dec 2018 08:08:03 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 4 Dec 2018 09:07:58 +0100 Message-Id: <7580c82980b049818843d90c3304d1c489d63de4.1543909872.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] syncNicRxFilterMultiMode: Check for helper's retval properly 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 04 Dec 2018 08:08:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" There are two functions called from syncNicRxFilterMultiMode: virNetDevSetRcvAllMulti() and virNetDevSetRcvMulti(). Both of them return 0 on success and -1 on error. However, currently their return value is checked for !=3D 0 which conflicts with our assumptions on retvals: a positive value is still considered success but with current check it would lead to failure. Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8403492ec1..7bac10506b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4448,7 +4448,7 @@ syncNicRxFilterMultiMode(char *ifname, virNetDevRxFil= terPtr guestFilter, guestFilter->multicast.mode =3D=3D VIR_NETDEV_RX_FILTER_MODE_NORMA= L)) { switch (guestFilter->multicast.mode) { case VIR_NETDEV_RX_FILTER_MODE_ALL: - if (virNetDevSetRcvAllMulti(ifname, true)) { + if (virNetDevSetRcvAllMulti(ifname, true) < 0) { VIR_WARN("Couldn't set allmulticast flag to 'on' for " "device %s while responding to " "NIC_RX_FILTER_CHANGED", ifname); @@ -4461,7 +4461,7 @@ syncNicRxFilterMultiMode(char *ifname, virNetDevRxFil= terPtr guestFilter, break; } =20 - if (virNetDevSetRcvMulti(ifname, true)) { + if (virNetDevSetRcvMulti(ifname, true) < 0) { VIR_WARN("Couldn't set multicast flag to 'on' for " "device %s while responding to " "NIC_RX_FILTER_CHANGED", ifname); @@ -4478,13 +4478,13 @@ syncNicRxFilterMultiMode(char *ifname, virNetDevRxF= ilterPtr guestFilter, break; =20 case VIR_NETDEV_RX_FILTER_MODE_NONE: - if (virNetDevSetRcvAllMulti(ifname, false)) { + if (virNetDevSetRcvAllMulti(ifname, false) < 0) { VIR_WARN("Couldn't set allmulticast flag to 'off' for " "device %s while responding to " "NIC_RX_FILTER_CHANGED", ifname); } =20 - if (virNetDevSetRcvMulti(ifname, false)) { + if (virNetDevSetRcvMulti(ifname, false) < 0) { VIR_WARN("Couldn't set multicast flag to 'off' for " "device %s while responding to " "NIC_RX_FILTER_CHANGED", --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 21:10:42 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1543910891301878.7722099446986; Tue, 4 Dec 2018 00:08:11 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06C9787623; Tue, 4 Dec 2018 08:08:09 +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 BB5E960478; Tue, 4 Dec 2018 08:08:08 +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 505AE181B9E4; Tue, 4 Dec 2018 08:08:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wB4885iU030315 for ; Tue, 4 Dec 2018 03:08:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2874E5C25D; Tue, 4 Dec 2018 08:08:05 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id A47865C21C for ; Tue, 4 Dec 2018 08:08:04 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 4 Dec 2018 09:07:59 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] syncNicRxFilterMultiMode: Fix indentation 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 04 Dec 2018 08:08:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The indentation of the code in this function is a bit off. Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 80 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7bac10506b..83de42f041 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4445,52 +4445,52 @@ syncNicRxFilterMultiMode(char *ifname, virNetDevRxF= ilterPtr guestFilter, { if (hostFilter->multicast.mode !=3D guestFilter->multicast.mode || (guestFilter->multicast.overflow && - guestFilter->multicast.mode =3D=3D VIR_NETDEV_RX_FILTER_MODE_NORMA= L)) { + guestFilter->multicast.mode =3D=3D VIR_NETDEV_RX_FILTER_MODE_NORM= AL)) { switch (guestFilter->multicast.mode) { - case VIR_NETDEV_RX_FILTER_MODE_ALL: - if (virNetDevSetRcvAllMulti(ifname, true) < 0) { - VIR_WARN("Couldn't set allmulticast flag to 'on' for " - "device %s while responding to " - "NIC_RX_FILTER_CHANGED", ifname); - } - break; + case VIR_NETDEV_RX_FILTER_MODE_ALL: + if (virNetDevSetRcvAllMulti(ifname, true) < 0) { + VIR_WARN("Couldn't set allmulticast flag to 'on' for " + "device %s while responding to " + "NIC_RX_FILTER_CHANGED", ifname); + } + break; =20 - case VIR_NETDEV_RX_FILTER_MODE_NORMAL: - if (guestFilter->multicast.overflow && - (hostFilter->multicast.mode =3D=3D VIR_NETDEV_RX_FILTE= R_MODE_ALL)) { - break; - } + case VIR_NETDEV_RX_FILTER_MODE_NORMAL: + if (guestFilter->multicast.overflow && + (hostFilter->multicast.mode =3D=3D VIR_NETDEV_RX_FILTER_MO= DE_ALL)) { + break; + } =20 - if (virNetDevSetRcvMulti(ifname, true) < 0) { - VIR_WARN("Couldn't set multicast flag to 'on' for " - "device %s while responding to " - "NIC_RX_FILTER_CHANGED", ifname); - } + if (virNetDevSetRcvMulti(ifname, true) < 0) { + VIR_WARN("Couldn't set multicast flag to 'on' for " + "device %s while responding to " + "NIC_RX_FILTER_CHANGED", ifname); + } =20 - if (virNetDevSetRcvAllMulti(ifname, - guestFilter->multicast.overflo= w) < 0) { - VIR_WARN("Couldn't set allmulticast flag to '%s' for " - "device %s while responding to " - "NIC_RX_FILTER_CHANGED", - virTristateSwitchTypeToString(virTristateSwi= tchFromBool(guestFilter->multicast.overflow)), - ifname); - } - break; + if (virNetDevSetRcvAllMulti(ifname, + guestFilter->multicast.overflow) <= 0) { + VIR_WARN("Couldn't set allmulticast flag to '%s' for " + "device %s while responding to " + "NIC_RX_FILTER_CHANGED", + virTristateSwitchTypeToString(virTristateSwitchFr= omBool(guestFilter->multicast.overflow)), + ifname); + } + break; =20 - case VIR_NETDEV_RX_FILTER_MODE_NONE: - if (virNetDevSetRcvAllMulti(ifname, false) < 0) { - VIR_WARN("Couldn't set allmulticast flag to 'off' for " - "device %s while responding to " - "NIC_RX_FILTER_CHANGED", ifname); - } + case VIR_NETDEV_RX_FILTER_MODE_NONE: + if (virNetDevSetRcvAllMulti(ifname, false) < 0) { + VIR_WARN("Couldn't set allmulticast flag to 'off' for " + "device %s while responding to " + "NIC_RX_FILTER_CHANGED", ifname); + } =20 - if (virNetDevSetRcvMulti(ifname, false) < 0) { - VIR_WARN("Couldn't set multicast flag to 'off' for " - "device %s while responding to " - "NIC_RX_FILTER_CHANGED", - ifname); - } - break; + if (virNetDevSetRcvMulti(ifname, false) < 0) { + VIR_WARN("Couldn't set multicast flag to 'off' for " + "device %s while responding to " + "NIC_RX_FILTER_CHANGED", + ifname); + } + break; } } } --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list