290660e
diff -up dhcp-4.2.0/client/dhc6.c.honor-expired dhcp-4.2.0/client/dhc6.c
290660e
--- dhcp-4.2.0/client/dhc6.c.honor-expired	2010-10-07 12:55:37.000000000 +0200
290660e
+++ dhcp-4.2.0/client/dhc6.c	2010-10-07 12:56:43.000000000 +0200
2b40dd8
@@ -1405,6 +1405,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
290660e
@@ -1417,8 +1446,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
 	}