[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/dhcp/FC-3 dhcp-3.0.1-fast.patch,NONE,1.1



Author: jvdias

Update of /cvs/dist/rpms/dhcp/FC-3
In directory cvs.devel.redhat.com:/tmp/cvs-serv18454

Added Files:
	dhcp-3.0.1-fast.patch 
Log Message:
remove dhclient 1-5 second delay on startup when only configuring one interface

dhcp-3.0.1-fast.patch:
 dhclient.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

--- NEW FILE dhcp-3.0.1-fast.patch ---
--- dhcp-3.0.1/client/dhclient.c.fast	2005-06-09 17:29:31.000000000 -0400
+++ dhcp-3.0.1/client/dhclient.c	2005-06-09 17:28:51.000000000 -0400
@@ -100,6 +100,7 @@
 	int no_dhclient_db = 0;
 	int no_dhclient_pid = 0;
 	int no_dhclient_script = 0;
+	int n_ips=0;
 	char *s;
 
 	/* Make sure we have stdin, stdout and stderr. */
@@ -467,14 +468,20 @@
 	   time plus the sum of the last four bytes of each
 	   interface's hardware address interpreted as an integer.
 	   Not much entropy, but we're booting, so we're not likely to
-	   find anything better. */
+	   find anything better. 
+
+	   Also count the number of interfaces; if there is only one,
+           there is no point in waiting up to 5 seconds to kick off.
+        */
 	seed = 0;
+	n_ips =0;
 	for (ip = interfaces; ip; ip = ip -> next) {
 		int junk;
 		memcpy (&junk,
 			&ip -> hw_address.hbuf [ip -> hw_address.hlen -
 					       sizeof seed], sizeof seed);
 		seed += junk;
+		++n_ips;
 	}
 	srandom (seed + cur_time);
 
@@ -488,8 +495,15 @@
 				client -> state = S_INIT;
 				/* Set up a timeout to start the initialization
 				   process. */
-				add_timeout (cur_time + random () % 5,
-					     state_reboot, client, 0, 0);
+				if( n_ips > 1 )
+				{
+				    add_timeout (cur_time + random () % 5,
+						 state_reboot, client, 0, 0);
+				}else
+				{
+				    add_timeout (cur_time ,
+						 state_reboot, client, 0, 0);
+				}
 			}
 		}
 	}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]