summaryrefslogtreecommitdiffstats
path: root/arp.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-08-20 16:33:09 +0000
committerRoy Marples <roy@marples.name>2007-08-20 16:33:09 +0000
commit0b48939e2aa7eb125ffc6e97f33735b6b13de298 (patch)
treee76c79963e8063aa68a85e905764448704b5ff4a /arp.c
parent184826065166942d397b9f5f526d232688133b70 (diff)
downloaddhcpcd-0b48939e2aa7eb125ffc6e97f33735b6b13de298.tar.xz
Rework the arp code again so that we don't link to librt on Linux.
Diffstat (limited to 'arp.c')
-rw-r--r--arp.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/arp.c b/arp.c
index ce2ba417..56c04e15 100644
--- a/arp.c
+++ b/arp.c
@@ -103,8 +103,11 @@ int arp_claim (interface_t *iface, struct in_addr address)
int nprobes = 0;
int nclaims = 0;
struct in_addr null_address;
+
+#ifdef HAVE_GET_TIME
struct timeval stopat;
struct timeval now;
+#endif
if (! iface)
return (-1);
@@ -167,21 +170,32 @@ int arp_claim (interface_t *iface, struct in_addr address)
break;
}
+
+#ifdef HAVE_GET_TIME
/* Setup our stop time */
if (get_time (&stopat) != 0)
break;
stopat.tv_usec += timeout;
+#endif
continue;
}
- /* We maybe ARP flooded, so check our time */
+ /* Check for ARP floods */
+#ifdef __linux__
+ /* Linux does modify the tv struct, otherwise we would have to link
+ * into librt to use get get_time function */
+ timeout = tv.tv_usec;
+ if (timeout <= 0)
+ continue;
+#else
if (get_time (&now) != 0)
break;
if (timercmp (&now, &stopat, >)) {
timeout = 0;
continue;
}
+#endif
if (! FD_ISSET (iface->fd, &rset))
continue;