]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[master] Honor prefix length hint for returning clients
authorThomas Markwalder <tmark@isc.org>
Wed, 6 Sep 2017 14:25:17 +0000 (10:25 -0400)
committerThomas Markwalder <tmark@isc.org>
Wed, 6 Sep 2017 14:25:17 +0000 (10:25 -0400)
    Merges in rt45780.

RELNOTES
server/dhcpv6.c

index a82615a0387030f659aeccb34bfe31fbcd3a9693..a31ead987e2f47b39aebdf395dd34a1d1ea02a72 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -183,11 +183,14 @@ dhcp-users@lists.isc.org.
   Correct parsing of DUID from config file, previously the LL type
   was put in the wrong place in the DUID string.
   [ISC-Bugs #20962]
+
   Add code to parse "do-forward-updates" as well as "do-forward-update"
   Thanks to Jiri Popelka at Red Hat.
   [ISC-Bugs #31328]
+
   Remove log_priority as it isn't currently used.
   [ISC-Bugs #33397]
+
   Increase the size of the buffer used for reading interface information.
   [ISC-Bugs #34858]
 
@@ -1126,6 +1129,14 @@ dhcp-users@lists.isc.org.
   Thanks to Tim Dean for reporting this issue.
   [ISC-bugs #31573]
 
+- Corrected an issue where the server would return a client's previously
+  released prefix lease even when the client provides a prefix length
+  hint that does not match the prior lease.  Now the server will only
+  return the previous lease if it exactly matches the hint.  If not
+  it will attempt to allocate a new prefix based on the hint and the
+  prefix-length-mode.
+  [ISC-bugs #45780]
+
                        Changes since 4.2.0 (new features)
 
 - If a client renews before 'dhcp-cache-threshold' percent of its lease
index 2665d0e38b3e51d8ba3a2c2ed79ee0c778dcd626..cc4b17d68d9ed6a1fe1ed65cadbecb85e7305aaf 100644 (file)
@@ -4664,6 +4664,19 @@ find_client_prefix(struct reply_state *reply) {
                        best_prefix = prefix_compare(reply, prefix,
                                                     best_prefix);
                }
+
+               /*
+                * If we have prefix length hint and we're not igoring them,
+                * then toss the best match if it doesn't match the hint,
+                * unless this is in response to a rebind.  In the latter
+                * case we're supposed to return it with zero lifetimes.
+                * (See rt45780) */
+               if (best_prefix && (reply->preflen > 0)
+                   && (prefix_length_mode != PLM_IGNORE)
+                   && (reply->preflen != best_prefix->plen)
+                   && (reply->packet->dhcpv6_msg_type != DHCPV6_REBIND)) {
+                       best_prefix = NULL;
+               }
        }
 
        /* Try to pick a new prefix if we didn't find one, or if we found an