Blame SOURCES/dhcp-honor-expired.patch

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