net: Add option CONFIG_BOOTP_MAY_FAIL
authorJoe Hershberger <joe.hershberger@ni.com>
Wed, 23 May 2012 07:59:19 +0000 (07:59 +0000)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 23 May 2012 22:53:05 +0000 (17:53 -0500)
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@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
README
net/bootp.c

diff --git a/README b/README
index 6919392dca82c142ea00d9281393ddcde33ae981..6e313ad935474723f460e8d5ddeeaf426e8bd9b0 100644 (file)
--- a/README
+++ b/README
@@ -1592,10 +1592,17 @@ The following options need to be configured:
                CONFIG_BOOTP_NTPSERVER
                CONFIG_BOOTP_TIMEOFFSET
                CONFIG_BOOTP_VENDOREX
+               CONFIG_BOOTP_MAY_FAIL
 
                CONFIG_BOOTP_SERVERIP - TFTP server will be the serverip
                environment variable, not the BOOTP server.
 
+               CONFIG_BOOTP_MAY_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.
index 7e24b661de40d231274adfc611c2166614f79390..0f0867b1c492dd65bbae9575c55636179f85aae5 100644 (file)
@@ -326,8 +326,13 @@ static void
 BootpTimeout(void)
 {
        if (BootpTry >= TIMEOUT_COUNT) {
+#ifdef CONFIG_BOOTP_MAY_FAIL
+               puts("\nRetry count exceeded\n");
+               NetSetState(NETLOOP_FAIL);
+#else
                puts("\nRetry count exceeded; starting again\n");
                NetStartAgain();
+#endif
        } else {
                NetSetTimeout(TIMEOUT, BootpTimeout);
                BootpRequest();