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