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