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