diff options
| author | Roy Marples <roy@marples.name> | 2009-04-15 09:01:02 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-04-15 09:01:02 +0000 |
| commit | 80bf2e3592ac5e38f77fa2f729ac545ff1192d6e (patch) | |
| tree | c31fabd08d3c318c0755cb087f2f17da5ac37207 | |
| parent | 572ccfb7e23b6aec55b820433c75e90127c2a006 (diff) | |
| download | dhcpcd-80bf2e3592ac5e38f77fa2f729ac545ff1192d6e.tar.xz | |
Fix crash at end of arping list
| -rw-r--r-- | arp.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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"); } |
