]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: dhcp: Allow "MAY_FAIL" to still try each adapter
authorJoe Hershberger <joe.hershberger@ni.com>
Wed, 8 Nov 2017 02:13:40 +0000 (18:13 -0800)
committerJoe Hershberger <joe.hershberger@ni.com>
Mon, 15 Jan 2018 18:05:23 +0000 (12:05 -0600)
This change allows the "MAY_FAIL" DHCP option to still attempt to
contact a DHCP server on each adapter and only give up once each
adapter has failed once.  To get the existing behavior, set the
already-existing ethrotate=no variable.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Keng Soon Cheah <keng.soon.cheah@ni.com>
Cc: Chen Yee Chew <chen.yee.chew@ni.com>
net/bootp.c

index 59bb2099f10551ce474efce3d863e010742057ba..efa959971c279fe4e74d04ec0007d0cb1ef52e34 100644 (file)
@@ -386,12 +386,19 @@ static void bootp_timeout_handler(void)
 
        if (time_taken >= time_taken_max) {
 #ifdef CONFIG_BOOTP_MAY_FAIL
-               puts("\nRetry time exceeded\n");
-               net_set_state(NETLOOP_FAIL);
-#else
-               puts("\nRetry time exceeded; starting again\n");
-               net_start_again();
+               char *ethrotate;
+
+               ethrotate = env_get("ethrotate");
+               if ((ethrotate && strcmp(ethrotate, "no") == 0) ||
+                   net_restart_wrap) {
+                       puts("\nRetry time exceeded\n");
+                       net_set_state(NETLOOP_FAIL);
+               } else
 #endif
+               {
+                       puts("\nRetry time exceeded; starting again\n");
+                       net_start_again();
+               }
        } else {
                bootp_timeout *= 2;
                if (bootp_timeout > 2000)