diff -ur sbin/dhclient.orig/dhclient.8 sbin/dhclient/dhclient.8 --- sbin/dhclient.orig/dhclient.8 2008-07-12 09:40:39.000000000 +0300 +++ sbin/dhclient/dhclient.8 2008-07-12 09:53:17.000000000 +0300 @@ -83,6 +83,8 @@ Specify an alternate location, .Ar file , for the leases file. +.It Fl t Ar timeout +Specify how many seconds to wait for link. .It Fl q Forces .Nm diff -ur sbin/dhclient.orig/dhclient.c sbin/dhclient/dhclient.c --- sbin/dhclient.orig/dhclient.c 2008-07-12 09:40:39.000000000 +0300 +++ sbin/dhclient/dhclient.c 2008-07-12 09:53:46.000000000 +0300 @@ -312,13 +312,14 @@ int ch, fd, quiet = 0, i = 0; int pipe_fd[2]; int immediate_daemon = 0; + int link_timeout = 10; struct passwd *pw; /* Initially, log errors to stderr as well as to syslogd. */ openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY); setlogmask(LOG_UPTO(LOG_DEBUG)); - while ((ch = getopt(argc, argv, "bc:dl:qu")) != -1) + while ((ch = getopt(argc, argv, "bc:dl:t:qu")) != -1) switch (ch) { case 'b': immediate_daemon = 1; @@ -335,6 +336,13 @@ case 'q': quiet = 1; break; + case 't': + link_timeout = (int)strtol(optarg, (char **)NULL, 10); + if (link_timeout < 0) + link_timeout = 0; + if (link_timeout > 10) + link_timeout = 10; + break; case 'u': unknown_ok = 0; break; @@ -378,7 +386,7 @@ while (!interface_link_status(ifi->name)) { fprintf(stderr, "."); fflush(stderr); - if (++i > 10) { + if (++i > link_timeout) { fprintf(stderr, " giving up\n"); exit(1); } @@ -455,7 +463,8 @@ extern char *__progname; fprintf(stderr, "usage: %s [-bdqu] ", __progname); - fprintf(stderr, "[-c conffile] [-l leasefile] interface\n"); + fprintf(stderr, "[-t link timeout] [-c conffile] "); + fprintf(stderr, "[-l leasefile] interface\n"); exit(1); }