[PATCH 6/9] Add kickstart network --nodefroute option (#638131)

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

 



Sets DEFROUTE=no in ifcfg file.
---
 isys/iface.c |    1 +
 isys/iface.h |    1 +
 loader/net.c |   12 +++++++++++-
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/isys/iface.c b/isys/iface.c
index ad39447..05446ee 100644
--- a/isys/iface.c
+++ b/isys/iface.c
@@ -385,6 +385,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/isys/iface.h b/isys/iface.h
index 8f90271..6344212 100644
--- a/isys/iface.h
+++ b/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/loader/net.c b/loader/net.c
index 67dd144..81f11a8 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1458,6 +1458,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 (fclose(fp) == EOF) {
         free(ofile);
         free(nfile);
@@ -1537,7 +1542,7 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
     gchar *bootProto = NULL, *device = NULL, *class = NULL, *ethtool = NULL;
     gchar *essid = NULL, *wepkey = NULL, *onboot = NULL, *gateway = NULL;
     gint mtu = 1500, dhcpTimeout = -1;
-    gboolean noipv4 = FALSE, noipv6 = FALSE, noDns = FALSE, noksdev = FALSE, activate = FALSE;
+    gboolean noipv4 = FALSE, noipv6 = FALSE, noDns = FALSE, noksdev = FALSE, activate = FALSE, nodefroute=FALSE;
     GOptionContext *optCon = g_option_context_new(NULL);
     GError *optErr = NULL;
     struct in_addr addr;
@@ -1571,6 +1576,7 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
         { "onboot", 0, 0, G_OPTION_ARG_STRING, &onboot, NULL, NULL },
         { "notksdevice", 0, 0, G_OPTION_ARG_NONE, &noksdev, NULL, NULL },
         { "activate", 0, 0, G_OPTION_ARG_NONE, &activate, NULL, NULL },
+        { "nodefroute", 0, 0, G_OPTION_ARG_NONE, &nodefroute, NULL, NULL },
         { "dhcptimeout", 0, 0, G_OPTION_ARG_INT, &dhcpTimeout, NULL, NULL },
         { NULL },
     };
@@ -1695,6 +1701,10 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
         loaderData->noDns = 1;
     }
 
+    if (nodefroute) {
+        iface.defroute = 0;
+    }
+
     if (activate) {
         activateDevice(loaderData, &iface);
     }
-- 
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