mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-29 05:17:57 +00:00
[master] Adds persist-eui-64-leases config parameter and support
Merges in rt45046.
This commit is contained in:
parent
7b4f284e50
commit
c2e5ee2882
5
RELNOTES
5
RELNOTES
@ -298,6 +298,11 @@ dhcp-users@lists.isc.org.
|
||||
default), hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384, and hmac-sha512.
|
||||
[ISC-Bugs #46771]
|
||||
|
||||
- Added a server configuration parameter, persist-eui-64-leases, which
|
||||
determines whether or not EUI-64 based leases are written to the
|
||||
leases file. Default is true.
|
||||
[ISC-Bugs #45046]
|
||||
|
||||
Changes since 4.3.0 (bug fixes)
|
||||
|
||||
- Tidy up several small tickets.
|
||||
|
@ -801,6 +801,7 @@ struct lease_state {
|
||||
#define SV_ABANDON_LEASE_TIME 89
|
||||
#ifdef EUI_64
|
||||
#define SV_USE_EUI_64 90
|
||||
#define SV_PERSIST_EUI_64_LEASES 91
|
||||
#endif
|
||||
#if defined (FAILOVER_PROTOCOL)
|
||||
#define SV_CHECK_SECS_BYTE_ORDER 91
|
||||
@ -2099,6 +2100,10 @@ extern u_int16_t ddns_conflict_mask;
|
||||
extern int dont_use_fsync;
|
||||
extern int server_id_check;
|
||||
|
||||
#ifdef EUI_64
|
||||
extern int persist_eui64;
|
||||
#endif
|
||||
|
||||
extern int prefix_length_mode;
|
||||
extern int authoring_byte_order;
|
||||
extern int lease_id_format;
|
||||
|
53
server/db.c
53
server/db.c
@ -374,7 +374,7 @@ int write_host (host)
|
||||
++errors;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
memset (&ip_addrs, 0, sizeof ip_addrs);
|
||||
if (host -> fixed_addr &&
|
||||
evaluate_option_cache (&ip_addrs, (struct packet *)0,
|
||||
@ -384,7 +384,7 @@ int write_host (host)
|
||||
(struct option_state *)0,
|
||||
&global_scope,
|
||||
host -> fixed_addr, MDL)) {
|
||||
|
||||
|
||||
errno = 0;
|
||||
fprintf (db_file, "\n fixed-address ");
|
||||
if (errno)
|
||||
@ -525,9 +525,30 @@ write_ia(const struct ia_xx *ia) {
|
||||
char *s;
|
||||
int fprintf_ret;
|
||||
|
||||
/*
|
||||
* If the lease file is corrupt, don't try to write any more
|
||||
* leases until we've written a good lease file.
|
||||
#ifdef EUI_64
|
||||
/* If we're not writing EUI64 leases to the file, then
|
||||
* we can skip writing this IA provided all of its leases
|
||||
* are EUI64. (Not sure you can ever have a case where
|
||||
* they aren't but doesn't hurt to check) */
|
||||
if (ia->ia_type == D6O_IA_NA && !persist_eui64) {
|
||||
int i;
|
||||
for (i=0; i < ia->num_iasubopt; i++) {
|
||||
if (!ia->iasubopt[i]->ipv6_pool->ipv6_pond->use_eui_64)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == ia->num_iasubopt) {
|
||||
/* Their all EUI64 so we can skip it */
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If the lease file is corrupt, don't try to write any more
|
||||
* leases until we've written a good lease file.
|
||||
*/
|
||||
if (lease_file_is_corrupt) {
|
||||
if (!new_lease_file(0)) {
|
||||
@ -587,11 +608,11 @@ write_ia(const struct ia_xx *ia) {
|
||||
goto error_exit;
|
||||
}
|
||||
if ((iasubopt->state <= 0) || (iasubopt->state > FTS_LAST)) {
|
||||
log_fatal("Unknown iasubopt state %d at %s:%d",
|
||||
log_fatal("Unknown iasubopt state %d at %s:%d",
|
||||
iasubopt->state, MDL);
|
||||
}
|
||||
binding_state = binding_state_names[iasubopt->state-1];
|
||||
if (fprintf(db_file, " binding state %s;\n",
|
||||
if (fprintf(db_file, " binding state %s;\n",
|
||||
binding_state) < 0) {
|
||||
goto error_exit;
|
||||
}
|
||||
@ -639,7 +660,7 @@ write_ia(const struct ia_xx *ia) {
|
||||
if (write_binding_scope(db_file, bnd,
|
||||
"\n ") != ISC_R_SUCCESS)
|
||||
goto error_exit;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (iasubopt->on_star.on_expiry) {
|
||||
@ -650,7 +671,7 @@ write_ia(const struct ia_xx *ia) {
|
||||
goto error_exit;
|
||||
write_statements(db_file,
|
||||
iasubopt->on_star.on_expiry, 6);
|
||||
if (fprintf(db_file, "\n }") < 0)
|
||||
if (fprintf(db_file, "\n }") < 0)
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
@ -697,9 +718,9 @@ write_server_duid(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the lease file is corrupt, don't try to write any more
|
||||
* leases until we've written a good lease file.
|
||||
/*
|
||||
* If the lease file is corrupt, don't try to write any more
|
||||
* leases until we've written a good lease file.
|
||||
*/
|
||||
if (lease_file_is_corrupt) {
|
||||
if (!new_lease_file(0)) {
|
||||
@ -882,7 +903,7 @@ write_named_billing_class(const void *key, unsigned len, void *object)
|
||||
if (fprintf(db_file, " dynamic;\n") <= 0)
|
||||
return ISC_R_IOERROR;
|
||||
}
|
||||
|
||||
|
||||
if (class->lease_limit > 0) {
|
||||
if (fprintf(db_file, " lease limit %d;\n",
|
||||
class->lease_limit) <= 0)
|
||||
@ -893,7 +914,7 @@ write_named_billing_class(const void *key, unsigned len, void *object)
|
||||
if (fprintf(db_file, " match if ") <= 0)
|
||||
return ISC_R_IOERROR;
|
||||
|
||||
errno = 0;
|
||||
errno = 0;
|
||||
write_expression(db_file, class->expr, 5, 5, 0);
|
||||
if (errno)
|
||||
return ISC_R_IOERROR;
|
||||
@ -919,7 +940,7 @@ write_named_billing_class(const void *key, unsigned len, void *object)
|
||||
if (fprintf(db_file, ";\n") <= 0)
|
||||
return ISC_R_IOERROR;
|
||||
}
|
||||
|
||||
|
||||
if (class->statements != 0) {
|
||||
errno = 0;
|
||||
write_statements(db_file, class->statements, 8);
|
||||
@ -1238,7 +1259,7 @@ int new_lease_file (int test_mode)
|
||||
#if defined (TRACING)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Move in the new file... */
|
||||
if (rename (newfname, path_dhcpd_db) < 0) {
|
||||
log_error ("Can't install new lease database %s to %s: %m",
|
||||
|
@ -82,6 +82,10 @@ int dont_use_fsync = 0; /* 0 = default, use fsync, 1 = don't use fsync */
|
||||
int server_id_check = 0; /* 0 = default, don't check server id, 1 = do check */
|
||||
int prefix_length_mode = PLM_PREFER;
|
||||
|
||||
#ifdef EUI_64
|
||||
int persist_eui64 = 1; /* 1 = write EUI64 leases to disk, 0 = don't */
|
||||
#endif
|
||||
|
||||
int authoring_byte_order = 0; /* 0 = not set */
|
||||
int lease_id_format = TOKEN_OCTAL; /* octal by default */
|
||||
u_int32_t abandon_lease_time = DEFAULT_ABANDON_LEASE_TIME;
|
||||
@ -847,8 +851,9 @@ main(int argc, char **argv) {
|
||||
#endif
|
||||
|
||||
/* test option should cause an early exit */
|
||||
if (cftest && !lftest)
|
||||
if (cftest && !lftest) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* First part of dealing with pid files. Check to see if
|
||||
@ -1396,6 +1401,21 @@ void postconf_initialization (int quiet)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EUI_64
|
||||
oc = lookup_option(&server_universe, options, SV_PERSIST_EUI_64_LEASES);
|
||||
if (oc != NULL) {
|
||||
persist_eui64 = evaluate_boolean_option_cache(NULL, NULL, NULL,
|
||||
NULL, options,
|
||||
NULL,
|
||||
&global_scope,
|
||||
oc, MDL);
|
||||
}
|
||||
|
||||
if (!persist_eui64) {
|
||||
log_info("EUI64 leases will not be written to lease file");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (BINARY_LEASES)
|
||||
if (local_family == AF_INET) {
|
||||
log_info("Source compiled to use binary-leases");
|
||||
|
@ -2920,6 +2920,21 @@ or provable, so we urge caution in the use of this statement.
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
.I persist-eui-64-leases
|
||||
statement
|
||||
.RS 0.25i
|
||||
.PP
|
||||
.B persist-eui-64-leases \fIflag\fR\fB;\fR
|
||||
.PP
|
||||
When this flag is enabled, the server will write EUI-64 based leases to the
|
||||
leases file. Since such leases can only, ever be valid for a single DUID value
|
||||
it can be argued that writing them to the leases file isn't essential and not
|
||||
doing so may have perfomance advantages. See \fIuse-eui-64\fR statement for
|
||||
more details on EUI-64 based address allocation. The flag is enabled by
|
||||
default and may only be set at the global scope.
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
.I pid-file-name
|
||||
statement
|
||||
.RS 0.25i
|
||||
@ -3349,8 +3364,6 @@ in use. Also, the server must attempt the update each time the
|
||||
client renews its lease, which could have a significant performance
|
||||
impact in environments that place heavy demands on the DHCP server.
|
||||
.RE
|
||||
|
||||
|
||||
.PP
|
||||
The
|
||||
.I use-eui-64
|
||||
@ -3413,6 +3426,9 @@ message:
|
||||
Request - Server will send "an address not on link status", and no ia
|
||||
suboption Renew/Rebind - Server will send the requested address ia
|
||||
suboption with lifetimes of 0, plus an EUI-64 ia
|
||||
|
||||
Whether or not EUI-64 based leases are written out to the lease database
|
||||
may be controlled by \fIpersist-eui-64-leases\fR statement.
|
||||
.RE
|
||||
.PP
|
||||
The
|
||||
|
@ -279,6 +279,7 @@ static struct option server_options[] = {
|
||||
{ "abandon-lease-time", "T", &server_universe, SV_ABANDON_LEASE_TIME, 1 },
|
||||
#ifdef EUI_64
|
||||
{ "use-eui-64", "f", &server_universe, SV_USE_EUI_64, 1 },
|
||||
{ "persist-eui-64-leases", "f", &server_universe, SV_PERSIST_EUI_64_LEASES, 1 },
|
||||
#endif
|
||||
#if defined (FAILOVER_PROTOCOL)
|
||||
{ "check-secs-byte-order", "f", &server_universe, SV_CHECK_SECS_BYTE_ORDER, 1 },
|
||||
|
Loading…
x
Reference in New Issue
Block a user