Blame SOURCES/dhcp-4.2.0-honor-expired.patch

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