+2115. [func] tmark
+ Added the parameter, offer-lifetime, to kea-dhcp4. When
+ greater than zero, the server temporarily allocates and
+ persists leases during DHCPOFFER processing.
+ (Gitlab #2719)
+
2114. [func] razvan
Added the -T command line parameter to kea-dhcp4 and kea-dhcp6
for testing configuration files, similar to -t, but with extra
valid lifetime e.g. ``dhcp-renewal-time`` and ``dhcp-rebinding-time``,
also depend on the reusable lifetime.
+Temporary Allocation on DHCPDISCOVER
+------------------------------------
+
+By default, kea-dhcp4 does not allocate or store a lease when offering an address
+to a client in response to a DHCPDISCOVER. In general, kea-dhcp4, can fulfill client
+demands faster by deferring lease allocation and storage until it receives DHCPREQUESTs
+for them. Release 2.3.6 added a new parameter to kea-dhcp4, ``offer-lifetime``, which
+(when not zero) instructs the server to allocate and persist a lease when generating an
+DHCPOFFER and:
+
+- The persisted lease's lifetime is equal to ``offer-lifetime`` (in seconds).
+
+- The lifetime sent to the client in the DHCPOFFER via option 51 will still be based
+ on ``valid-lifetime``. This avoids issues with clients that may reject offers lifetimes they
+ perceive as too short.
+
+- DDNS updates are not performed. As with the default behavior, that occurs on DHCPREQUEST.
+
+- Updates are not sent to HA peers.
+
+- Assigned lease statistics are incremented.
+
+- Expiration processing and reclamation behave just as they do for leases allocated
+ during DHCPREQUEST processing.
+
+- Lease caching, if enabled, is honored.
+
+- In sites running multiple instances of kea-dhcp4 against a single, shared lease store, races
+ for given address values are lost during DHCPDISCOVER processing rather than during DHCPREQUEST
+ processing. Servers that lose the race for the address will simply not respond the client
+ rather than NAK them. The client in turn will simply retry DHCPDISCOVER. This should reduce
+ the amount of traffic such conflicts incur.
+
+- Clients repeating DHCPDISCOVERs will be offered the same address each time.
+
+An example subnet configuration is shown below:
+
+::
+
+ "subnet4": [
+ {
+ "pools": [ { "pool": "192.0.2.1 - 192.0.2.200" } ],
+ "subnet": "192.0.2.0/24",
+ "offer-lifetime": 60,
+ "valid-lifetime": 2000,
+ ...
+ }
+ ],
+
+Here ``offer-lifetime`` has been configured to be 60 seconds with a ``valid-lifetime``
+of 2000 seconds. This instructs kea-dhcp4 to persist leases for 60 seconds when
+sending them back in DHCPOFFERs and then extending them to 2000 seconds when clients
+DHCPREQUEST them.
+
+The value, which defaults to zero, is supported at the global, shared-network, subnet,
+and class levels. Choosing an appropriate value for offer-lifetime is extremely
+site-dependent but a value between 60 and 120 seconds would be a reasonable starting
+point.
+
.. _host-reservation-v4:
Host Reservations in DHCPv4
done
}
+mysql_upgrade_14_to_15_test() {
+ # table: dhcp4_options new cancelled column.
+ qry="select cancelled from dhcp4_options"
+ run_statement "dhcp4_options" "$qry"
+
+ # table: dhcp6_options new cancelled column.
+ qry="select cancelled from dhcp6_options"
+ run_statement "dhcp6_options" "$qry"
+
+ # Check if offer_lifetime was added to dhcp4_shared_network table.
+ qry="SELECT offer_lifetime from dhcp4_shared_network limit 1;"
+ run_command \
+ mysql_execute "${qry}"
+ assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
+
+ # Check if offer_lifetime was added to dhcp4_subnet table.
+ qry="SELECT offer_lifetime from dhcp4_subnet limit 1;"
+ run_command \
+ mysql_execute "${qry}"
+ assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
+
+ # Check if offer_lifetime was added to dhcp4_client_class table.
+ qry="SELECT offer_lifetime from dhcp4_client_class limit 1;"
+ run_command \
+ mysql_execute "${qry}"
+ assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
+}
+
mysql_upgrade_test() {
test_start "mysql.upgrade"
mysql_upgrade_13_to_14_test
# Check upgrade from 14.0 to 15.0.
-
- # table: dhcp4_options new cancelled column.
- qry="select cancelled from dhcp4_options"
- run_statement "dhcp4_options" "$qry"
-
- # table: dhcp6_options new cancelled column.
- qry="select cancelled from dhcp6_options"
- run_statement "dhcp6_options" "$qry"
+ mysql_upgrade_14_to_15_test
# Let's wipe the whole database
mysql_wipe
run_command \
pgsql_execute "select cancelled from dhcp6_options;"
assert_eq 0 "${EXIT_CODE}" "dhcp6_options is missing cancelled column. (expected status code %d, returned %d)"
+
+ # Check if offer_lifetime was added to dhcp4_shared_network table.
+ qry="SELECT offer_lifetime from dhcp4_shared_network limit 1;"
+ run_command \
+ pgsql_execute "${qry}"
+ assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
+
+ # Check if offer_lifetime was added to dhcp4_subnet table.
+ qry="SELECT offer_lifetime from dhcp4_subnet limit 1;"
+ run_command \
+ pgsql_execute "${qry}"
+ assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
+
+ # Check if offer_lifetime was added to dhcp4_client_class table.
+ qry="SELECT offer_lifetime from dhcp4_client_class limit 1;"
+ run_command \
+ pgsql_execute "${qry}"
+ assert_eq 0 "${EXIT_CODE}" "${qry}. (expected status code %d, returned %d)"
}
pgsql_upgrade_test() {
ALTER TABLE dhcp6_options
ADD COLUMN cancelled TINYINT(1) NOT NULL DEFAULT 0;
+-- Add offer_lifetime column to v4 tables.
+ALTER TABLE dhcp4_shared_network
+ ADD COLUMN offer_lifetime INT(10) DEFAULT NULL;
+
+ALTER TABLE dhcp4_subnet
+ ADD COLUMN offer_lifetime INT(10) DEFAULT NULL;
+
+ALTER TABLE dhcp4_client_class
+ ADD COLUMN offer_lifetime INT(10) DEFAULT NULL;
+
-- Update the schema version number.
UPDATE schema_version
SET version = '15', minor = '0';
ALTER TABLE dhcp4_options ADD COLUMN cancelled BOOLEAN NOT NULL DEFAULT 'f';
ALTER TABLE dhcp6_options ADD COLUMN cancelled BOOLEAN NOT NULL DEFAULT 'f';
+-- Add offer_lifetime column to v4 tables.
+ALTER TABLE dhcp4_shared_network
+ ADD COLUMN offer_lifetime BIGINT DEFAULT NULL;
+
+ALTER TABLE dhcp4_subnet
+ ADD COLUMN offer_lifetime BIGINT DEFAULT NULL;
+
+ALTER TABLE dhcp4_client_class
+ ADD COLUMN offer_lifetime BIGINT DEFAULT NULL;
+
-- Update the schema version number.
UPDATE schema_version
SET version = '14', minor = '0';