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

index 1379d604c1165d66c75ec89418d251abea68fe57..f9bb65bd5275f07096c9cc5939c21ba133204eab 100644 (file)
--- 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
index 112d1e1c6540a6efbed2ba40eb400bbac6368ad9..18962389303a557bcc586f9b96209a59d05f7f64 100644 (file)
@@ -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: