From: Roy Marples Date: Thu, 18 Dec 2008 10:23:40 +0000 (+0000) Subject: Add the DHS_PROBE state so that we ignore subsequent offers X-Git-Tag: v5.0.0~145 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e06ab4a536e79752d8b6fa02910ccea4da0c8cd;p=thirdparty%2Fdhcpcd.git Add the DHS_PROBE state so that we ignore subsequent offers whilst probing. --- diff --git a/arp.c b/arp.c index 412bf9c0..bc1d8b14 100644 --- a/arp.c +++ b/arp.c @@ -248,7 +248,7 @@ send_arp_probe(void *arg) IN_LINKLOCAL(htonl(addr.s_addr))) add_timeout_tv(&tv, bind_interface, iface); else - add_timeout_tv(&tv, send_request, iface); + add_timeout_tv(&tv, start_request, iface); } syslog(LOG_DEBUG, "%s: sending ARP probe (%d of %d), next in %0.2f seconds", diff --git a/dhcpcd.c b/dhcpcd.c index 92a92ba9..e691eb2c 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -502,14 +502,14 @@ handle_dhcp(struct interface *iface, struct dhcp_message **dhcpp) state->claims = 0; state->probes = 0; state->conflicts = 0; + state->state = DHS_PROBE; send_arp_probe(iface); return; } } /* We don't request BOOTP addresses */ if (type) { - state->state = DHS_REQUEST; - send_request(iface); + start_request(iface); return; } } @@ -697,6 +697,14 @@ start_discover(void *arg) send_discover(iface); } +void +start_request(void *arg) +{ + struct interface *iface = arg; + + iface->state->state = DHS_REQUEST; + send_request(iface); +} void start_renew(void *arg) @@ -766,6 +774,7 @@ start_reboot(struct interface *iface) } else if (ifo->options & DHCPCD_INFORM) send_inform(iface); else + /* We don't start_request as that would change state */ send_request(iface); } diff --git a/dhcpcd.h b/dhcpcd.h index f625707e..a70f909e 100644 --- a/dhcpcd.h +++ b/dhcpcd.h @@ -47,7 +47,8 @@ enum DHS { DHS_REBIND, DHS_REBOOT, DHS_RENEW_REQUESTED, - DHS_INIT_IPV4LL + DHS_INIT_IPV4LL, + DHS_PROBE }; #define LINK_UP 1 @@ -115,6 +116,7 @@ void handle_exit_timeout(void *); void send_request(void *); void start_interface(void *); void start_discover(void *); +void start_request(void *); void start_renew(void *); void start_rebind(void *); void start_reboot(struct interface *);