[PATCH master 06/13] Add kickstart network --nodefroute option

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

 



Port from rhel6-branch.
Resolves: rhbz#638131

Sets DEFROUTE=no in ifcfg file. Use case: one NIC used to fetch
packages, another for iSCSI. Using the option we can prevent the latter
to grab default route.
---
 loader/kickstart.c      |    6 ++++++
 loader/net.c            |    5 +++++
 pyanaconda/isys/iface.c |    1 +
 pyanaconda/isys/iface.h |    1 +
 pyanaconda/kickstart.py |    3 +++
 5 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/loader/kickstart.c b/loader/kickstart.c
index 06631ff..6f9f831 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -839,6 +839,12 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
 
         Py_XDECREF(attr);
 
+        attr = getObject(ele, "nodefroute", 0);
+        if (isTrue(attr))
+            iface.defroute = 0;
+
+        Py_XDECREF(attr);
+
         Py_XDECREF(noksdev);
 
         if (!is_nm_connected()) {
diff --git a/loader/net.c b/loader/net.c
index 58a1c10..1f01ddb 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1480,6 +1480,11 @@ int writeEnabledNetInfo(iface_t *iface) {
         fprintf(fp, "MACADDR=%s\n", iface->macaddr);
     }
 
+    if (!iface->defroute) {
+        fprintf(fp, "DEFROUTE=no\n");
+        logMessage(INFO, "not setting default route via %s", iface->device);
+    }
+
     if (iface->ssid) {
         fprintf(fp, "ESSID=%s\n", iface->ssid);
     }
diff --git a/pyanaconda/isys/iface.c b/pyanaconda/isys/iface.c
index 391c38e..833fee6 100644
--- a/pyanaconda/isys/iface.c
+++ b/pyanaconda/isys/iface.c
@@ -387,6 +387,7 @@ void iface_init_iface_t(iface_t *iface) {
     iface->flags = 0;
     iface->ipv4method = IPV4_UNUSED_METHOD;
     iface->ipv6method = IPV6_UNUSED_METHOD;
+    iface->defroute = 1;
 
     return;
 }
diff --git a/pyanaconda/isys/iface.h b/pyanaconda/isys/iface.h
index b76b3a7..3c37d18 100644
--- a/pyanaconda/isys/iface.h
+++ b/pyanaconda/isys/iface.h
@@ -68,6 +68,7 @@ typedef struct _iface_t {
     /* Gateway settings */
     struct in_addr gateway;
     struct in6_addr gateway6;
+    int defroute;
 
     /* BOOTP (these can be IPv4 or IPv6, store human-readable version as str) */
     char *nextserver;
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 48762f6..7fb72d7 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -673,6 +673,9 @@ class NetworkData(commands.network.F15_NetworkData):
             if self.gateway != "":
                 self.anaconda.network.setGateway(self.gateway, device)
 
+        if self.nodefroute:
+            dev.set (("DEFROUTE", "no"))
+
         needs_net = (self.anaconda.methodstr and
                      (self.anaconda.methodstr.startswith("http:") or
                       self.anaconda.methodstr.startswith("ftp:") or
-- 
1.7.2

_______________________________________________
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