From e9d80cc0f23ec53a2060b4c061dc8462aa0028c8 Mon Sep 17 00:00:00 2001
From: Hans Dedecker <dedeckeh@gmail.com>
Date: Mon, 30 Jan 2017 12:21:16 +0100
Subject: [PATCH] dhcpv6: trigger restart of DHCPv6 state machine when not
 receiving statefull options

Don't set the renew timeout to 600 seconds in case no statefull options
are received but rather trigger an immediate restart of the DHCPv6
client state machine.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
---
 src/dhcpv6.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/dhcpv6.c b/src/dhcpv6.c
index 6389052..d8e3ec9 100644
--- a/src/dhcpv6.c
+++ b/src/dhcpv6.c
@@ -1,5 +1,6 @@
 /**
  * Copyright (C) 2012-2014 Steven Barth <steven@midlink.org>
+ * Copyright (C) 2017 Hans Dedecker <dedeckeh@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License v2 as published by
@@ -1142,7 +1143,7 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig, _unused const int rc,
 
 	if (orig != DHCPV6_MSG_INFO_REQ) {
 		// Update refresh timers if no fatal status code was received
-		if ((ret > 0) && dhcpv6_calc_refresh_timers()) {
+		if ((ret > 0) && (ret = dhcpv6_calc_refresh_timers())) {
 			switch (orig) {
 			case DHCPV6_MSG_RENEW:
 				// Send further renews if T1 is not set
@@ -1331,8 +1332,6 @@ static int dhcpv6_calc_refresh_timers(void)
 		t1 = l_t1;
 		t2 = l_t2;
 		t3 = l_t3;
-	} else {
-		t1 = 600;
 	}
 
 	return (int)(ia_pd_entries + ia_na_entries);
-- 
2.25.1