From: Laine Stump Date: Tue, 16 Nov 2021 17:19:18 +0000 (-0500) Subject: util: eliminate pointless switch in virFirewallApplyRule X-Git-Tag: v8.0.0-rc1~222 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9e8e639fd70e4b9f414a0e7fd35229a8a4a447d7;p=thirdparty%2Flibvirt.git util: eliminate pointless switch in virFirewallApplyRule 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 Reviewed-by: Michal Privoznik --- 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)))