mirror of
https://github.com/sheumann/hush.git
synced 2024-10-27 23:26:30 +00:00
udhcp: make arpping code resistant to time jumps
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
53772869bc
commit
6500d123d0
@ -118,8 +118,13 @@ int FAST_FUNC arpping(uint32_t test_nip,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timeout_ms -= (unsigned)monotonic_ms() - prevTime;
|
timeout_ms -= (unsigned)monotonic_ms() - prevTime + 1;
|
||||||
} while (timeout_ms > 0);
|
|
||||||
|
/* 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:
|
ret:
|
||||||
close(s);
|
close(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user