summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dhclient.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2011-03-27 12:15:47 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2011-03-27 12:15:47 +0000
commitc3b3601912ea07002a7133a3923a3817e00b8c9b (patch)
tree01ab6e24cd7e67cf24ad73bd9b7d8cdf4d3aa9bc /sbin/dhclient/dhclient.c
parentbc17337032bb9625fc4f9a962e9b82022761dcc4 (diff)
Fix interval handling. Start at initial_interval instead of
exponentially backed off initial_interval. Don't hallucinate that we can send ARP packets without waiting. Don't claim to be waiting for ARP packets when not doing so. Correctly detect expiry of selecting period. Speeds up negotiations. Tested on various dhcp servers by Martin Pelika, ian@, and David Coppa. And works at Starbucks and a mall for me.
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r--sbin/dhclient/dhclient.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index b2abea4e9f3..f900ef5baf4 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.137 2010/10/15 09:51:15 jsg Exp $ */
+/* $OpenBSD: dhclient.c,v 1.138 2011/03/27 12:15:46 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -495,7 +495,7 @@ state_reboot(void)
make_request(client->active);
client->destination = iaddr_broadcast;
client->first_sending = cur_time;
- client->interval = config->initial_interval;
+ client->interval = 0;
/* Zap the medium list... */
client->medium = NULL;
@@ -518,7 +518,7 @@ state_init(void)
client->destination = iaddr_broadcast;
client->state = S_SELECTING;
client->first_sending = cur_time;
- client->interval = config->initial_interval;
+ client->interval = 0;
/* Add an immediate timeout to cause the first DHCPDISCOVER packet
to go out. */
@@ -599,7 +599,7 @@ freeit:
client->destination = iaddr_broadcast;
client->state = S_REQUESTING;
client->first_sending = cur_time;
- client->interval = config->initial_interval;
+ client->interval = 0;
/* Make a DHCPREQUEST packet from the lease we picked. */
make_request(picked);
@@ -738,7 +738,7 @@ state_bound(void)
client->destination = iaddr_broadcast;
client->first_sending = cur_time;
- client->interval = config->initial_interval;
+ client->interval = 0;
client->state = S_RENEWING;
/* Send the first packet immediately. */
@@ -841,7 +841,7 @@ dhcpoffer(struct iaddr client_addr, struct option_data *options)
/* If the selecting interval has expired, go immediately to
state_selecting(). Otherwise, time out into
state_selecting at the select interval. */
- if (stop_selecting <= 0)
+ if (stop_selecting <= cur_time)
state_selecting();
else {
add_timeout(stop_selecting, state_selecting);