diff options
author | 2014-10-17 13:21:44 +0000 | |
---|---|---|
committer | 2014-10-17 13:21:44 +0000 | |
commit | adf88d1bf162c2b0dbacf99123ef1e2c401dd96f (patch) | |
tree | 83c2fe8f30c3922d8ea8b1789726ceaa58445145 | |
parent | strvis() requires that the buffer is at least 4 * srclen + 1. (diff) | |
download | wireguard-openbsd-adf88d1bf162c2b0dbacf99123ef1e2c401dd96f.tar.xz wireguard-openbsd-adf88d1bf162c2b0dbacf99123ef1e2c401dd96f.zip |
Nuke 'increase' which was always set to 1. Replace the if/else that tested
its value with the body of the if. No functional change.
'increase' was orphaned when r1.139 eliminated support for 'medium'
statements in dhclient.conf.
Stumbled over while looking into a problem for weerd@.
-rw-r--r-- | sbin/dhclient/dhclient.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index ad3fbb5c72e..a9ac1b15666 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.320 2014/10/02 18:04:49 matthew Exp $ */ +/* $OpenBSD: dhclient.c,v 1.321 2014/10/17 13:21:44 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -1166,7 +1166,7 @@ void send_discover(void) { time_t cur_time; - int interval, increase = 1; + int interval; time(&cur_time); @@ -1185,21 +1185,17 @@ send_discover(void) * number between zero and two times itself. On average, this * means that it will double with every transmission. */ - if (increase) { - if (!client->interval) - client->interval = config->initial_interval; - else { - client->interval += (arc4random() >> 2) % - (2 * client->interval); - } - - /* Don't backoff past cutoff. */ - if (client->interval > config->backoff_cutoff) - client->interval = ((config->backoff_cutoff / 2) - + ((arc4random() >> 2) % - config->backoff_cutoff)); - } else if (!client->interval) + if (!client->interval) client->interval = config->initial_interval; + else { + client->interval += (arc4random() >> 2) % + (2 * client->interval); + } + + /* Don't backoff past cutoff. */ + if (client->interval > config->backoff_cutoff) + client->interval = ((config->backoff_cutoff / 2) + + ((arc4random() >> 2) % config->backoff_cutoff)); /* If the backoff would take us to the panic timeout, just use that as the interval. */ |