]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2719] Updated the ARM, added ChangeLog
authorThomas Markwalder <tmark@isc.org>
Mon, 6 Mar 2023 19:58:05 +0000 (14:58 -0500)
committerThomas Markwalder <tmark@isc.org>
Thu, 23 Mar 2023 11:18:25 +0000 (07:18 -0400)
ChangeLog
doc/sphinx/arm/dhcp4-srv.rst
src/bin/admin/tests/mysql_tests.sh.in
src/bin/admin/tests/pgsql_tests.sh.in
src/share/database/scripts/mysql/dhcpdb_create.mysql
src/share/database/scripts/pgsql/dhcpdb_create.pgsql

index c2e512fad5bb1a6bf48c39085bd1a7f875a7f1af..b5742af4cec7b19ec0f6669909ddd8e8d0d1cdbb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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
index 8ddf548f9e6f77efbb445474857787840f66adc9..5077af44950ac365de90bc990fe9fcab9d855f3b 100644 (file)
@@ -4488,6 +4488,65 @@ i.e. the expiration date does not change. Other options based on the
 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
index 403d51ea9803ba8a1565f15058a8c1d270b6d468..596b3884c2d515c87544e04816a75a67e0851b7a 100644 (file)
@@ -687,6 +687,34 @@ mysql_upgrade_13_to_14_test() {
     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"
@@ -1336,14 +1364,7 @@ SET @disable_audit = 0;"
     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
index 275f4df958634b16d128286472fcbd401a29d3de..456a66b6c8cff871c9fbbfad20c2f7eac1ee653f 100644 (file)
@@ -770,6 +770,24 @@ pgsql_upgrade_13_to_14_test() {
     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() {
index bb68eb8914b3dfaafc69bc88addde46688dc59a0..656b54ec9db30fdb70b57c469539aa07d2bf50f1 100644 (file)
@@ -5073,6 +5073,16 @@ ALTER TABLE dhcp4_options
 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';
index 37cb3824a59b8c938293871bffde3d1e92df8118..910ec2e42c7eceb9145103b385296130df6a1c56 100644 (file)
@@ -5633,6 +5633,16 @@ UPDATE schema_version
 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';