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

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

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

On 08/06/2010 10:45 PM, dcantrell redhat com wrote:
From: David Cantrell <dcantrell redhat com>

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
 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,))

+        # /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:


David Cantrell <dcantrell redhat com>
Red Hat / Honolulu, HI

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