[PATCH rhel6-branch] Disable ipv6 on target system when using noipv6 option (#735791)

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

 



The option can be set in boot command line, in kickstart file using network
command, and in loader UI. The option takes effect only if there is no device
with configured ipv6.

Resolves: rhbz#735791
---
 network.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/network.py b/network.py
index 8bdd096..b03c755 100644
--- a/network.py
+++ b/network.py
@@ -47,6 +47,7 @@ log = logging.getLogger("anaconda")
 sysconfigDir = "/etc/sysconfig"
 netscriptsDir = "%s/network-scripts" % (sysconfigDir)
 networkConfFile = "%s/network" % (sysconfigDir)
+ipv6ConfFile = "/etc/modprobe.d/ipv6.conf"
 ifcfgLogFile = "/tmp/ifcfg.log"
 CONNECTION_TIMEOUT = 45
 
@@ -589,6 +590,9 @@ class Network:
         self._copyFileToPath("/etc/udev/rules.d/70-persistent-net.rules",
                              instPath, overwrite=flags.livecdInstall)
 
+        self._copyFileToPath(ipv6ConfFile, instPath,
+                             overwrite=flags.livecdInstall)
+
     def disableNMForStorageDevices(self, anaconda, instPath=''):
         for devName, device in self.netdevices.items():
             if (device.usedByFCoE(anaconda) or
@@ -664,6 +668,19 @@ class Network:
 
         # /etc/resolv.conf is managed by NM
 
+        # disable ipv6
+        if ('noipv6' in flags.cmdline
+            and not [dev for dev in devices
+                     if dev.get('IPV6INIT') == "yes"]):
+            if os.path.exists(ipv6ConfFile):
+                log.warning('Not disabling ipv6, %s exists' % ipv6ConfFile)
+            else:
+                log.info('Disabling ipv6 on target system')
+                f = open(ipv6ConfFile, "w")
+                f.write("# Anaconda disabling ipv6\n")
+                f.write("options ipv6 disable=1\n")
+                f.close()
+
     def waitForDevicesActivation(self, devices):
         waited_devs_props = {}
 
-- 
1.7.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux