Do not enter a tight INIT -> REQUESTING -> INIT loop when the dhcp
authorflorian <florian@openbsd.org>
Wed, 4 Aug 2021 05:56:58 +0000 (05:56 +0000)
committerflorian <florian@openbsd.org>
Wed, 4 Aug 2021 05:56:58 +0000 (05:56 +0000)
server responds to our DHCPDISCOVER but is then slow to respond to our
DHCPREQUEST.
MAX_EXP_BACKOFF_FAST was introduced to get us quickly out of the
REBOOTING state when we switch networks and no dhcp server would NAK
our old lease but just ignore us. This is not the issue here, there is
a dhcp server willing to talk to us, it's just slow.
Problem reported, tested & OK jca

sbin/dhcpleased/engine.c

index 79ea38c..076a57e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: engine.c,v 1.23 2021/08/01 09:07:03 florian Exp $     */
+/*     $OpenBSD: engine.c,v 1.24 2021/08/04 05:56:58 florian Exp $     */
 
 /*
  * Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -1389,7 +1389,7 @@ iface_timeout(int fd, short events, void *arg)
                        state_transition(iface, IF_REBOOTING);
                break;
        case IF_REQUESTING:
-               if (iface->timo.tv_sec >= MAX_EXP_BACKOFF_FAST)
+               if (iface->timo.tv_sec >= MAX_EXP_BACKOFF_SLOW)
                        state_transition(iface, IF_INIT);
                else
                        state_transition(iface, IF_REQUESTING);