shithub: riscv

Download patch

ref: 9cb700018a46928cedd5591ef6ddc18562492945
parent: ef44366c2af162543b2087bc6551dfd846573437
author: cinap_lenrek <[email protected]>
date: Wed Mar 28 21:11:22 EDT 2012

ipconfig: remove 6 minute redundant dhcp retry timeout

--- a/sys/src/cmd/ip/ipconfig/main.c
+++ b/sys/src/cmd/ip/ipconfig/main.c
@@ -583,7 +583,7 @@
 void
 doadd(int retry)
 {
-	int tries, ppp;
+	int ppp;
 
 	ppp = strcmp(conf.type, "ppp") == 0;
 
@@ -603,12 +603,10 @@
 		if (ip6cfg(ipv6auto) < 0)
 			sysfatal("can't automatically start IPv6 on %s",
 				conf.dev);
-//		return;
 	} else if (validip(conf.laddr) && !isv4(conf.laddr)) {
 		if (ip6cfg(0) < 0)
 			sysfatal("can't start IPv6 on %s, address %I",
 				conf.dev, conf.laddr);
-//		return;
 	}
 
 	if(!validip(conf.laddr) && !ppp)
@@ -620,12 +618,7 @@
 	/* run dhcp if we need something */
 	if(dodhcp){
 		mkclientid();
-		for(tries = 0; tries < 30; tries++){
-			dhcpquery(!noconfig, Sselecting);
-			if(conf.state == Sbound)
-				break;
-			sleep(1000);
-		}
+		dhcpquery(!noconfig, Sselecting);
 	}
 
 	if(!validip(conf.laddr))
@@ -897,7 +890,6 @@
 	}
 	notify(ding);
 
-	/* try dhcp for 10 seconds */
 	conf.xid = lrand();
 	conf.starttime = time(0);
 	conf.state = startstate;
@@ -918,8 +910,6 @@
 	while(conf.state != Sbound){
 		dhcprecv();
 		if(dhcptimer() < 0)
-			break;
-		if(time(0) - conf.starttime > 10)
 			break;
 	}
 	close(conf.fd);