]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[master] Added --release-on-roam server parameter
authorThomas Markwalder <tmark@isc.org>
Mon, 18 Dec 2017 19:00:46 +0000 (14:00 -0500)
committerThomas Markwalder <tmark@isc.org>
Mon, 18 Dec 2017 19:00:46 +0000 (14:00 -0500)
    Merges in 46849.

RELNOTES
includes/dhcpd.h
server/dhcpd.c
server/dhcpd.conf.5
server/dhcpv6.c
server/stables.c

index feab3810c4855091f91defc8027e10e2bb9f253b..22ac72b0f06e22d543ff4922dc1aad826c705631 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -184,19 +184,26 @@ dhcp-users@lists.isc.org.
   doing load balancing within failover.
   [ISC-Bugs #45364]
 
-- If the server detects that a DHCPv6 client (IAID+DUID) has roamed to a new
-  network, it will now automatically release pre-existing leases on the old
-  network. When this occurs the server will emit a log statement:
+- Added --release-on-roam to dhcpd server. When enabled and the server detects
+  that a DHCPv6 client (IAID+DUID) has roamed to a new network, it will release
+  the pre-existing leases on the old network and emit a log statement similar
+  to the following:
 
       "Client: <id> roamed to new network, releasing lease: <address>"
 
   The server will carry out all of the same steps that would normally occur
-  when a client explicitly releases a lease.  Prior to this the server simply
-  dropped the pre-existing leases on the floor without doing the appropriate
-  clean-up.  Clients that need leases in multiple networks must supply a
-  unique IAID in each IA. Thanks to Fernando Soto from BlueCat Networks for
-  reporting the issue.
+  when a client explicitly releases a lease.  This behavior is disabled by
+  default and may only be specified globally. Prior to this the server renders
+  the leases unavailable until they expire or the server is restarted. Clients
+  that need leases in multiple networks must supply a unique IAID in each IA.
+  When release-on-roam is disabled (the default) the server maintains the
+  prior behavior of making such leases unavailable until they expire or the
+  server is restarted. Clients that need leases in multiple networks must
+  supply a unique IAID in each IA.  This parameter may only be specified at
+  the global level.  Thanks to Fernando Soto from BlueCat Networks for
+  suggesting this change.
   [ISC-Bugs #44576]
+  [ISC-Bugs #46849]
 
 - The ability of the server to send back dhcp6.vendor-opts values has been
   restored. A change in 4.3.5 (see #29246) which enabled it to send back the
index 43abe2887b77a7827ab43a35918c194fec584d28..95af8a2141ccf612077b6709e69a9430d9dcd041 100644 (file)
@@ -809,6 +809,7 @@ struct lease_state {
 #define SV_DDNS_DUAL_STACK_MIXED_MODE  92
 #define SV_DDNS_GUARD_ID_MUST_MATCH    93
 #define SV_DDNS_OTHER_GUARD_IS_DYNAMIC 94
+#define SV_RELEASE_ON_ROAM             95
 
 #if !defined (DEFAULT_PING_TIMEOUT)
 # define DEFAULT_PING_TIMEOUT 1
@@ -2104,7 +2105,11 @@ extern int server_id_check;
 extern int persist_eui64;
 #endif
 
+#ifdef DHCPv6
 extern int prefix_length_mode;
+extern int do_release_on_roam;
+#endif
+
 extern int authoring_byte_order;
 extern int lease_id_format;
 extern u_int32_t abandon_lease_time;
index 614bc097089b24d4560b24f8d78e94b78e3ab5eb..c5b9d092e35d64ffaed00099f9d373b158484883 100644 (file)
@@ -80,7 +80,11 @@ u_int16_t ddns_conflict_mask;
 int ddns_update_style;
 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 */
+
+#ifdef DHCPv6
 int prefix_length_mode = PLM_PREFER;
+int do_release_on_roam = 0; /* 0 = default, do not release v6 leases on roam */
+#endif
 
 #ifdef EUI_64
 int persist_eui64 = 1; /* 1 = write EUI64 leases to disk, 0 = don't */
@@ -1365,6 +1369,7 @@ void postconf_initialization (int quiet)
                server_id_check = 1;
        }
 
+#ifdef DHCPv6
        oc = lookup_option(&server_universe, options, SV_PREFIX_LEN_MODE);
        if ((oc != NULL) &&
            evaluate_option_cache(&db, NULL, NULL, NULL, options, NULL,
@@ -1377,6 +1382,7 @@ void postconf_initialization (int quiet)
 
                data_string_forget(&db, MDL);
        }
+#endif
 
        // Set global abandon-lease-time option.
        oc = lookup_option (&server_universe, options, SV_ABANDON_LEASE_TIME);
@@ -1416,6 +1422,16 @@ void postconf_initialization (int quiet)
        }
 #endif
 
+#ifdef DHCPv6
+       oc = lookup_option(&server_universe, options, SV_RELEASE_ON_ROAM);
+       if (oc != NULL) {
+               do_release_on_roam =
+                       evaluate_boolean_option_cache(NULL, NULL, NULL, NULL,
+                                                     options, NULL,
+                                                     &global_scope, oc, MDL);
+       }
+#endif
+
 #if defined (BINARY_LEASES)
        if (local_family == AF_INET) {
                log_info("Source compiled to use binary-leases");
index f2b6fa49b43b2dbe41ec28e4f3f73ba3eff2f6c8..7244fa7c085b18fd490180d1fdb81208e55cbcac 100644 (file)
@@ -3116,6 +3116,27 @@ starting with pool A but with appropriately adjusted length criteria.
 .RE
 .PP
 The
+.I release-on-roam
+statement
+.RS 0.25i
+.PP
+.B release-on-roam \fIflag\fB;\fR
+.PP
+When enabled and the dhcpd server detects that a DHCPv6 client (IAID+DUID)
+has roamed to a new network, it will release the pre-existing leases on the
+old network and emit a log statement similiar to the following:
+
+      "Client: <id> roamed to new network, releasing lease: <address>"
+
+The server will carry out all of the same steps that would normally occur
+when a client explicitly releases a lease.  When release-on-roam is disabled
+(the default) the server makes such leases unavailable until they expire or
+the server is restarted. Clients that need leases in multiple networks must
+supply a unique IAID in each IA.  This parameter may only be specified at
+the global level.
+.RE
+.PP
+The
 .I remote-port
 statement
 .RS 0.25i
index 4fdb2cebbd1084412504fe098e463b7d0ccf45e3..339766eae4cc7753c18f25acf2d35cd2de39ffd7 100644 (file)
@@ -8400,7 +8400,8 @@ release_on_roam(struct reply_state* reply) {
        struct iasubopt *lease = NULL;
        int i;
 
-       if (old_ia == NULL || old_ia->num_iasubopt <= 0) {
+       if ((!do_release_on_roam) || old_ia == NULL
+           || old_ia->num_iasubopt <= 0) {
                return(0);
        }
 
index 8a951b6a71c89eba598bfb1f8cc4cc51408d676d..e85696e1eee69f0cc7a4c35b52b8c6420ed8b2e1 100644 (file)
@@ -287,6 +287,7 @@ static struct option server_options[] = {
        { "ddns-dual-stack-mixed-mode", "f",            &server_universe,  SV_DDNS_DUAL_STACK_MIXED_MODE, 1 },
        { "ddns-guard-id-must-match", "f",              &server_universe,  SV_DDNS_GUARD_ID_MUST_MATCH, 1 },
        { "ddns-other-guard-is-dynamic", "f",           &server_universe,  SV_DDNS_OTHER_GUARD_IS_DYNAMIC, 1 },
+       { "release-on-roam", "f",       &server_universe,  SV_RELEASE_ON_ROAM, 1 },
        { NULL, NULL, NULL, 0, 0 }
 };