[libvirt PATCH 07/12] util: eliminate pointless switch in virFirewallApplyRule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <laine@xxxxxxxxxx>
---
 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 = rule->ignoreErrors;
 
-    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;
-    }
 
     if (rule->queryCB && output) {
         if (!(lines = g_strsplit(output, "\n", -1)))
-- 
2.33.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux