udhcpc: tweak help text
[oweals/busybox.git] / networking / udhcp / arpping.c
index cf18153f73660eb0724756ebb49072b6d4a9823e..b43e52e964e0b48c3031b41e9c820b9da2d21969 100644 (file)
@@ -1,11 +1,9 @@
 /* vi: set sw=4 ts=4: */
 /*
- * arpping.c
- *
  * Mostly stolen from: dhcpcd - DHCP client daemon
  * by Yoichi Hariguchi <yoichi@fore.com>
  *
- * Licensed under GPLv2, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2, see file LICENSE in this source tree.
  */
 #include <netinet/if_ether.h>
 #include <net/if_arp.h>
@@ -120,8 +118,13 @@ int FAST_FUNC arpping(uint32_t test_nip,
                                break;
                        }
                }
-               timeout_ms -= (unsigned)monotonic_ms() - prevTime;
-       } while (timeout_ms > 0);
+               timeout_ms -= (unsigned)monotonic_ms() - prevTime + 1;
+
+               /* We used to check "timeout_ms > 0", but
+                * this is more under/overflow-resistant
+                * (people did see overflows here when system time jumps):
+                */
+       } while ((unsigned)timeout_ms <= 2000);
 
  ret:
        close(s);