[PATCH rhel6-branch 12/11] Initialize loaderData values in kickstart network command.

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

 



Related: rhbz#638131

This adds to my recent 11 patches. The initialization is
needed for additional network commands which used to be ignored
before in loader.

NOTE: --device option is not initialized to keep present behaviour
of using ksdevice boot option as default. For other than first
network commands handled in loader (those having new option
--activate) the device of previous network command would be used
as default, which is incorrect, but acceptable IMO because for
existing kickstarts additional commands will still be ignored
(they don't have --activate option) and for the new behaviour
we can require --device option to be obligatory. Solution
fixing this would require hack similar (more complicated)
to patch [11/11] or substantial fix of loader network configuration
code.

---
 loader/net.c |   37 +++++++++++++++++++++++++++++++------
 1 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/loader/net.c b/loader/net.c
index 729628a..c6ffb86 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1564,6 +1564,37 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
     };
 
     iface_init_iface_t(&iface);
+    /* initialize loaderData struct */
+    /* except for --device which we want to take over from cmdline */
+    /* ksdevice for the first command */
+    free(loaderData->ipv4);
+    loaderData->ipv4 = NULL;
+    loaderData->ipinfo_set = 0;
+    free(loaderData->dns);
+    loaderData->dns = NULL;
+    free(loaderData->netmask);
+    loaderData->netmask = NULL;
+    free(loaderData->hostname);
+    loaderData->hostname = NULL;
+    free(loaderData->gateway);
+    loaderData->gateway = NULL;
+    free(loaderData->netCls);
+    loaderData->netCls = NULL;
+    loaderData->netCls_set = 0;
+    free(loaderData->ethtool);
+    loaderData->ethtool = NULL;
+    loaderData->essid = NULL;
+    free(loaderData->wepkey);
+    loaderData->wepkey = NULL;
+    loaderData->mtu = 0;
+
+#ifdef ENABLE_IPV6
+    free(loaderData->ipv6);
+    loaderData->ipv6 = NULL;
+    loaderData->ipv6info_set = 0;
+    free(loaderData->gateway6);
+    loaderData->gateway6 = NULL;
+#endif
 
     g_option_context_set_help_enabled(optCon, FALSE);
     g_option_context_add_main_entries(optCon, ksOptions, NULL);
@@ -1642,22 +1673,16 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc,
         }
 
         if (ethtool) {
-            if (loaderData->ethtool)
-                free(loaderData->ethtool);
             loaderData->ethtool = strdup(ethtool);
             free(ethtool);
         }
 
         if (essid) {
-            if (loaderData->essid)
-                free(loaderData->essid);
             loaderData->essid = strdup(essid);
             free(essid);
         }
 
         if (wepkey) {
-            if (loaderData->wepkey)
-                free(loaderData->wepkey);
             loaderData->wepkey = strdup(wepkey);
             free(wepkey);
         }
-- 
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