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

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

 



On Mon, 9 Aug 2010, Brian C. Lane wrote:

On 08/06/2010 10:45 PM, dcantrell@xxxxxxxxxx wrote:
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)

header and check for isfile isn't needed, since this is the first time
it has been written, and you're using "w+" which will overwrite it anyway.

Unless this is an upgrade, the file might exist.  Long shot, but I don't want
to drive over the file if it already exists.

And I wanted to do append, which looks like "a" according to:
    http://docs.python.org/library/functions.html

Ooops.

--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
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