]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[v4_2] Add code to help clean up soft leases
authorShawn Routhier <sar@isc.org>
Fri, 20 Jun 2014 20:07:53 +0000 (13:07 -0700)
committerShawn Routhier <sar@isc.org>
Fri, 20 Jun 2014 20:07:53 +0000 (13:07 -0700)
RELNOTES
server/dhcpv6.c

index 6d348de781e03d7bb5328326fb7be70a8e1b671b..6d87138fd92704c39bd66048c1853c2176501d60 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -132,6 +132,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.2.6rc1
 
 - None
index c496dd0de0b58b38661e971557a1f42ad63ef3f2..729e4d357937b43b76ed285aa3d07c5e69a69f7a 100644 (file)
@@ -143,6 +143,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.
@@ -1930,6 +1953,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:
@@ -2619,6 +2644,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:
@@ -3522,6 +3549,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: