-.\" $Id: dhcp-options.5,v 1.44 2009/07/23 18:52:19 sar Exp $
+.\" $Id: dhcp-options.5,v 1.45 2009/09/11 18:13:12 dhankins Exp $
.\"
.\" Copyright (c) 2004-2008 by Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (c) 1996-2003 by Internet Software Consortium
This option specifies the number of seconds from the time a client gets
an address until the client transitions to the REBINDING state.
.PP
-This option is not user configurable.
+This option is user configurable, but it will be ignored if the value is
+greater than the lease time.
+.PP
+To make DHCPv4+DHCPv6 migration easier in the future, any value configured
+in this option is also used as a DHCPv6 "T1" (renew) time.
.PP
.RE
.PP
This option specifies the number of seconds from the time a client gets
an address until the client transitions to the RENEWING state.
.PP
-This option is not user configurable.
+This option is user configurable, but it will be ignored if the value is
+greater than the rebinding time, or lease time.
+.PP
+To make DHCPv4+DHCPv6 migration easier in the future, any value configured
+in this option is also used as a DHCPv6 "T2" (rebind) time.
.PP
.RE
.PP
priority_list[priority_len++] = DHO_DHCP_MESSAGE_TYPE;
priority_list[priority_len++] = DHO_DHCP_SERVER_IDENTIFIER;
priority_list[priority_len++] = DHO_DHCP_LEASE_TIME;
+ priority_list[priority_len++] = DHO_DHCP_RENEWAL_TIME;
+ priority_list[priority_len++] = DHO_DHCP_REBINDING_TIME;
priority_list[priority_len++] = DHO_DHCP_MESSAGE;
priority_list[priority_len++] = DHO_DHCP_REQUESTED_ADDRESS;
priority_list[priority_len++] = DHO_ASSOCIATED_IP;
data_string_truncate(prl, (PRIORITY_COUNT - priority_len));
+ /*
+ * Copy the client's PRL onto the priority_list after our high
+ * priority header.
+ */
for (i = 0; i < prl->len; i++) {
/*
* Prevent client from changing order of delivery
return declaration;
}
- /*
- * If the configuration attempts to define on option
- * that we ignore, then warn about it now.
- *
- * In DHCPv4 we do not use dhcp-renewal-time or
- * dhcp-rebinding-time, but we use these in DHCPv6.
- *
- * XXX: We may want to include a "blacklist" of
- * options we ignore in the future, as a table.
- */
- if ((option->code == DHO_DHCP_LEASE_TIME) ||
- ((local_family != AF_INET6) &&
- ((option->code == DHO_DHCP_RENEWAL_TIME) ||
- (option->code == DHO_DHCP_REBINDING_TIME))))
- {
- log_error("WARNING: server ignoring option %s "
- "in configuration file.",
- option->name);
- }
-
finish_option:
et = (struct executable_statement *)0;
if (!parse_option_statement
option_cache_dereference (&oc, MDL);
}
- /* Renewal time is lease time * 0.5. */
- offered_lease_time /= 2;
- putULong(state->renewal, (u_int32_t)offered_lease_time);
- i = DHO_DHCP_RENEWAL_TIME;
- oc = (struct option_cache *)0;
- if (option_cache_allocate (&oc, MDL)) {
- if (make_const_data(&oc->expression, state->renewal,
- 4, 0, 0, MDL)) {
- option_code_hash_lookup(&oc->option,
- dhcp_universe.code_hash,
- &i, 0, MDL);
- save_option (&dhcp_universe,
- state -> options, oc);
- }
- option_cache_dereference (&oc, MDL);
+ /*
+ * Validate any configured renew or rebinding times against
+ * the determined lease time. Do rebinding first so that
+ * the renew time can be validated against the rebind time.
+ */
+ if ((oc = lookup_option(&dhcp_universe, state->options,
+ DHO_DHCP_REBINDING_TIME)) != NULL &&
+ evaluate_option_cache(&d1, packet, lease, NULL,
+ packet->options, state->options,
+ &lease->scope, oc, MDL)) {
+ TIME rebind_time = getULong(d1.data);
+
+ /* Drop the configured (invalid) rebinding time. */
+ if (rebind_time >= offered_lease_time)
+ delete_option(&dhcp_universe, state->options,
+ DHO_DHCP_REBINDING_TIME);
+ else /* XXX: variable is reused. */
+ offered_lease_time = rebind_time;
+
+ data_string_forget(&d1, MDL);
}
- /* Rebinding time is lease time * 0.875. */
- offered_lease_time += (offered_lease_time / 2
- + offered_lease_time / 4);
- putULong(state->rebind, (u_int32_t)offered_lease_time);
- i = DHO_DHCP_REBINDING_TIME;
- oc = (struct option_cache *)0;
- if (option_cache_allocate (&oc, MDL)) {
- if (make_const_data(&oc->expression, state->rebind,
- 4, 0, 0, MDL)) {
- option_code_hash_lookup(&oc->option,
- dhcp_universe.code_hash,
- &i, 0, MDL);
- save_option (&dhcp_universe,
- state -> options, oc);
- }
- option_cache_dereference (&oc, MDL);
+ if ((oc = lookup_option(&dhcp_universe, state->options,
+ DHO_DHCP_RENEWAL_TIME)) != NULL &&
+ evaluate_option_cache(&d1, packet, lease, NULL,
+ packet->options, state->options,
+ &lease->scope, oc, MDL)) {
+ if (getULong(d1.data) >= offered_lease_time)
+ delete_option(&dhcp_universe, state->options,
+ DHO_DHCP_RENEWAL_TIME);
+
+ data_string_forget(&d1, MDL);
}
} else {
/* XXXSK: should we use get_server_source_address() here? */