summaryrefslogtreecommitdiff
path: root/networking/udhcp/clientpacket.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/clientpacket.c')
-rw-r--r--networking/udhcp/clientpacket.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c
index 69d7f2d..af97962 100644
--- a/networking/udhcp/clientpacket.c
+++ b/networking/udhcp/clientpacket.c
@@ -25,19 +25,13 @@
/* Create a random xid */
-unsigned long random_xid(void)
+unsigned random_xid(void)
{
- static int initialized;
+ static smallint initialized;
+
if (!initialized) {
- unsigned long seed;
-
- if (open_read_close("/dev/urandom", &seed, sizeof(seed)) < 0) {
- bb_info_msg("Cannot load seed "
- "from /dev/urandom: %s", strerror(errno));
- seed = time(0);
- }
- srand(seed);
- initialized++;
+ srand(monotonic_us());
+ initialized = 1;
}
return rand();
}