Blob Blame History Raw
From 65bcce29d5d7ad3831513fe14c76791287847597 Mon Sep 17 00:00:00 2001
From: Nilesh Javali <nilesh.javali@cavium.com>
Date: Fri, 24 Aug 2018 06:38:45 -0400
Subject: [PATCH] iscsiuio: limit retries of performing dhcpv6 before declaring
 dhcp failure

After successful stateless router adv., the restart of handle_ndp thread
infinitely checks dhcpv6 causing IPv6 DHCP sequence failure.
Limit the retries of dhcpv6 validation.

Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
---
 iscsiuio/src/uip/ipv6_ndpc.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/iscsiuio/src/uip/ipv6_ndpc.c b/iscsiuio/src/uip/ipv6_ndpc.c
index a396cb784bd3..bb07c1dd64ff 100644
--- a/iscsiuio/src/uip/ipv6_ndpc.c
+++ b/iscsiuio/src/uip/ipv6_ndpc.c
@@ -134,6 +134,7 @@ wait_rtr:
 	} while (!(ipv6c->flags & IPV6_FLAGS_ROUTER_ADV_RECEIVED));
 
 	LOG_DEBUG("%s: ndpc_handle got rtr adv", s->nic->log_name);
+	s->retry_count = 0;
 
 no_rtr_adv:
 	s->state = NDPC_STATE_RTR_ADV;
@@ -200,9 +201,13 @@ wait_dhcp:
 	} else {
 		/* Static IPv6 */
 		if (ustack->ip_config == IPV6_CONFIG_DHCP) {
-			LOG_DEBUG("%s: ndpc_handle DHCP failed",
-				  s->nic->log_name);
-			PT_RESTART(&s->pt);
+			s->retry_count++;
+			if (s->retry_count > DHCPV6_NUM_OF_RETRY) {
+				LOG_DEBUG("%s: ndpc_handle DHCP failed",
+					  s->nic->log_name);
+			} else {
+				PT_RESTART(&s->pt);
+			}
 		}
 staticv6:
 		ipv6_disable_dhcpv6(ipv6c);
-- 
2.17.2