aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/udhcp/dhcpc.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index d51d8b82f..e79feb7fe 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -64,14 +64,8 @@ static smallint state;
64 64
65 65
66/* Create a random xid */ 66/* Create a random xid */
67static uint32_t random_xid(void) 67static ALWAYS_INLINE uint32_t random_xid(void)
68{ 68{
69 static smallint initialized;
70
71 if (!initialized) {
72 srand(monotonic_us());
73 initialized = 1;
74 }
75 return rand(); 69 return rand();
76} 70}
77 71
@@ -643,15 +637,14 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
643 bb_sanitize_stdio(); 637 bb_sanitize_stdio();
644 /* Equivalent of doing a fflush after every \n */ 638 /* Equivalent of doing a fflush after every \n */
645 setlinebuf(stdout); 639 setlinebuf(stdout);
646
647 /* Create pidfile */ 640 /* Create pidfile */
648 write_pidfile(client_config.pidfile); 641 write_pidfile(client_config.pidfile);
649
650 /* Goes to stdout (unless NOMMU) and possibly syslog */ 642 /* Goes to stdout (unless NOMMU) and possibly syslog */
651 bb_info_msg("%s (v"BB_VER") started", applet_name); 643 bb_info_msg("%s (v"BB_VER") started", applet_name);
652
653 /* Set up the signal pipe */ 644 /* Set up the signal pipe */
654 udhcp_sp_setup(); 645 udhcp_sp_setup();
646 /* We want random_xid to be random... */
647 srand(monotonic_us());
655 648
656 state = INIT_SELECTING; 649 state = INIT_SELECTING;
657 udhcp_run_script(NULL, "deconfig"); 650 udhcp_run_script(NULL, "deconfig");
@@ -681,7 +674,8 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv)
681 674
682 tv.tv_sec = timeout - already_waited_sec; 675 tv.tv_sec = timeout - already_waited_sec;
683 tv.tv_usec = 0; 676 tv.tv_usec = 0;
684 retval = 0; /* If we already timed out, fall through, else... */ 677 retval = 0;
678 /* If we already timed out, fall through with retval = 0, else... */
685 if ((int)tv.tv_sec > 0) { 679 if ((int)tv.tv_sec > 0) {
686 timestamp_before_wait = (unsigned)monotonic_sec(); 680 timestamp_before_wait = (unsigned)monotonic_sec();
687 log1("Waiting on select..."); 681 log1("Waiting on select...");