summaryrefslogtreecommitdiff
path: root/sbin/dhclient
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
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')
-rw-r--r--sbin/dhclient/dhclient-script10
-rw-r--r--sbin/dhclient/dhclient.c12
2 files changed, 14 insertions, 8 deletions
diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script
index 06001d3f835..289320b4f03 100644
--- a/sbin/dhclient/dhclient-script
+++ b/sbin/dhclient/dhclient-script
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $OpenBSD: dhclient-script,v 1.17 2010/06/02 09:57:16 phessler Exp $
+# $OpenBSD: dhclient-script,v 1.18 2011/03/27 12:15:46 krw Exp $
#
# Copyright (c) 2003 Kenneth R Westerback <krw@openbsd.org>
#
@@ -208,7 +208,13 @@ PREINIT6)
ifconfig $interface up
;;
-ARPCHECK|ARPSEND)
+ARPCHECK)
+ # Always succeed. i.e. accept lease.
+ ;;
+
+ARPSEND)
+ # Always fail. i.e. don't wait for ARP packet here.
+ exit 1
;;
BOUND|RENEW|REBIND|REBOOT)
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);