diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-10 13:12:49 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-02-10 13:12:49 +0000 |
commit | 10fa0369f249ffe04ff828dec04ee7a463bd8cdb (patch) | |
tree | 9a24823deeaaa74b40cb3f83b342d41a924c5d37 /sbin/dhclient/dhclient.c | |
parent | 067bdac86badf9c64b2581cfe7d696192ab0144d (diff) |
at startup, before sending several DHCPDISCOVER and waiting ages for answers,
check the link state of the interface(s) in question and don't try on
intrfaces that for sure have no link. interfaces with unknown linkstates are
treated as if they had a link, not all drivers are capable of reporting
linkstate upstream, and for some media there is no such thing as a link state.
saves quite sme time when booting notebooks configured for dhcp without
teh cable inserted...
note that this is the not yet active copy of dhclient
ok grange@ mcbride@ pb@ naddy@
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r-- | sbin/dhclient/dhclient.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 4204113267d..4d1ae26a229 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.8 2004/02/07 14:03:48 henning Exp $ */ +/* $OpenBSD: dhclient.c,v 1.9 2004/02/10 13:12:48 henning Exp $ */ /* DHCP Client. */ @@ -223,6 +223,7 @@ main(int argc, char *argv[]) int seed; int quiet = 0; char *s; + int ifs = 0; s = strrchr(argv[0], '/'); if (!s) @@ -343,6 +344,9 @@ main(int argc, char *argv[]) INTERFACE_AUTOMATIC)) != INTERFACE_REQUESTED)) continue; + if (!interface_link_status(ip->name)) + continue; + ifs++; script_init(ip, "PREINIT", NULL); if (ip->client->alias) script_write_params(ip, "alias_", @@ -351,6 +355,11 @@ main(int argc, char *argv[]) } } + if (ifs == 0) { + note("No active interfaces found - exiting."); + exit(0); + } + routefd = socket(PF_ROUTE, SOCK_RAW, 0); if (routefd != -1) add_protocol("AF_ROUTE", routefd, routehandler, interfaces); |