dhcp/dhcp-4.2.0-initialization-delay.patch

46 lines
1.5 KiB
Diff
Raw Normal View History

2010-07-21 16:56:35 +00:00
diff -up dhcp-4.2.0/client/dhclient.c.initialization-delay dhcp-4.2.0/client/dhclient.c
--- dhcp-4.2.0/client/dhclient.c.initialization-delay 2010-07-21 16:16:51.000000000 +0200
+++ dhcp-4.2.0/client/dhclient.c 2010-07-21 16:22:18.000000000 +0200
@@ -949,11 +949,16 @@ main(int argc, char **argv) {
do_release(client);
else {
client->state = S_INIT;
- /* Set up a timeout to start the
- * initialization process.
+ /* Set up a timeout (0-1 second) to
+ * start the initialization process.
*/
- tv.tv_sec = cur_time + random() % 5;
- tv.tv_usec = 0;
+ tv.tv_sec = cur_tv.tv_sec;
+ tv.tv_usec = cur_tv.tv_usec;
+ tv.tv_usec += (random() % 100) * 10000;
+ if (tv.tv_usec >= 1000000) {
+ tv.tv_sec += 1;
+ tv.tv_usec -= 1000000;
+ }
add_timeout(&tv, state_reboot,
client, 0, 0);
}
2010-07-21 16:56:35 +00:00
@@ -3930,10 +3935,16 @@ isc_result_t dhclient_interface_startup_
ip -> flags |= INTERFACE_RUNNING;
for (client = ip -> client; client; client = client -> next) {
client -> state = S_INIT;
- /* Set up a timeout to start the initialization
- process. */
- tv . tv_sec = cur_time + random () % 5;
- tv . tv_usec = 0;
+ /* Set up a timeout (0-1 second) to
+ * start the initialization process.
+ */
+ tv.tv_sec = cur_tv.tv_sec;
+ tv.tv_usec = cur_tv.tv_usec;
+ tv.tv_usec += (random() % 100) * 10000;
+ if (tv.tv_usec >= 1000000) {
+ tv.tv_sec += 1;
+ tv.tv_usec -= 1000000;
+ }
add_timeout (&tv, state_reboot, client, 0, 0);
}
}