Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Always background DHCP and keep trying on failure

  • Loading branch information...
commit d4cb8bd88e47384249539f595bc8f250c39c7ab4 1 parent 3899dc0
Sébastien Bourdeauducq authored November 27, 2011

Showing 1 changed file with 10 additions and 7 deletions. Show diff stats Hide diff stats

  1. 17  src/sysconfig.c
17  src/sysconfig.c
@@ -162,11 +162,6 @@ static void format_ip(unsigned int ip, char *out)
162 162
 
163 163
 #define SYSCONFIG_FILE "/ssd/sysconfig.bin"
164 164
 
165  
-static void my_dhcp()
166  
-{
167  
-	rtems_bsdnet_do_dhcp_timeout();
168  
-}
169  
-
170 165
 static void sysconfig_credentials_lock_init();
171 166
 static void sysconfig_credentials_lock();
172 167
 static void sysconfig_credentials_unlock();
@@ -181,6 +176,8 @@ int sysconfig_is_rescue()
181 176
 	return strcmp(bsp_cmdline, "rescue") == 0;
182 177
 }
183 178
 
  179
+static void start_dhcp_task();
  180
+
184 181
 void sysconfig_load()
185 182
 {
186 183
 	struct sysconfig conf;
@@ -194,7 +191,7 @@ void sysconfig_load()
194 191
 	}
195 192
 
196 193
 	if(sysconfig.dhcp_enable)
197  
-		rtems_bsdnet_config.bootp = my_dhcp;
  194
+		rtems_bsdnet_config.bootp = start_dhcp_task;
198 195
 	else {
199 196
 		if(sysconfig.ip) {
200 197
 			format_ip(sysconfig.ip, ip_fmt);
@@ -466,7 +463,13 @@ static int dhcp_task_running;
466 463
 
467 464
 static rtems_task dhcp_task(rtems_task_argument argument)
468 465
 {
469  
-	rtems_bsdnet_do_dhcp_timeout();
  466
+	int r;
  467
+	
  468
+	while(sysconfig.dhcp_enable) {
  469
+		r = rtems_bsdnet_do_dhcp_timeout();
  470
+		if(r >= 0)
  471
+			break; /* success */
  472
+	}
470 473
 	dhcp_task_running = 0;
471 474
 	rtems_task_delete(RTEMS_SELF);
472 475
 }

0 notes on commit d4cb8bd

Please sign in to comment.
Something went wrong with that request. Please try again.