summaryrefslogtreecommitdiffstats
path: root/arp.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-07-26 09:35:45 +0000
committerRoy Marples <roy@marples.name>2007-07-26 09:35:45 +0000
commit6d073f75f53e5f1c23248ac12918bed02ae2a1da (patch)
tree16fa2755a4600b0dd9dfc236e2b75aeb7448f3a5 /arp.c
parent68590c550d1ef7bc3574bda65c57b7ddbb2edcfc (diff)
downloaddhcpcd-6d073f75f53e5f1c23248ac12918bed02ae2a1da.tar.xz
Fix arp segfaulting and final 3.1.1
Diffstat (limited to 'arp.c')
-rw-r--r--arp.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/arp.c b/arp.c
index c770e268..ee2df40e 100644
--- a/arp.c
+++ b/arp.c
@@ -196,9 +196,19 @@ int arp_claim (interface_t *iface, struct in_addr address)
rp.c = (unsigned char *) ar_spa (reply);
rh.c = (unsigned char *) ar_sha (reply);
+
+ /* Ensure the ARP reply is for the address we asked for */
+ if (rp.a->s_addr != address.s_addr)
+ continue;
+
+ /* Some systems send a reply back from our hwaddress - weird */
+ if (reply->ar_hln == iface->hwlen &&
+ memcmp (rh.c, iface->hwaddr, iface->hwlen) == 0)
+ continue;
+
logger (LOG_ERR, "ARPOP_REPLY received from %s (%s)",
inet_ntoa (*rp.a),
- hwaddr_ntoa (rh.a, reply->ar_hln));
+ hwaddr_ntoa (rh.c, reply->ar_hln));
retval = -1;
goto eexit;
}