2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 06:15:55 +00:00

- Rotate the lease file when running in v6 mode.

[ISC-Bugs #24887]
This commit is contained in:
Shawn Routhier
2012-05-15 21:07:17 +00:00
parent aa099cba77
commit cbbd2714d6
5 changed files with 45 additions and 1 deletions

View File

@@ -1207,6 +1207,10 @@ pick_v6_prefix(struct iasubopt **pref, int plen,
}
/*
*! \file server/dhcpv6.c
*
* \brief construct a reply containing information about a client's lease
*
* lease_to_client() is called from several messages to construct a
* reply that contains all that we know about the client's correct lease
* (or projected lease).
@@ -1228,8 +1232,15 @@ pick_v6_prefix(struct iasubopt **pref, int plen,
* validate and echo back any contents that can be. If the client-supplied
* data does not error out (on renew/rebind as above), but we did not send
* any addresses, attempt to allocate one.
*
* At the end of the this function we call commit_leases_timed() to
* fsync and rotate the file as necessary. commit_leases_timed() will
* check that we have written at least one lease to the file and that
* some time has passed before doing any fsync or file rewrite so we
* don't bother tracking if we did a write_ia during this function.
*/
/* TODO: look at client hints for lease times */
static void
lease_to_client(struct data_string *reply_ret,
struct packet *packet,
@@ -1493,6 +1504,9 @@ lease_to_client(struct data_string *reply_ret,
memcpy(reply_ret->buffer->data, reply.buf.data, reply.cursor);
reply_ret->data = reply_ret->buffer->data;
/* If appropriate commit and rotate the lease file */
(void) commit_leases_timed();
exit:
/* Cleanup. */
if (reply.shared != NULL)