Blame SOURCES/firewalld-0.4.3.2-no_blanked_zone_rhbz#1381314.patch

30ee8d
commit 636e01137515f3830c655619096e9642651a674c
30ee8d
Author: Thomas Woerner <twoerner@redhat.com>
30ee8d
Date:   Thu Dec 1 12:02:55 2016 +0100
30ee8d
30ee8d
    firewall.core.fw_zone: Do not reset ZONE with ifdown
30ee8d
    
30ee8d
    On reboot or shutdown the zone has been reset to default if the network
30ee8d
    service is enabled and controlling the interface.
30ee8d
    
30ee8d
    The call of firewall-cmd --remove-interface in ifdown.post is now only removing
30ee8d
    the zone binding in the firewall, but not modifying the ifcfg file anymore.
30ee8d
    
30ee8d
    This fixes RHBZ#1381314
30ee8d
30ee8d
diff --git a/doc/xml/firewall-cmd.xml b/doc/xml/firewall-cmd.xml
30ee8d
index 3503df4..c9d8ef5 100644
30ee8d
--- a/doc/xml/firewall-cmd.xml
30ee8d
+++ b/doc/xml/firewall-cmd.xml
30ee8d
@@ -896,7 +896,12 @@ For interfaces that are not under control of NetworkManager, firewalld tries to
30ee8d
 	  <listitem>
30ee8d
 	    <para>
30ee8d
 	      If the interface is under control of NetworkManager, it is at first connected to change the zone for the connection that is using the interface. If this fails, the zone binding is created in firewalld and the limitations below apply.
30ee8d
-For interfaces that are not under control of NetworkManager, firewalld tries to change the ZONE setting in the ifcfg file, if the file exists.
30ee8d
+	    </para>
30ee8d
+	    <para>
30ee8d
+	      For the addion or change of interfaces that are not under control of NetworkManager: firewalld tries to change the ZONE setting in the ifcfg file, if an ifcfg file exists that is using the interface.
30ee8d
+	    </para>
30ee8d
+	    <para>
30ee8d
+	      Only for the removal of interfaces that are not under control of NetworkManager: firewalld is not trying to change the ZONE setting in the ifcfg file. This is needed to make sure that an ifdown of the interface will not result in a reset of the zone setting to the default zone. Only the zone binding is then removed in firewalld then.
30ee8d
 	    </para>
30ee8d
 	    <para>
30ee8d
 	      Remove binding of interface <replaceable>interface</replaceable> from zone it was previously added to.
30ee8d
diff --git a/doc/xml/firewallctl.xml b/doc/xml/firewallctl.xml
30ee8d
index 11b5e60..30be89f 100644
30ee8d
--- a/doc/xml/firewallctl.xml
30ee8d
+++ b/doc/xml/firewallctl.xml
30ee8d
@@ -550,7 +550,6 @@
30ee8d
 	    </para>
30ee8d
 	    <para>
30ee8d
 	      If the interface is under control of NetworkManager, it is at first connected to change the zone for the connection that is using the interface for new or changed interface bindings. If the setting in NetworkManager fails, the zone binding is created or changed in firewalld and the limitations below apply.
30ee8d
-For interfaces that are not under control of NetworkManager, firewalld tries to change the ZONE setting in the ifcfg file, if the file exists.
30ee8d
 	    </para>
30ee8d
 	    <para>
30ee8d
 	      As a end user you don't need to create or change zone bindings of interfaces in most cases, because NetworkManager (or legacy network service) adds interfaces into zones automatically (according to <option>ZONE=</option> option from ifcfg-<replaceable>interface</replaceable> file) if <replaceable>NM_CONTROLLED=no</replaceable> is not set.
30ee8d
@@ -559,6 +558,12 @@ For interfaces that are not under control of NetworkManager, firewalld tries to
30ee8d
 	      Please also have a look at the <citerefentry><refentrytitle>firewalld</refentrytitle><manvolnum>1</manvolnum></citerefentry> man page in the <replaceable>Concepts</replaceable> section.
30ee8d
 	      For permanent association of interface with a zone, see also 'How to set or change a zone for a connection?' in <citerefentry><refentrytitle>firewalld.zones</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
30ee8d
 	    </para>
30ee8d
+	    <para>
30ee8d
+	      For the addion or change of interfaces that are not under control of NetworkManager: firewalld tries to change the ZONE setting in the ifcfg file, if an ifcfg file exists that is using the interface.
30ee8d
+	    </para>
30ee8d
+	    <para>
30ee8d
+	      Only for the removal of interfaces that are not under control of NetworkManager: firewalld is not trying to change the ZONE setting in the ifcfg file. This is needed to make sure that an ifdown of the interface will not result in a reset of the zone setting to the default zone. Only the zone binding is then removed in firewalld then.
30ee8d
+	    </para>
30ee8d
 	  </listitem>
30ee8d
 	</varlistentry>
30ee8d
 
30ee8d
diff --git a/doc/xml/firewalld.zones.xml b/doc/xml/firewalld.zones.xml
30ee8d
index 2f81a8a..387cf6b 100644
30ee8d
--- a/doc/xml/firewalld.zones.xml
30ee8d
+++ b/doc/xml/firewalld.zones.xml
30ee8d
@@ -223,6 +223,12 @@
30ee8d
       <para>
30ee8d
        If the connection is controlled by NetworkManager, you can also use <command>nm-connection-editor</command> to change the zone.
30ee8d
       </para>
30ee8d
+      <para>
30ee8d
+	For the addion or change of interfaces that are not under control of NetworkManager: firewalld tries to change the ZONE setting in the ifcfg file, if an ifcfg file exists that is using the interface.
30ee8d
+      </para>
30ee8d
+      <para>
30ee8d
+	Only for the removal of interfaces that are not under control of NetworkManager: firewalld is not trying to change the ZONE setting in the ifcfg file. This is needed to make sure that an ifdown of the interface will not result in a reset of the zone setting to the default zone. Only the zone binding is then removed in firewalld then.
30ee8d
+      </para>
30ee8d
     </refsect2>
30ee8d
 
30ee8d
   </refsect1>
30ee8d
diff --git a/src/firewall/core/fw_zone.py b/src/firewall/core/fw_zone.py
30ee8d
index e4fdecf..098eed9 100644
30ee8d
--- a/src/firewall/core/fw_zone.py
30ee8d
+++ b/src/firewall/core/fw_zone.py
30ee8d
@@ -671,7 +671,11 @@ class FirewallZone(object):
30ee8d
         zone_transaction.add_post(self.__unregister_interface, _obj,
30ee8d
                                   interface_id)
30ee8d
 
30ee8d
-        zone_transaction.add_post(ifcfg_set_zone_of_interface, "", interface)
30ee8d
+        # Do not reset ZONE with ifdown
30ee8d
+        # On reboot or shutdown the zone has been reset to default
30ee8d
+        # if the network service is enabled and controlling the
30ee8d
+        # interface (RHBZ#1381314)
30ee8d
+        #zone_transaction.add_post(ifcfg_set_zone_of_interface, "", interface)
30ee8d
 
30ee8d
         if use_zone_transaction is None:
30ee8d
             zone_transaction.execute(True)
30ee8d
30ee8d
commit fe6cf16e5a5ef3e49cdb554af8cf18024371554a
30ee8d
Author: Thomas Woerner <twoerner@redhat.com>
30ee8d
Date:   Thu Oct 6 15:07:37 2016 +0200
30ee8d
30ee8d
    firewall.core.io.ifcfg: Use .bak for save files
30ee8d
30ee8d
diff --git a/src/firewall/core/io/ifcfg.py b/src/firewall/core/io/ifcfg.py
30ee8d
index e145f49..6ae0302 100644
30ee8d
--- a/src/firewall/core/io/ifcfg.py
30ee8d
+++ b/src/firewall/core/io/ifcfg.py
30ee8d
@@ -179,7 +179,7 @@ class ifcfg(object):
30ee8d
         # make backup
30ee8d
         if os.path.exists(self.filename):
30ee8d
             try:
30ee8d
-                shutil.copy2(self.filename, "%s.old" % self.filename)
30ee8d
+                shutil.copy2(self.filename, "%s.bak" % self.filename)
30ee8d
             except Exception as msg:
30ee8d
                 os.remove(temp_file.name)
30ee8d
                 raise IOError("Backup of '%s' failed: %s" % (self.filename, msg))