[U-Boot] [PATCH 25/28] net: Add option CONFIG_BOOTP_CAN_FAIL

Joe Hershberger joe.hershberger at ni.com
Fri Jan 20 01:53:28 CET 2012


This is useful if you want to look for a DHCP server, but try some
   other settings if not available

Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
Cc: Joe Hershberger <joe.hershberger at gmail.com>
Cc: Wolfgang Denk <wd at denx.de>
---
 README      |    7 +++++++
 net/bootp.c |    5 +++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/README b/README
index 9d713e8..352db7d 100644
--- a/README
+++ b/README
@@ -1573,10 +1573,17 @@ The following options need to be configured:
 		CONFIG_BOOTP_NTPSERVER
 		CONFIG_BOOTP_TIMEOFFSET
 		CONFIG_BOOTP_VENDOREX
+		CONFIG_BOOTP_CAN_FAIL
 
 		CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip
 		environment variable, not the BOOTP server.
 
+		CONFIG_BOOTP_CAN_FAIL - If the DHCP server is not found
+		after the configured retry count, the call will fail
+		instead of starting over.  This can be used to fail over
+		to Link-local IP address configuration if the DHCP server
+		is not available.
+
 		CONFIG_BOOTP_DNS2 - If a DHCP client requests the DNS
 		serverip from a DHCP server, it is possible that more
 		than one DNS serverip is offered to the client.
diff --git a/net/bootp.c b/net/bootp.c
index 187b3a8..07f9d0e 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -327,8 +327,13 @@ static void
 BootpTimeout(void)
 {
 	if (BootpTry >= TIMEOUT_COUNT) {
+#ifdef CONFIG_BOOTP_CAN_FAIL
+		puts("\nRetry count exceeded\n");
+		NetSetState(NETLOOP_FAIL);
+#else
 		puts("\nRetry count exceeded; starting again\n");
 		NetStartAgain();
+#endif
 	} else {
 		NetSetTimeout(TIMEOUT, BootpTimeout);
 		BootpRequest();
-- 
1.6.0.2



More information about the U-Boot mailing list