summaryrefslogtreecommitdiff
path: root/sbin/dhcpleased/engine.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2021-03-07 16:22:02 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2021-03-07 16:22:02 +0000
commitf26e423a09e8d671315137ab5ff5f5fba63605f8 (patch)
tree74307c008bfe2c55a55dde2cf8aa48c799bf6fe8 /sbin/dhcpleased/engine.c
parent7883da65940d47223b852eb51a5344d8b9e86d5d (diff)
No need to cap the exponential backoff here, iface_timeout() already
handles this for us by doing a state transition if we have been stuck in "rebooting" or "requesting" for too long. Makes the code a bit simpler and we only have one place were we need to special case the timeout cap.
Diffstat (limited to 'sbin/dhcpleased/engine.c')
-rw-r--r--sbin/dhcpleased/engine.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sbin/dhcpleased/engine.c b/sbin/dhcpleased/engine.c
index b0e639ea264..91063b386f9 100644
--- a/sbin/dhcpleased/engine.c
+++ b/sbin/dhcpleased/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.7 2021/03/06 18:33:44 florian Exp $ */
+/* $OpenBSD: engine.c,v 1.8 2021/03/07 16:22:01 florian Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -1096,10 +1096,9 @@ state_transition(struct dhcpleased_iface *iface, enum if_state new_state)
request_dhcp_discover(iface);
break;
case IF_REBOOTING:
- if (old_state == IF_REBOOTING) {
- if (iface->timo.tv_sec < MAX_EXP_BACKOFF_FAST)
- iface->timo.tv_sec *= 2;
- } else {
+ if (old_state == IF_REBOOTING)
+ iface->timo.tv_sec *= 2;
+ else {
/* make sure we send broadcast */
iface->dhcp_server.s_addr = INADDR_ANY;
iface->timo.tv_sec = START_EXP_BACKOFF;
@@ -1107,10 +1106,9 @@ state_transition(struct dhcpleased_iface *iface, enum if_state new_state)
request_dhcp_request(iface);
break;
case IF_REQUESTING:
- if (old_state == IF_REQUESTING) {
- if (iface->timo.tv_sec < MAX_EXP_BACKOFF_FAST)
- iface->timo.tv_sec *= 2;
- } else
+ if (old_state == IF_REQUESTING)
+ iface->timo.tv_sec *= 2;
+ else
iface->timo.tv_sec = START_EXP_BACKOFF;
request_dhcp_request(iface);
break;