]>
Commit | Line | Data |
---|---|---|
78ab9b04 MT |
1 | diff -up dhcp-4.2.0/client/dhc6.c.honor-expired dhcp-4.2.0/client/dhc6.c |
2 | --- dhcp-4.2.0/client/dhc6.c.honor-expired 2010-10-07 12:55:37.000000000 +0200 | |
3 | +++ dhcp-4.2.0/client/dhc6.c 2010-10-07 12:56:43.000000000 +0200 | |
4 | @@ -1405,6 +1405,32 @@ start_info_request6(struct client_state | |
5 | go_daemon(); | |
6 | } | |
7 | ||
8 | +/* Run through the addresses in lease and return true if there's any unexpired. | |
9 | + * Return false otherwise. | |
10 | + */ | |
11 | +isc_boolean_t | |
12 | +unexpired_address_in_lease(struct dhc6_lease *lease) | |
13 | +{ | |
14 | + struct dhc6_ia *ia; | |
15 | + struct dhc6_addr *addr; | |
16 | + | |
17 | + for (ia = lease->bindings ; ia != NULL ; ia = ia->next) { | |
18 | + for (addr = ia->addrs ; addr != NULL ; addr = addr->next) { | |
19 | + if (addr->flags & DHC6_ADDR_EXPIRED) | |
20 | + continue; | |
21 | + | |
22 | + if (addr->starts + addr->max_life > cur_time) { | |
23 | + return ISC_TRUE; | |
24 | + } | |
25 | + } | |
26 | + } | |
27 | + | |
28 | + log_info("PRC: Previous lease is devoid of active addresses." | |
29 | + " Re-initializing."); | |
30 | + | |
31 | + return ISC_FALSE; | |
32 | +} | |
33 | + | |
34 | /* | |
35 | * start_confirm6() kicks off an "init-reboot" version of the process, at | |
36 | * startup to find out if old bindings are 'fair' and at runtime whenever | |
37 | @@ -1417,8 +1446,10 @@ start_confirm6(struct client_state *clie | |
38 | ||
39 | /* If there is no active lease, there is nothing to check. */ | |
40 | if ((client->active_lease == NULL) || | |
41 | - !active_prefix(client) || | |
42 | - client->active_lease->released) { | |
43 | + !active_prefix(client) || | |
44 | + client->active_lease->released || | |
45 | + !unexpired_address_in_lease(client->active_lease)) { | |
46 | + dhc6_lease_destroy(&client->active_lease, MDL); | |
47 | start_init6(client); | |
48 | return; | |
49 | } |