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

[PATCH] Always return correct network config, when kickstartNetworkUp returns 0 (#495042)



If kickstartNetworkUp finishes successfully, copy the network config to
persistent store. If we call it again with network already configured,
just return 0 and fill the net configuration from the recorded state.
---
 loader2/net.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/loader2/net.c b/loader2/net.c
index 58af1db..526df3d 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -2424,10 +2424,14 @@ int chooseNetworkInterface(struct loaderData_s * loaderData) {
 int kickstartNetworkUp(struct loaderData_s * loaderData,
                        struct networkDeviceConfig *netCfgPtr) {
     int rc, query;
+    static struct networkDeviceConfig netCfgStore;
 
     /* we may have networking already, so return to the caller */
     if ((loaderData->ipinfo_set == 1) || (loaderData->ipv6info_set == 1)) {
         logMessage(INFO, "networking already configured in kickstartNetworkUp");
+    
+        /* Give the network information to the caller (#495042) */
+        memcpy(netCfgPtr, &netCfgStore, sizeof(netCfgStore));
         return 0;
     }
 
@@ -2493,6 +2497,9 @@ int kickstartNetworkUp(struct loaderData_s * loaderData,
             break;
     } while (1);
 
+    /* Store all information for possible subsequent calls (#495042) */
+    memcpy(&netCfgStore, netCfgPtr, sizeof(netCfgStore));
+
     return 0;
 }
 
-- 
1.6.4.4


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