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