From nobody Tue Feb 10 03:44:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1639338611; cv=none; d=zohomail.com; s=zohoarc; b=HkIVYqtxvbljf1g2Jl6wLYm2+Cn3NbwobMPPZq0xdzQJKxYtNa2pc9ckAKq/CcBLqyM917tdKMRppikBaO9PD2/vmSXAngQLDO5eoUa1473DUR0huTvKHtZtBmM7tc7mVSpSU6mXb0TGfgsZGvtEg7xoULnLS/rqSoy9j6rSSgY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639338611; 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=SQadjvOl+BxeQptzctNFTpUQ4zVEief++4HR3s6vDcA=; b=F+xpZGlit6o+9JJusj6amnwUqXpTOA1lM/lqlkp4OyPZXRTfgFT46j7RTlu49TNBwSOULCqxu/nH8cXTnaTSvbyPa0DKa7vFsRbQFdHDHAFRzULLpudSccuFrGD08OPa49MIQqWzPCAg9E5/iIcxfOSwgZIRYUxYRWtv+DkiKNE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1639338611840759.5542010234408; Sun, 12 Dec 2021 11:50:11 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-95-7W4MF5MiNvOUUV6wi2Kdyw-1; Sun, 12 Dec 2021 14:49:09 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5459802C96; Sun, 12 Dec 2021 19:49:01 +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 B7B4360FDD; Sun, 12 Dec 2021 19:49:01 +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 8BE2B1806D2E; Sun, 12 Dec 2021 19:49:01 +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 1BCJmaBp018870 for ; Sun, 12 Dec 2021 14:48:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 41F0F5BE14; Sun, 12 Dec 2021 19:48:36 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.2.16.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E10D5D6D7 for ; Sun, 12 Dec 2021 19:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639338610; 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=SQadjvOl+BxeQptzctNFTpUQ4zVEief++4HR3s6vDcA=; b=WidLLg5MJK5pgR5CHzQGOwKlc0eKv8ur4vPU9DWIuqz+qIdlgXTbGEA1fsTNvVq3S8Xw3p scBSL91rK395V2c7Sex6baqkaqlfWBsd7HJbXhvxU89gf4WiIGJcjwTfaWX9DWFSqhv+f3 xX5yKiod/yO2XRLpGy0jfuCTAGFZKtw= X-MC-Unique: 7W4MF5MiNvOUUV6wi2Kdyw-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 07/12] util: eliminate pointless switch in virFirewallApplyRule Date: Sun, 12 Dec 2021 14:48:25 -0500 Message-Id: <20211212194830.292379-8-laine@redhat.com> In-Reply-To: <20211212194830.292379-1-laine@redhat.com> References: <20211212194830.292379-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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) X-ZM-MESSAGEID: 1639338613805100001 Content-Type: text/plain; charset="utf-8" Since commit b19863640 both useful cases of the switch statement in this function have made the same call (and the other/default case is just an error that can never happen). Eliminate the switch to help eliminate use of currentBackend. Signed-off-by: Laine Stump --- src/util/virfirewall.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 1a546335f6..bb14a367d9 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -653,31 +653,8 @@ virFirewallApplyRule(virFirewall *firewall, if (rule->ignoreErrors) ignoreErrors =3D rule->ignoreErrors; =20 - switch (currentBackend) { - case VIR_FIREWALL_BACKEND_DIRECT: - if (virFirewallApplyRuleDirect(rule, ignoreErrors, &output) < 0) - return -1; - break; - case VIR_FIREWALL_BACKEND_FIREWALLD: - /* Since we are using raw iptables rules, there is no - * advantage to going through firewalld, so instead just add - * them directly rather that via dbus calls to firewalld. This - * has the useful side effect of eliminating extra unwanted - * warning messages in the system logs when trying to delete - * rules that don't exist (which is something that happens - * often when libvirtd is started, and *always* when firewalld - * is restarted) - */ - if (virFirewallApplyRuleDirect(rule, ignoreErrors, &output) < 0) - return -1; - break; - - case VIR_FIREWALL_BACKEND_AUTOMATIC: - case VIR_FIREWALL_BACKEND_LAST: - default: - virReportEnumRangeError(virFirewallBackend, currentBackend); + if (virFirewallApplyRuleDirect(rule, ignoreErrors, &output) < 0) return -1; - } =20 if (rule->queryCB && output) { if (!(lines =3D g_strsplit(output, "\n", -1))) --=20 2.33.1