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

[PATCH f15-branch master] Fix setting of some network values in loader kickstart.



Also remove noksdevice handling. It doesn't work anymore,
I wonder if it ever have worked or even been used.
---
 loader/kickstart.c |   94 ++++++++++++++++++++++++++--------------------------
 1 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/loader/kickstart.c b/loader/kickstart.c
index 06804f8..7e7379b 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -677,7 +677,7 @@ cleanup:
 
 static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *handler) {
     PyObject *list = getDataList(handler, "network");
-    PyObject *ele, *attr, *noksdev;
+    PyObject *ele, *attr;
     iface_t iface;
 
     if (!list)
@@ -695,12 +695,20 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
     if (objIsStr(attr, "dhcp") || objIsStr(attr, "bootp")) {
         loaderData->ipv4 = strdup("dhcp");
         loaderData->ipinfo_set = 1;
-    } else if (loaderData->ipv4) {
-        loaderData->ipinfo_set = 1;
+    } else if (objIsStr(attr, "static")) {
+        _setNetworkString(ele, "ip", &loaderData->ipv4, &loaderData->ipinfo_set);
     }
 
     Py_XDECREF(attr);
 
+#ifdef ENABLE_IPV6
+    _setNetworkString(ele, "ipv6", &loaderData->ipv6, &loaderData->ipv6info_set);
+#endif
+
+    _setNetworkString(ele, "nameserver", &loaderData->dns, NULL);
+    _setNetworkString(ele, "netmask", &loaderData->netmask, NULL);
+    _setNetworkString(ele, "hostname", &loaderData->hostname, NULL);
+
     /* --gateway is common for ipv4 and ipv6, same as in loader UI */
     attr = getObject(ele, "gateway", 0);
     if (isNotEmpty(attr)) {
@@ -735,63 +743,57 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
 
     Py_XDECREF(attr);
 
-    noksdev = getObject(ele, "notksdevice", 0);
-    if (!isTrue(noksdev)) {
-        attr = getObject(ele, "device", 0);
-        if (isNotEmpty(attr)) {
-            char *device = PyString_AsString(attr);
+    attr = getObject(ele, "device", 0);
+    if (isNotEmpty(attr)) {
+        char *device = PyString_AsString(attr);
 
-            /* If --device=MAC was given, translate into a device name now. */
-            if (index(device, ':') != NULL)
-                loaderData->netDev = iface_mac2device(device);
-            else
-                loaderData->netDev = strdup(device);
+        /* If --device=MAC was given, translate into a device name now. */
+        if (index(device, ':') != NULL)
+            loaderData->netDev = iface_mac2device(device);
+        else
+            loaderData->netDev = strdup(device);
 
-            loaderData->netDev_set = 1;
-        }
+        loaderData->netDev_set = 1;
+    }
 
-        Py_XDECREF(attr);
+    Py_XDECREF(attr);
 
-        _setNetworkString(ele, "dhcpclass", &loaderData->netCls, &loaderData->netCls_set);
-        _setNetworkString(ele, "ethtool", &loaderData->ethtool, NULL);
-        _setNetworkString(ele, "essid", &loaderData->essid, NULL);
-        _setNetworkString(ele, "wepkey", &loaderData->wepkey, NULL);
+    _setNetworkString(ele, "dhcpclass", &loaderData->netCls, &loaderData->netCls_set);
+    _setNetworkString(ele, "ethtool", &loaderData->ethtool, NULL);
+    _setNetworkString(ele, "essid", &loaderData->essid, NULL);
+    _setNetworkString(ele, "wepkey", &loaderData->wepkey, NULL);
 
-        attr = getObject(ele, "noipv4", 0);
-        if (isTrue(attr))
-            flags |= LOADER_FLAGS_NOIPV4;
+    attr = getObject(ele, "noipv4", 0);
+    if (isTrue(attr))
+        flags |= LOADER_FLAGS_NOIPV4;
 
-        Py_XDECREF(attr);
+    Py_XDECREF(attr);
 
-        attr = getObject(ele, "mtu", 0);
-        if (isNotEmpty(attr)) {
-            /* Don't free this string! */
-            char *mtu = PyString_AsString(attr);
+    attr = getObject(ele, "mtu", 0);
+    if (isNotEmpty(attr)) {
+        /* Don't free this string! */
+        char *mtu = PyString_AsString(attr);
 
-            errno = 0;
-            loaderData->mtu = strtol(mtu, NULL, 10);
+        errno = 0;
+        loaderData->mtu = strtol(mtu, NULL, 10);
 
-            if ((errno == ERANGE && (loaderData->mtu == LONG_MIN ||
-                                     loaderData->mtu == LONG_MAX)) ||
-                (errno != 0 && loaderData->mtu == 0)) {
-                logMessage(ERROR, "%s: %d: %m", __func__, __LINE__);
-                abort();
-            }
+        if ((errno == ERANGE && (loaderData->mtu == LONG_MIN ||
+                                 loaderData->mtu == LONG_MAX)) ||
+            (errno != 0 && loaderData->mtu == 0)) {
+            logMessage(ERROR, "%s: %d: %m", __func__, __LINE__);
+            abort();
         }
+    }
 
-        Py_XDECREF(attr);
+    Py_XDECREF(attr);
 
 #ifdef ENABLE_IPV6
-        attr = getObject(ele, "noipv6", 0);
-        if (isTrue(attr))
-            flags |= LOADER_FLAGS_NOIPV6;
-
-        if (loaderData->ipv6)
-            loaderData->ipv6info_set = 1;
+    attr = getObject(ele, "noipv6", 0);
+    if (isTrue(attr))
+        flags |= LOADER_FLAGS_NOIPV6;
 
-        Py_XDECREF(attr);
+    Py_XDECREF(attr);
 #endif
-    }
 
     attr = getObject(ele, "nodns", 0);
     if (isTrue(attr))
@@ -799,8 +801,6 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
 
     Py_XDECREF(attr);
 
-    Py_XDECREF(noksdev);
-
     /* Make sure the network is always up if there's a network line in the
      * kickstart file, as %post/%pre scripts might require that.
      */
-- 
1.7.2


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