summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-07-04 00:06:25 +0000
committerRoy Marples <roy@marples.name>2009-07-04 00:06:25 +0000
commitd81486816806ccd79780b5c25a1ff0f9849fcdb4 (patch)
tree8d066a624163fbcd2759a3b98058b1fa3efc15f6
parent264b8c30c28a6ec6dc5d12966154611fe0e27fc1 (diff)
downloaddhcpcd-d81486816806ccd79780b5c25a1ff0f9849fcdb4.tar.xz
When we get an ACK we should close DHCP sockets so we don't handle any NAKs
during ARP testing. This is important as some broken DHCP servers NAK immediately after an ACK in some situations.
-rw-r--r--dhcpcd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index daf4e0ba..31d06344 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -497,7 +497,8 @@ handle_dhcp(struct interface *iface, struct dhcp_message **dhcpp)
lease->addr.s_addr = dhcp->yiaddr;
lease->server.s_addr = INADDR_ANY;
if (type != 0)
- get_option_addr(&lease->server.s_addr, dhcp, DHO_SERVERID);
+ get_option_addr(&lease->server.s_addr,
+ dhcp, DHO_SERVERID);
log_dhcp(LOG_INFO, "offered", iface, dhcp);
free(state->offer);
state->offer = dhcp;
@@ -551,6 +552,11 @@ handle_dhcp(struct interface *iface, struct dhcp_message **dhcpp)
lease->frominfo = 0;
delete_timeout(NULL, iface);
+ /* We now have an offer, so close the DHCP sockets.
+ * This allows us to safely ARP when broken DHCP servers send an ACK
+ * follows by an invalid NAK. */
+ close_sockets(iface);
+
if (ifo->options & DHCPCD_ARP &&
iface->addr.s_addr != state->offer->yiaddr)
{