From: Roy Marples Date: Thu, 26 Jul 2007 09:35:45 +0000 (+0000) Subject: Fix arp segfaulting and final 3.1.1 X-Git-Tag: v3.2.3~227 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d073f75f53e5f1c23248ac12918bed02ae2a1da;p=thirdparty%2Fdhcpcd.git Fix arp segfaulting and final 3.1.1 --- diff --git a/ChangeLog b/ChangeLog index ec94d638..863b64a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -Remove getifaddrs code and instead just use ioctls. +dhcpcd-3.1.1 +Fix segfault in arp code that some users had. +Remove getifaddrs code and instead just use ioctls so we don't break +platforms without getifaddrs as often. dhcpcd-3.1.0 Add new socket code to try and support InfiniBand better. diff --git a/Makefile b/Makefile index 9377c600..9a97fd78 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = 3.1.1_pre1 +VERSION = 3.1.1 CFLAGS ?= -O2 -pipe # Should work for both GNU make and BSD make 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; }