Blame SOURCES/RHEL-only-remove-ability-to-use-nftables-backend.patch

c8bceb
From 2361184479832ac8f2754822e1e5d4de55c4898c Mon Sep 17 00:00:00 2001
c8bceb
From: Eric Garver <e@erig.me>
c8bceb
Date: Wed, 14 Nov 2018 11:42:17 -0500
c8bceb
Subject: [PATCH 1/4] remove ability to use nftables backend
c8bceb
c8bceb
---
c8bceb
 config/firewalld.conf                  |  7 -------
c8bceb
 configure.ac                           | 10 ----------
c8bceb
 doc/xml/firewalld.conf.xml             | 14 --------------
c8bceb
 doc/xml/firewalld.dbus.xml             | 10 ----------
c8bceb
 src/firewall/config/__init__.py.in     |  3 +--
c8bceb
 src/firewall/core/fw.py                |  5 -----
c8bceb
 src/firewall/core/io/firewalld_conf.py | 11 +----------
c8bceb
 src/firewall/server/config.py          | 19 +++----------------
c8bceb
 src/tests/dbus/firewalld.conf.at       |  2 --
c8bceb
 src/tests/functions.at                 |  3 ---
c8bceb
 src/tests/testsuite.at                 |  2 +-
c8bceb
 11 files changed, 6 insertions(+), 80 deletions(-)
c8bceb
c8bceb
diff --git a/config/firewalld.conf b/config/firewalld.conf
c8bceb
index b53c0aa50c53..63df409bf567 100644
c8bceb
--- a/config/firewalld.conf
c8bceb
+++ b/config/firewalld.conf
c8bceb
@@ -55,10 +55,3 @@ LogDenied=off
c8bceb
 # will be used. Possible values are: yes, no and system.
c8bceb
 # Default: system
c8bceb
 AutomaticHelpers=system
c8bceb
-
c8bceb
-# FirewallBackend
c8bceb
-# Selects the firewall backend implementation.
c8bceb
-# Choices are:
c8bceb
-#	- nftables (default)
c8bceb
-#	- iptables (iptables, ip6tables, ebtables and ipset)
c8bceb
-FirewallBackend=nftables
c8bceb
diff --git a/configure.ac b/configure.ac
c8bceb
index db9a39f92def..d1c365e29986 100644
c8bceb
--- a/configure.ac
c8bceb
+++ b/configure.ac
c8bceb
@@ -147,16 +147,6 @@ if test "x$IPSET" = "x"; then
c8bceb
 fi
c8bceb
 AC_SUBST(IPSET)
c8bceb
 
c8bceb
-AC_ARG_WITH([nft],
c8bceb
-       AS_HELP_STRING([--with-nft], [Path to nft (nftables) executable]),
c8bceb
-       [NFT=$withval
c8bceb
-       AC_MSG_NOTICE([Using for nft: $NFT])],
c8bceb
-       [AC_PATH_PROG([NFT], [nft], [], [$FW_TOOLS_PATH])])
c8bceb
-if test "x$NFT" = "x"; then
c8bceb
-    AC_MSG_ERROR([nft was not found in $FW_TOOLS_PATH])
c8bceb
-fi
c8bceb
-AC_SUBST(NFT)
c8bceb
-
c8bceb
 #############################################################
c8bceb
 
c8bceb
 AC_SUBST([GETTEXT_PACKAGE], '[PKG_NAME]')
c8bceb
diff --git a/doc/xml/firewalld.conf.xml b/doc/xml/firewalld.conf.xml
c8bceb
index df4b9521fd71..afb94b90937f 100644
c8bceb
--- a/doc/xml/firewalld.conf.xml
c8bceb
+++ b/doc/xml/firewalld.conf.xml
c8bceb
@@ -144,20 +144,6 @@
c8bceb
 	</listitem>
c8bceb
       </varlistentry>
c8bceb
 
c8bceb
-        <varlistentry>
c8bceb
-            <term><option>FirewallBackend</option></term>
c8bceb
-            <listitem>
c8bceb
-                <para>
c8bceb
-                Selects the firewall backend implementation. Possible values
c8bceb
-                are; <replaceable>nftables</replaceable> (default), or
c8bceb
-                <replaceable>iptables</replaceable>. This applies to all
c8bceb
-                firewalld primitives. The only exception is direct and
c8bceb
-                passthrough rules which always use the traditional iptables,
c8bceb
-                ip6tables, and ebtables backends.
c8bceb
-                </para>
c8bceb
-	        </listitem>
c8bceb
-        </varlistentry>
c8bceb
-
c8bceb
     </variablelist>
c8bceb
 
c8bceb
   </refsect1>
c8bceb
diff --git a/doc/xml/firewalld.dbus.xml b/doc/xml/firewalld.dbus.xml
c8bceb
index 8352f96cc057..ec82d4cad077 100644
c8bceb
--- a/doc/xml/firewalld.dbus.xml
c8bceb
+++ b/doc/xml/firewalld.dbus.xml
c8bceb
@@ -2582,16 +2582,6 @@
c8bceb
               </para>
c8bceb
             </listitem>
c8bceb
           </varlistentry>
c8bceb
-          <varlistentry id="FirewallD1.config.Properties.FirewallBackend">
c8bceb
-            <term>FirewallBackend - s - (rw)</term>
c8bceb
-            <listitem>
c8bceb
-              <para>
c8bceb
-                Selects the firewalld backend for all rules except the direct
c8bceb
-                interface. Valid options are; nftables, iptables. Default in
c8bceb
-                nftables.
c8bceb
-              </para>
c8bceb
-            </listitem>
c8bceb
-          </varlistentry>
c8bceb
           <varlistentry id="FirewallD1.config.Properties.IPv6_rpfilter">
c8bceb
             <term><parameter>IPv6_rpfilter</parameter> - s - (rw)</term>
c8bceb
             <listitem><para>Indicates whether the reverse path filter test on a packet for IPv6 is enabled. If a reply to the packet would be sent via the same interface that the packet arrived on, the packet will match and be accepted, otherwise dropped.</para></listitem>
c8bceb
diff --git a/src/firewall/config/__init__.py.in b/src/firewall/config/__init__.py.in
c8bceb
index 955be32077e1..20e4979062d8 100644
c8bceb
--- a/src/firewall/config/__init__.py.in
c8bceb
+++ b/src/firewall/config/__init__.py.in
c8bceb
@@ -118,7 +118,6 @@ COMMANDS = {
c8bceb
 
c8bceb
 LOG_DENIED_VALUES = [ "all", "unicast", "broadcast", "multicast", "off" ]
c8bceb
 AUTOMATIC_HELPERS_VALUES = [ "yes", "no", "system" ]
c8bceb
-FIREWALL_BACKEND_VALUES = [ "nftables", "iptables" ]
c8bceb
 
c8bceb
 # fallbacks: will be overloaded by firewalld.conf
c8bceb
 FALLBACK_ZONE = "public"
c8bceb
@@ -129,4 +128,4 @@ FALLBACK_IPV6_RPFILTER = True
c8bceb
 FALLBACK_INDIVIDUAL_CALLS = False
c8bceb
 FALLBACK_LOG_DENIED = "off"
c8bceb
 FALLBACK_AUTOMATIC_HELPERS = "system"
c8bceb
-FALLBACK_FIREWALL_BACKEND = "nftables"
c8bceb
+FALLBACK_FIREWALL_BACKEND = "iptables"
c8bceb
diff --git a/src/firewall/core/fw.py b/src/firewall/core/fw.py
c8bceb
index 9be13a5c1313..abb25f0c3e72 100644
c8bceb
--- a/src/firewall/core/fw.py
c8bceb
+++ b/src/firewall/core/fw.py
c8bceb
@@ -293,11 +293,6 @@ class Firewall(object):
c8bceb
                     log.debug1("AutomaticHelpers is set to '%s'",
c8bceb
                                self._automatic_helpers)
c8bceb
 
c8bceb
-            if self._firewalld_conf.get("FirewallBackend"):
c8bceb
-                self._firewall_backend = self._firewalld_conf.get("FirewallBackend")
c8bceb
-                log.debug1("FirewallBackend is set to '%s'",
c8bceb
-                           self._firewall_backend)
c8bceb
-
c8bceb
         self.config.set_firewalld_conf(copy.deepcopy(self._firewalld_conf))
c8bceb
 
c8bceb
         self._select_firewall_backend(self._firewall_backend)
c8bceb
diff --git a/src/firewall/core/io/firewalld_conf.py b/src/firewall/core/io/firewalld_conf.py
c8bceb
index 4d57bad693c1..9aee2dc6f9b7 100644
c8bceb
--- a/src/firewall/core/io/firewalld_conf.py
c8bceb
+++ b/src/firewall/core/io/firewalld_conf.py
c8bceb
@@ -30,7 +30,7 @@ from firewall.functions import b2u, u2b, PY2
c8bceb
 
c8bceb
 valid_keys = [ "DefaultZone", "MinimalMark", "CleanupOnExit", "Lockdown", 
c8bceb
                "IPv6_rpfilter", "IndividualCalls", "LogDenied",
c8bceb
-               "AutomaticHelpers", "FirewallBackend" ]
c8bceb
+               "AutomaticHelpers" ]
c8bceb
 
c8bceb
 class firewalld_conf(object):
c8bceb
     def __init__(self, filename):
c8bceb
@@ -79,7 +79,6 @@ class firewalld_conf(object):
c8bceb
             self.set("IndividualCalls", "yes" if config.FALLBACK_INDIVIDUAL_CALLS else "no")
c8bceb
             self.set("LogDenied", config.FALLBACK_LOG_DENIED)
c8bceb
             self.set("AutomaticHelpers", config.FALLBACK_AUTOMATIC_HELPERS)
c8bceb
-            self.set("FirewallBackend", config.FALLBACK_FIREWALL_BACKEND)
c8bceb
             raise
c8bceb
 
c8bceb
         for line in f:
c8bceb
@@ -175,14 +174,6 @@ class firewalld_conf(object):
c8bceb
                             config.FALLBACK_AUTOMATIC_HELPERS)
c8bceb
             self.set("AutomaticHelpers", str(config.FALLBACK_AUTOMATIC_HELPERS))
c8bceb
 
c8bceb
-        value = self.get("FirewallBackend")
c8bceb
-        if not value or value.lower() not in config.FIREWALL_BACKEND_VALUES:
c8bceb
-            if value is not None:
c8bceb
-                log.warning("FirewallBackend '%s' is not valid, using default "
c8bceb
-                            "value %s", value if value else '',
c8bceb
-                            config.FALLBACK_FIREWALL_BACKEND)
c8bceb
-            self.set("FirewallBackend", str(config.FALLBACK_FIREWALL_BACKEND))
c8bceb
-
c8bceb
     # save to self.filename if there are key/value changes
c8bceb
     def write(self):
c8bceb
         if len(self._config) < 1:
c8bceb
diff --git a/src/firewall/server/config.py b/src/firewall/server/config.py
c8bceb
index dfc562b537eb..011052a9cabf 100644
c8bceb
--- a/src/firewall/server/config.py
c8bceb
+++ b/src/firewall/server/config.py
c8bceb
@@ -105,7 +105,6 @@ class FirewallDConfig(slip.dbus.service.Object):
c8bceb
                                                 "IndividualCalls": "readwrite",
c8bceb
                                                 "LogDenied": "readwrite",
c8bceb
                                                 "AutomaticHelpers": "readwrite",
c8bceb
-                                                "FirewallBackend": "readwrite",
c8bceb
                                               })
c8bceb
 
c8bceb
     @handle_exceptions
c8bceb
@@ -485,7 +484,7 @@ class FirewallDConfig(slip.dbus.service.Object):
c8bceb
     def _get_property(self, prop):
c8bceb
         if prop not in [ "DefaultZone", "MinimalMark", "CleanupOnExit",
c8bceb
                          "Lockdown", "IPv6_rpfilter", "IndividualCalls",
c8bceb
-                         "LogDenied", "AutomaticHelpers", "FirewallBackend" ]:
c8bceb
+                         "LogDenied", "AutomaticHelpers" ]:
c8bceb
             raise dbus.exceptions.DBusException(
c8bceb
                 "org.freedesktop.DBus.Error.InvalidArgs: "
c8bceb
                 "Property '%s' does not exist" % prop)
c8bceb
@@ -526,10 +525,6 @@ class FirewallDConfig(slip.dbus.service.Object):
c8bceb
             if value is None:
c8bceb
                 value = config.FALLBACK_AUTOMATIC_HELPERS
c8bceb
             return dbus.String(value)
c8bceb
-        elif prop == "FirewallBackend":
c8bceb
-            if value is None:
c8bceb
-                value = config.FALLBACK_FIREWALL_BACKEND
c8bceb
-            return dbus.String(value)
c8bceb
 
c8bceb
     @dbus_handle_exceptions
c8bceb
     def _get_dbus_property(self, prop):
c8bceb
@@ -549,8 +544,6 @@ class FirewallDConfig(slip.dbus.service.Object):
c8bceb
             return dbus.String(self._get_property(prop))
c8bceb
         elif prop == "AutomaticHelpers":
c8bceb
             return dbus.String(self._get_property(prop))
c8bceb
-        elif prop == "FirewallBackend":
c8bceb
-            return dbus.String(self._get_property(prop))
c8bceb
         else:
c8bceb
             raise dbus.exceptions.DBusException(
c8bceb
                 "org.freedesktop.DBus.Error.InvalidArgs: "
c8bceb
@@ -590,7 +583,7 @@ class FirewallDConfig(slip.dbus.service.Object):
c8bceb
         if interface_name == config.dbus.DBUS_INTERFACE_CONFIG:
c8bceb
             for x in [ "DefaultZone", "MinimalMark", "CleanupOnExit",
c8bceb
                        "Lockdown", "IPv6_rpfilter", "IndividualCalls",
c8bceb
-                       "LogDenied", "AutomaticHelpers", "FirewallBackend" ]:
c8bceb
+                       "LogDenied", "AutomaticHelpers" ]:
c8bceb
                 ret[x] = self._get_property(x)
c8bceb
         elif interface_name in [ config.dbus.DBUS_INTERFACE_CONFIG_DIRECT,
c8bceb
                                  config.dbus.DBUS_INTERFACE_CONFIG_POLICIES ]:
c8bceb
@@ -616,8 +609,7 @@ class FirewallDConfig(slip.dbus.service.Object):
c8bceb
         if interface_name == config.dbus.DBUS_INTERFACE_CONFIG:
c8bceb
             if property_name in [ "MinimalMark", "CleanupOnExit", "Lockdown",
c8bceb
                                   "IPv6_rpfilter", "IndividualCalls",
c8bceb
-                                  "LogDenied", "AutomaticHelpers",
c8bceb
-                                  "FirewallBackend" ]:
c8bceb
+                                  "LogDenied", "AutomaticHelpers" ]:
c8bceb
                 if property_name == "MinimalMark":
c8bceb
                     try:
c8bceb
                         int(new_value)
c8bceb
@@ -646,11 +638,6 @@ class FirewallDConfig(slip.dbus.service.Object):
c8bceb
                         raise FirewallError(errors.INVALID_VALUE,
c8bceb
                                             "'%s' for %s" % \
c8bceb
                                             (new_value, property_name))
c8bceb
-                if property_name == "FirewallBackend":
c8bceb
-                    if new_value not in config.FIREWALL_BACKEND_VALUES:
c8bceb
-                        raise FirewallError(errors.INVALID_VALUE,
c8bceb
-                                            "'%s' for %s" % \
c8bceb
-                                            (new_value, property_name))
c8bceb
                 self.config.get_firewalld_conf().set(property_name, new_value)
c8bceb
                 self.config.get_firewalld_conf().write()
c8bceb
                 self.PropertiesChanged(interface_name,
c8bceb
diff --git a/src/tests/dbus/firewalld.conf.at b/src/tests/dbus/firewalld.conf.at
c8bceb
index 473210de10af..3887d7ee4a7d 100644
c8bceb
--- a/src/tests/dbus/firewalld.conf.at
c8bceb
+++ b/src/tests/dbus/firewalld.conf.at
c8bceb
@@ -5,7 +5,6 @@ DBUS_GETALL([config], [config], 0, [dnl
c8bceb
 string "AutomaticHelpers" : variant string "system"
c8bceb
 string "CleanupOnExit" : variant string "no"
c8bceb
 string "DefaultZone" : variant string "public"
c8bceb
-string "FirewallBackend" : variant string "nftables"
c8bceb
 m4_if(no, HOST_SUPPORTS_NFT_FIB, [dnl
c8bceb
 string "IPv6_rpfilter" : variant string "no"],[dnl
c8bceb
 string "IPv6_rpfilter" : variant string "yes"])
c8bceb
@@ -29,7 +28,6 @@ _helper([Lockdown], [string:"yes"], [variant string "yes"])
c8bceb
 _helper([LogDenied], [string:"all"], [variant string "all"])
c8bceb
 _helper([IPv6_rpfilter], [string:"yes"], [variant string "yes"])
c8bceb
 _helper([IndividualCalls], [string:"yes"], [variant string "yes"])
c8bceb
-_helper([FirewallBackend], [string:"iptables"], [variant string "iptables"])
c8bceb
 _helper([CleanupOnExit], [string:"yes"], [variant string "yes"])
c8bceb
 dnl Note: DefaultZone is RO
c8bceb
 m4_undefine([_helper])
c8bceb
diff --git a/src/tests/functions.at b/src/tests/functions.at
c8bceb
index f8ab929118e5..b95324847e5c 100644
c8bceb
--- a/src/tests/functions.at
c8bceb
+++ b/src/tests/functions.at
c8bceb
@@ -70,9 +70,6 @@ m4_define([FWD_START_TEST], [
c8bceb
         dnl don't unload modules or bother cleaning up, the namespace will be deleted
c8bceb
         AT_CHECK([sed -i 's/^CleanupOnExit.*/CleanupOnExit=no/' ./firewalld.conf])
c8bceb
 
c8bceb
-        dnl set the appropriate backend
c8bceb
-        AT_CHECK([sed -i 's/^FirewallBackend.*/FirewallBackend=FIREWALL_BACKEND/' ./firewalld.conf])
c8bceb
-
c8bceb
         dnl fib matching is pretty new in nftables. Don't use rpfilter on older
c8bceb
         dnl kernels.
c8bceb
         m4_if(nftables, FIREWALL_BACKEND, [
c8bceb
diff --git a/src/tests/testsuite.at b/src/tests/testsuite.at
c8bceb
index 2943d7460919..68d18c9018b8 100644
c8bceb
--- a/src/tests/testsuite.at
c8bceb
+++ b/src/tests/testsuite.at
c8bceb
@@ -10,7 +10,7 @@ m4_include([functions.at])
c8bceb
 m4_include([firewall-offline-cmd.at])
c8bceb
 m4_include([dbus.at])
c8bceb
 
c8bceb
-m4_foreach([FIREWALL_BACKEND], [[nftables], [iptables]], [
c8bceb
+m4_foreach([FIREWALL_BACKEND], [[iptables]], [
c8bceb
     m4_include([firewall-cmd.at])
c8bceb
     m4_include([regression.at])
c8bceb
     m4_include([python.at])
c8bceb
-- 
c8bceb
2.18.0
c8bceb