diff options
author | brian <brian@FreeBSD.org> | 2006-08-17 17:12:27 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2006-08-17 17:12:27 +0000 |
commit | a3922ffaf600bcd06d7363d5e87ff9289859ce65 (patch) | |
tree | f87350c5fc4681fa51e1fc97c0a3407d6bd3efc2 /sbin/dhclient | |
parent | 8dcb0483a6e8eff67cf2fb1309ec730ae1f05773 (diff) | |
download | FreeBSD-src-a3922ffaf600bcd06d7363d5e87ff9289859ce65.zip FreeBSD-src-a3922ffaf600bcd06d7363d5e87ff9289859ce65.tar.gz |
Add a -p switch to dhclient. The switch tells dhclient to persist
despite the interface link status.
Add dhclient_flags_iface and background_dhclient_iface rc.conf options.
(where iface is a specific interface). These can be used to give
interface specific flags to dhclient.
Reviewed by: brooks@
Diffstat (limited to 'sbin/dhclient')
-rw-r--r-- | sbin/dhclient/dhclient.8 | 7 | ||||
-rw-r--r-- | sbin/dhclient/dhclient.c | 18 |
2 files changed, 20 insertions, 5 deletions
diff --git a/sbin/dhclient/dhclient.8 b/sbin/dhclient/dhclient.8 index 281159f..bbe922f 100644 --- a/sbin/dhclient/dhclient.8 +++ b/sbin/dhclient/dhclient.8 @@ -46,7 +46,7 @@ .Nd "Dynamic Host Configuration Protocol (DHCP) client" .Sh SYNOPSIS .Nm -.Op Fl bdqu +.Op Fl bdpqu .Op Fl c Ar file .Op Fl l Ar file .Ar interface @@ -83,6 +83,11 @@ will revert to running in the background. Specify an alternate location, .Ar file , for the leases file. +.It Fl p +Tells dhclient to persist in trying to configure the interface, despite +an inability to gain carrier. +This is used to survive switch outages and when dhclient is required as +soon as the cable is connected. .It Fl q Forces .Nm diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index ce40562..22e69ba 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -295,13 +295,14 @@ main(int argc, char *argv[]) int ch, fd, quiet = 0, i = 0; int pipe_fd[2]; int immediate_daemon = 0; + int persist = 0; 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_INFO)); - while ((ch = getopt(argc, argv, "bc:dl:qu")) != -1) + while ((ch = getopt(argc, argv, "bc:dl:pqu")) != -1) switch (ch) { case 'b': immediate_daemon = 1; @@ -315,6 +316,9 @@ main(int argc, char *argv[]) case 'l': path_dhclient_db = optarg; break; + case 'p': + persist = 1; + break; case 'q': quiet = 1; break; @@ -362,12 +366,18 @@ main(int argc, char *argv[]) fprintf(stderr, "."); fflush(stderr); if (++i > 10) { - fprintf(stderr, " giving up\n"); - exit(1); + if (persist) { + fprintf(stderr, " giving up for now\n"); + break; + } else { + fprintf(stderr, " giving up\n"); + exit(1); + } } sleep(1); } - fprintf(stderr, " got link\n"); + if (i <= 10) + fprintf(stderr, " got link\n"); } if ((nullfd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1) |