summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--loader2/loader.c4
-rw-r--r--loader2/net.c11
2 files changed, 12 insertions, 3 deletions
diff --git a/loader2/loader.c b/loader2/loader.c
index 25f8a86d2..d879cb432 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -98,6 +98,8 @@ static int newtRunning = 0;
#include "urlinstall.h"
#endif
+int num_link_checks = 5;
+
static struct installMethod installMethods[] = {
#if !defined(__s390__) && !defined(__s390x__)
{ N_("Local CDROM"), "cdrom", 0, CLASS_CDROM, mountCdromImage },
@@ -566,6 +568,8 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
loaderData->dns = strdup(argv[i] + 4);
else if (!strncasecmp(argv[i], "ethtool=", 8))
loaderData->ethtool = strdup(argv[i] + 8);
+ else if (!strncasecmp(argv[i], "linksleep=", 10))
+ num_link_checks = atoi(argv[i] + 10);
else if (!strncasecmp(argv[i], "allowcddma", 10))
flags |= LOADER_FLAGS_ENABLECDDMA;
else if (!strncasecmp(argv[i], "selinux=0", 9))
diff --git a/loader2/net.c b/loader2/net.c
index 10f2845c2..e48a47ef1 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -119,20 +119,21 @@ static void fillInIpInfo(struct networkDeviceConfig * cfg) {
}
static int waitForLink(char * dev) {
+ extern int num_link_checks;
int tries = 0;
/* try to wait for a valid link -- if the status is unknown or
* up continue, else sleep for 1 second and try again for up
* to five times */
logMessage("waiting for link...");
- while (tries < 5) {
- if (get_link_status(dev) != 0)
+ while (tries < num_link_checks) {
+ if (get_link_status(dev) != 0)
break;
sleep(1);
tries++;
}
logMessage("%d seconds.", tries);
- if (tries < 5)
+ if (tries < num_link_checks)
return 0;
return 1;
}
@@ -651,6 +652,10 @@ int configureNetwork(struct networkDeviceConfig * dev) {
if (dev->dev.set & PUMP_NETINFO_HAS_GATEWAY)
pumpSetupDefaultGateway(&dev->dev.gateway);
+ /* we need to wait for a link after setting up the interface as some
+ * switches decide to reconfigure themselves after that (#115825)
+ */
+ waitForLink((char *)&dev->dev.device);
return 0;
}