]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix crash at end of arping list
authorRoy Marples <roy@marples.name>
Wed, 15 Apr 2009 09:01:02 +0000 (09:01 +0000)
committerRoy Marples <roy@marples.name>
Wed, 15 Apr 2009 09:01:02 +0000 (09:01 +0000)
arp.c

diff --git a/arp.c b/arp.c
index 4a22eeaefebc8388b8b78b1a0276b470a49bed11..bf4d30996b42edfa73cdb7006e7f0e0f0698882f 100644 (file)
--- a/arp.c
+++ b/arp.c
@@ -243,9 +243,8 @@ send_arp_probe(void *arg)
        struct timeval tv;
        int arping = 0;
 
-       if (state->probes == 0 &&
-           state->arping_index < state->options->arping_len) {
-               addr.s_addr = state->options->arping[state->arping_index++];
+       if (state->arping_index < state->options->arping_len) {
+               addr.s_addr = state->options->arping[state->arping_index];
                arping = 1;
        } else if (state->offer) {
                if (state->offer->yiaddr)
@@ -277,7 +276,7 @@ send_arp_probe(void *arg)
                tv.tv_usec = 0;
                if (arping) {
                        state->probes = 0;
-                       if (state->arping_index < state->options->arping_len)
+                       if (++state->arping_index < state->options->arping_len)
                                add_timeout_tv(&tv, send_arp_probe, iface);
                        else
                                add_timeout_tv(&tv, start_interface, iface);
@@ -286,7 +285,8 @@ send_arp_probe(void *arg)
        }
        syslog(LOG_DEBUG,
            "%s: sending ARP probe (%d of %d), next in %0.2f seconds",
-           iface->name, state->probes, PROBE_NUM,  timeval_to_double(&tv));
+           iface->name, state->probes ? state->probes : PROBE_NUM, PROBE_NUM,
+           timeval_to_double(&tv));
        if (send_arp(iface, ARPOP_REQUEST, 0, addr.s_addr) == -1)
                syslog(LOG_ERR, "send_arp: %m");
 }