e83fb19
diff -up dhcp-4.3.0a1/client/dhc6.c.honor-expired dhcp-4.3.0a1/client/dhc6.c
e83fb19
--- dhcp-4.3.0a1/client/dhc6.c.honor-expired	2013-12-19 16:00:28.062183037 +0100
e83fb19
+++ dhcp-4.3.0a1/client/dhc6.c	2013-12-19 16:00:28.076182842 +0100
e83fb19
@@ -1351,6 +1351,32 @@ start_info_request6(struct client_state
290660e
 		go_daemon();
290660e
 }
290660e
 
290660e
+/* Run through the addresses in lease and return true if there's any unexpired.
290660e
+ * Return false otherwise.
290660e
+ */
290660e
+isc_boolean_t
290660e
+unexpired_address_in_lease(struct dhc6_lease *lease)
290660e
+{
290660e
+	struct dhc6_ia *ia;
290660e
+	struct dhc6_addr *addr;
290660e
+
290660e
+	for (ia = lease->bindings ; ia != NULL ; ia = ia->next) {
290660e
+		for (addr = ia->addrs ; addr != NULL ; addr = addr->next) {
290660e
+			if (addr->flags & DHC6_ADDR_EXPIRED)
290660e
+				continue;
290660e
+
290660e
+			if (addr->starts + addr->max_life > cur_time) {
290660e
+				return ISC_TRUE;
290660e
+			}
290660e
+		}
290660e
+	}
290660e
+
290660e
+	log_info("PRC: Previous lease is devoid of active addresses."
290660e
+		 "  Re-initializing.");
290660e
+
290660e
+	return ISC_FALSE;
290660e
+}
290660e
+
290660e
 /*
290660e
  * start_confirm6() kicks off an "init-reboot" version of the process, at
290660e
  * startup to find out if old bindings are 'fair' and at runtime whenever
e83fb19
@@ -1363,8 +1389,10 @@ start_confirm6(struct client_state *clie
290660e
 
290660e
 	/* If there is no active lease, there is nothing to check. */
290660e
 	if ((client->active_lease == NULL) ||
290660e
-	    !active_prefix(client) ||
290660e
-	    client->active_lease->released) {
290660e
+		!active_prefix(client) ||
290660e
+		client->active_lease->released ||
290660e
+		!unexpired_address_in_lease(client->active_lease)) {
290660e
+		dhc6_lease_destroy(&client->active_lease, MDL);
290660e
 		start_init6(client);
290660e
 		return;
290660e
 	}