]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add the DHS_PROBE state so that we ignore subsequent offers
authorRoy Marples <roy@marples.name>
Thu, 18 Dec 2008 10:23:40 +0000 (10:23 +0000)
committerRoy Marples <roy@marples.name>
Thu, 18 Dec 2008 10:23:40 +0000 (10:23 +0000)
whilst probing.

arp.c
dhcpcd.c
dhcpcd.h

diff --git a/arp.c b/arp.c
index 412bf9c0f1086829ad09823a4a9081396723e24f..bc1d8b1451502fca43cb6823e0ddc5dd379b3047 100644 (file)
--- 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",
index 92a92ba904412fe0786fc2b9c90f8d59190e8625..e691eb2c4cd30c1a7a3ac287f47ec8683f942b41 100644 (file)
--- 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);
 }
 
index f625707e369c9f1a2d14feab05c7d316f52ad3de..a70f909e25f10af88b602f8433b7f611a7a558b3 100644 (file)
--- 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 *);