Revert the addition of -p. It's flawed in that dhclient should not run

on an interface without carrier.  devd should be used instead to handle
link up/down events.

Put on the right path by:	brooks, sam
This commit is contained in:
Brian Somers 2006-08-21 16:31:31 +00:00
parent 9a1d419396
commit 3dd3357a13
2 changed files with 7 additions and 25 deletions

View File

@ -38,7 +38,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd August 17, 2006
.Dd July 22, 2005
.Dt DHCLIENT 8
.Os
.Sh NAME
@ -46,7 +46,7 @@
.Nd "Dynamic Host Configuration Protocol (DHCP) client"
.Sh SYNOPSIS
.Nm
.Op Fl bdpqu
.Op Fl bdqu
.Op Fl c Ar file
.Op Fl l Ar file
.Ar interface
@ -83,14 +83,6 @@ will revert to running in the background.
Specify an alternate location,
.Ar file ,
for the leases file.
.It Fl p
Tells
.Nm
to persist in trying to configure the interface, despite
an inability to gain carrier.
This is used to survive switch outages and when
.Nm
is required as soon as the cable is connected.
.It Fl q
Forces
.Nm

View File

@ -295,14 +295,13 @@ 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:pqu")) != -1)
while ((ch = getopt(argc, argv, "bc:dl:qu")) != -1)
switch (ch) {
case 'b':
immediate_daemon = 1;
@ -316,9 +315,6 @@ main(int argc, char *argv[])
case 'l':
path_dhclient_db = optarg;
break;
case 'p':
persist = 1;
break;
case 'q':
quiet = 1;
break;
@ -366,18 +362,12 @@ main(int argc, char *argv[])
fprintf(stderr, ".");
fflush(stderr);
if (++i > 10) {
if (persist) {
fprintf(stderr, " giving up for now\n");
break;
} else {
fprintf(stderr, " giving up\n");
exit(1);
}
fprintf(stderr, " giving up\n");
exit(1);
}
sleep(1);
}
if (i <= 10)
fprintf(stderr, " got link\n");
fprintf(stderr, " got link\n");
}
if ((nullfd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1)
@ -447,7 +437,7 @@ usage(void)
{
extern char *__progname;
fprintf(stderr, "usage: %s [-bdpqu] ", __progname);
fprintf(stderr, "usage: %s [-bdqu] ", __progname);
fprintf(stderr, "[-c conffile] [-l leasefile] interface\n");
exit(1);
}