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/dhclient.c | |
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/dhclient.c')
-rw-r--r-- | sbin/dhclient/dhclient.c | 18 |
1 files changed, 14 insertions, 4 deletions
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) |