Date: Fri, 18 Aug 2006 17:53:19 +0400 From: Vladimir Grebenschikov <vova@fbsd.ru> To: Brian Somers <brian@FreeBSD.org> Cc: cvs-src@FreeBSD.org Subject: Re: cvs commit: src/etc/defaults rc.conf src/etc/rc.d dhclient src/sbin/dhclient dhclient.8 dhclient.c src/share/man/man5 rc.conf.5 Message-ID: <1155909199.1802.41.camel@localhost> In-Reply-To: <200608171712.k7HHCRxx069075@repoman.freebsd.org> References: <200608171712.k7HHCRxx069075@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
В чт, 17/08/2006 в 17:12 +0000, Brian Somers пишет:
> Log:
> Add a -p switch to dhclient. The switch tells dhclient to persist
> despite the interface link status.
Can you consider committing one more key to dhclient (patch attached).
-w timeout key to specify link wait timeout for dhclient.
Every boot my machine waits for 10 secs for disconnected interface. I
think it as too long.
Attached patch provide ability to specify timeout for link detection.
-w0 provides ability to just check link status and do not wait et all.
--
Vladimir B. Grebenschikov
vova@fbsd.ru
[-- Attachment #2 --]
Index: sbin/dhclient/dhclient.8
===================================================================
RCS file: /usr/ncvs/src/sbin/dhclient/dhclient.8,v
retrieving revision 1.7
diff -u -r1.7 dhclient.8
--- sbin/dhclient/dhclient.8 17 Aug 2006 20:11:21 -0000 1.7
+++ sbin/dhclient/dhclient.8 18 Aug 2006 13:40:55 -0000
@@ -49,6 +49,7 @@
.Op Fl bdpqu
.Op Fl c Ar file
.Op Fl l Ar file
+.Op Fl w Ar timeout
.Ar interface
.Sh DESCRIPTION
The
@@ -100,6 +101,11 @@
.Nm
to reject leases with unknown options in them.
The default behaviour is to accept such lease offers.
+.It Fl w Ar timeout
+Tells
+.Nm
+to wait timeout seconds for link. Default is to wait for 10 seconds.
+Value 0 means do not wait in case of no link.
.El
.Pp
The DHCP protocol allows a host to contact a central server which
Index: sbin/dhclient/dhclient.c
===================================================================
RCS file: /usr/ncvs/src/sbin/dhclient/dhclient.c,v
retrieving revision 1.18
diff -u -r1.18 dhclient.c
--- sbin/dhclient/dhclient.c 17 Aug 2006 17:27:42 -0000 1.18
+++ sbin/dhclient/dhclient.c 18 Aug 2006 13:36:28 -0000
@@ -296,13 +296,14 @@
int pipe_fd[2];
int immediate_daemon = 0;
int persist = 0;
+ int link_wait_time = 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_INFO));
- while ((ch = getopt(argc, argv, "bc:dl:pqu")) != -1)
+ while ((ch = getopt(argc, argv, "bc:dl:pquw:")) != -1)
switch (ch) {
case 'b':
immediate_daemon = 1;
@@ -325,6 +326,9 @@
case 'u':
unknown_ok = 0;
break;
+ case 'w':
+ link_wait_time = atoi(optarg);
+ break;
default:
usage();
}
@@ -361,11 +365,14 @@
if (!interface_link_status(ifi->name)) {
fprintf(stderr, "%s: no link ...", ifi->name);
fflush(stderr);
- sleep(1);
+ if (link_wait_time) {
+ sleep(1);
+ ++i;
+ }
while (!interface_link_status(ifi->name)) {
fprintf(stderr, ".");
fflush(stderr);
- if (++i > 10) {
+ if (++i > link_wait_time) {
if (persist) {
fprintf(stderr, " giving up for now\n");
break;
@@ -376,7 +383,7 @@
}
sleep(1);
}
- if (i <= 10)
+ if (i <= link_wait_time)
fprintf(stderr, " got link\n");
}
@@ -448,7 +455,7 @@
extern char *__progname;
fprintf(stderr, "usage: %s [-bdpqu] ", __progname);
- fprintf(stderr, "[-c conffile] [-l leasefile] interface\n");
+ fprintf(stderr, "[-c conffile] [-l leasefile] [-w waittime] interface\n");
exit(1);
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1155909199.1802.41.camel>
