From: Antonio Huete Jimenez Date: Thu, 2 Aug 2012 19:26:34 +0000 (+0200) Subject: dhclient - Fix interval handling. X-Git-Url: http://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/commitdiff_plain/944f2750ae825c10850f93544e3a579befb13ff3 dhclient - 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. Taken-from: OpenBSD --- diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script index ea1026e..d97a1e8 100644 --- a/sbin/dhclient/dhclient-script +++ b/sbin/dhclient/dhclient-script @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: src/sbin/dhclient/dhclient-script,v 1.13 2009/01/24 13:59:43 krw Exp $ +# $OpenBSD: src/sbin/dhclient/dhclient-script,v 1.18 2011/03/27 12:15:46 krw Exp $ # # Copyright (c) 2003 Kenneth R Westerback # @@ -146,7 +146,13 @@ PREINIT) 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 79baeec..09ee1ff 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: src/sbin/dhclient/dhclient.c,v 1.137 2010/10/15 09:51:15 jsg Exp $ */ +/* $OpenBSD: src/sbin/dhclient/dhclient.c,v 1.138 2011/03/27 12:15:46 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -479,7 +479,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; @@ -502,7 +502,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. */ @@ -583,7 +583,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); @@ -724,7 +724,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. */ @@ -829,7 +829,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);