From: Roy Marples Date: Wed, 19 Nov 2008 09:48:11 +0000 (+0000) Subject: If we are asked to ARP and we don't have an offer then we are testing our current... X-Git-Tag: v5.0.0~179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55a303e7bfcdf254a02000ab049c0d64cad41cfc;p=thirdparty%2Fdhcpcd.git If we are asked to ARP and we don't have an offer then we are testing our current address. --- diff --git a/arp.c b/arp.c index 43ce95c1..ba227075 100644 --- a/arp.c +++ b/arp.c @@ -217,12 +217,16 @@ send_arp_probe(void *arg) struct in_addr addr; struct timeval tv; + if (state->offer) + addr.s_addr = state->offer->yiaddr; + else + addr.s_addr = iface->addr.s_addr; + if (iface->arp_fd == -1) { open_socket(iface, ETHERTYPE_ARP); add_event(iface->arp_fd, handle_arp_packet, iface); } if (state->probes == 0) { - addr.s_addr = state->offer->yiaddr; syslog(LOG_INFO, "%s: checking %s is available" " on attached networks", iface->name, inet_ntoa(addr)); @@ -235,7 +239,7 @@ send_arp_probe(void *arg) } else { tv.tv_sec = ANNOUNCE_WAIT; tv.tv_usec = 0; - if (IN_LINKLOCAL(htonl(state->offer->yiaddr))) + if (IN_LINKLOCAL(htonl(addr.s_addr))) add_timeout_tv(&tv, bind_interface, iface); else add_timeout_tv(&tv, send_request, iface); @@ -243,6 +247,6 @@ 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)); - if (send_arp(iface, ARPOP_REQUEST, 0, state->offer->yiaddr) == -1) + if (send_arp(iface, ARPOP_REQUEST, 0, addr.s_addr) == -1) syslog(LOG_ERR, "send_arp: %m"); }