summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/udhcp/arpping.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index ff63478..b43e52e 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -118,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);