diff --git a/RELNOTES b/RELNOTES index 1379d604..f9bb65bd 100644 --- a/RELNOTES +++ b/RELNOTES @@ -174,6 +174,9 @@ by Eric Young (eay@cryptsoft.com). on an error condition. [ISC-Bugs #36194 +- Add code to help clean up soft leases. + [ISC-Bugs #36304] + Changes since 4.3.0rc1 - None diff --git a/server/dhcpv6.c b/server/dhcpv6.c index 112d1e1c..18962389 100644 --- a/server/dhcpv6.c +++ b/server/dhcpv6.c @@ -148,6 +148,29 @@ static struct iasubopt *prefix_compare(struct reply_state *reply, struct iasubopt *beta); static int find_hosts_by_duid_chaddr(struct host_decl **host, const struct data_string *client_id); +static void schedule_lease_timeout_reply(struct reply_state *reply); + +/* + * Schedule lease timeouts for all of the iasubopts in the reply. + * This is currently used to schedule timeouts for soft leases. + */ + +static void +schedule_lease_timeout_reply(struct reply_state *reply) { + struct iasubopt *tmp; + int i; + + /* sanity check the reply */ + if ((reply == NULL) || (reply->ia == NULL) || (reply->ia->iasubopt == NULL)) + return; + + /* walk through the list, scheduling as we go */ + for (i = 0 ; i < reply->ia->num_iasubopt ; i++) { + tmp = reply->ia->iasubopt[i]; + schedule_lease_timeout(tmp->ipv6_pool); + } +} + /* * This function returns the time since DUID time start for the * given time_t value. @@ -2052,6 +2075,8 @@ reply_process_ia_na(struct reply_state *reply, struct option_cache *ia) { ia_id->len, reply->ia, MDL); write_ia(reply->ia); + } else { + schedule_lease_timeout_reply(reply); } cleanup: @@ -2770,6 +2795,8 @@ reply_process_ia_ta(struct reply_state *reply, struct option_cache *ia) { ia_id->len, reply->ia, MDL); write_ia(reply->ia); + } else { + schedule_lease_timeout_reply(reply); } cleanup: @@ -3831,6 +3858,8 @@ reply_process_ia_pd(struct reply_state *reply, struct option_cache *ia) { ia_id->len, reply->ia, MDL); write_ia(reply->ia); + } else { + schedule_lease_timeout_reply(reply); } cleanup: