summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dhclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r--sbin/dhclient/dhclient.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index fcd364d5794..e640643c415 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.86 2006/06/16 16:17:16 reyk Exp $ */
+/* $OpenBSD: dhclient.c,v 1.87 2006/08/29 03:55:08 deraadt Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -243,7 +243,7 @@ die:
int
main(int argc, char *argv[])
{
- int ch, fd, quiet = 0, i = 0, pipe_fd[2];
+ int ch, fd, quiet = 0, i = 0, pipe_fd[2], linkstat;
extern char *__progname;
struct passwd *pw;
@@ -309,10 +309,14 @@ main(int argc, char *argv[])
read_client_conf();
+ linkstat = interface_link_forceup(ifi->name);
+
if (!interface_link_status(ifi->name)) {
fprintf(stderr, "%s: no link ...", ifi->name);
if (ifi->client->config->link_timeout == 0) {
fprintf(stderr, " giving up\n");
+ if (linkstat == 0)
+ interface_link_forcedown(ifi->name);
exit(1);
}
fflush(stderr);
@@ -322,6 +326,8 @@ main(int argc, char *argv[])
fflush(stderr);
if (++i > ifi->client->config->link_timeout) {
fprintf(stderr, " giving up\n");
+ if (linkstat == 0)
+ interface_link_forcedown(ifi->name);
exit(1);
}
sleep(1);