From a16ee92ac47929034d50d3da24879671fc774b8b Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 12 Dec 2013 16:25:58 +0000 Subject: [PATCH] Fix NAK backoff when a server NAKs a REQUEST after a DISCOVER. --- dhcp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dhcp.c b/dhcp.c index 4c177969..ae778d7f 100644 --- a/dhcp.c +++ b/dhcp.c @@ -2126,9 +2126,6 @@ dhcp_handledhcp(struct interface *iface, struct dhcp_message **dhcpp, return; } - /* No NAK, so reset the backoff */ - state->nakoff = 0; - if ((type == 0 || type == DHCP_OFFER) && state->state == DHS_DISCOVER) { @@ -2185,6 +2182,12 @@ dhcp_handledhcp(struct interface *iface, struct dhcp_message **dhcpp, ifo->options &= ~DHCPCD_STATIC; } + + /* No NAK, so reset the backoff + * We don't reset on an OFFER message because the server could + * potentially NAK the REQUEST. */ + state->nakoff = 0; + /* BOOTP could have already assigned this above, so check we still * have a pointer. */ if (*dhcpp) { -- 2.47.3