summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Sivak <msivak@redhat.com>2007-11-20 14:07:59 +0100
committerMartin Sivak <msivak@redhat.com>2007-11-20 14:07:59 +0100
commit0e1b5ac4e3b77b93b4a0d9730ecc9953c78ee08f (patch)
tree913cf388218b8056b04288d6f103b5e4e0e1ee1e
parent91133cfdaf37531ab46c9a31beb0ee2d825f19b8 (diff)
downloadanaconda-0e1b5ac4e3b77b93b4a0d9730ecc9953c78ee08f.tar.gz
anaconda-0e1b5ac4e3b77b93b4a0d9730ecc9953c78ee08f.tar.xz
anaconda-0e1b5ac4e3b77b93b4a0d9730ecc9953c78ee08f.zip
Add nicdelay parameter to loader, so we can wait before sending DHCP requests
in the case of STP delays (#349521).
-rw-r--r--loader2/loader.c3
-rw-r--r--loader2/net.c12
2 files changed, 14 insertions, 1 deletions
diff --git a/loader2/loader.c b/loader2/loader.c
index 43d6bdb0c..e8f97c1b6 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -112,6 +112,7 @@ uint64_t flags = LOADER_FLAGS_SELINUX | LOADER_FLAGS_NOFB;
#endif
int num_link_checks = 5;
+int post_link_sleep = 0;
static struct installMethod installMethods[] = {
#if !defined(__s390__) && !defined(__s390x__)
@@ -776,6 +777,8 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
loaderData->wepkey = strdup(argv[i] + 7);
else if (!strncasecmp(argv[i], "linksleep=", 10))
num_link_checks = atoi(argv[i] + 10);
+ else if (!strncasecmp(argv[i], "nicdelay=", 9))
+ post_link_sleep = atoi(argv[i] + 9);
else if (!strncasecmp(argv[i], "selinux=0", 9))
flags &= ~LOADER_FLAGS_SELINUX;
else if (!strncasecmp(argv[i], "selinux", 7))
diff --git a/loader2/net.c b/loader2/net.c
index 9958689c5..c5dcabd43 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -150,12 +150,14 @@ static void v6MethodCallback(newtComponent co, void *dptr) {
static int waitForLink(char * dev) {
extern int num_link_checks;
+ extern int post_link_sleep;
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(DEBUGLVL, "waiting for link %s...", dev);
+
while (tries < num_link_checks) {
if (get_link_status(dev) != 0)
break;
@@ -163,8 +165,16 @@ static int waitForLink(char * dev) {
tries++;
}
logMessage(DEBUGLVL, " %d seconds.", tries);
- if (tries < num_link_checks)
+ if (tries < num_link_checks){
+ /* Networks with STP set up will give link when the port
+ * is isolated from the network, and won't forward packets
+ * until they decide we're not a switch. */
+ logMessage(DEBUGLVL, "sleep (nicdelay) for %d secs first", post_link_sleep);
+ sleep(post_link_sleep);
+ logMessage(DEBUGLVL, "continuing...");
return 0;
+ }
+
logMessage(WARNING, " no network link detected on %s", dev);
return 1;
}