[PATCH 4/4] Disable ipv6 kernel modules if user disables IPv6 (#537887)

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

 



From: David Cantrell <dcantrell@xxxxxxxxxx>

If the user passes 'noipv6' or otherwise disables IPv6 on the target
system for all network devices, write out /etc/modprobe.d/noipv6 with
these lines:

    # Disable IPv6 kernel modules (added by anaconda)
    alias net-pf-10 off
    alias ipv6 off
    options ipv6 disable=1

Based on a patch provided in the bug, but modified so that the lines are
written to 'noipv6' in /etc/modprobe.d rather than /etc/modprobe.conf
and so that the file is only written out if IPv6 is disabled on all
interfaces.
---
 network.py  |   21 +++++++++++++++++++++
 packages.py |    1 +
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/network.py b/network.py
index 0feb8fd..b88ace9 100644
--- a/network.py
+++ b/network.py
@@ -605,3 +605,24 @@ class Network:
                 f.write("nameserver %s\n" % (ns,))
 
         f.close()
+
+        # /etc/modprobe.d/noipv6
+        if useIPv6 == "no":
+            d = instPath + "/etc/modprobe.d"
+            c = d + "/noipv6"
+            header = None
+
+            iutil.mkdirChain(d)
+
+            if os.path.isfile(c):
+                header = "\n"
+
+            f = open(c, "w+")
+            if header:
+                f.write(header)
+
+            f.write("# Disable IPv6 kernel modules (added by anaconda)\n")
+            f.write("alias net-pf-10 off\n")
+            f.write("alias ipv6 off\n")
+            f.write("options ipv6 disable=1\n")
+            f.close()
diff --git a/packages.py b/packages.py
index a1a6e56..c030eba 100644
--- a/packages.py
+++ b/packages.py
@@ -209,6 +209,7 @@ def setFileCons(anaconda):
                  "/etc/blkid.tab", "/etc/blkid.tab.old", 
                  "/etc/mtab", "/etc/fstab", "/etc/resolv.conf",
                  "/etc/modprobe.conf", "/etc/modprobe.conf~",
+                 "/etc/modprobe.d/noipv6",
                  "/var/log/wtmp", "/var/run/utmp",
                  "/dev/log", "/var/lib/rpm", "/", "/etc/raidtab",
                  "/etc/mdadm.conf", "/etc/hosts", "/etc/sysconfig/network",
-- 
1.7.2.1

_______________________________________________
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