2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-22 18:07:25 +00:00

[master] Update client code to RFC7550

Update the v6 client code to handle getting
IA_NAs and IA_PDs in the same request better.

Squashed commit of the following:

commit ad1bf23100eba541c26c6c26fc2c5c9dc57dd674
Author: Shawn Routhier <sar@isc.org>
Date:   Mon Nov 16 23:08:13 2015 -0800

    [rt40190] Use dhc6_check_status for addresses and prefixes

commit 4cb1d499342e68c5c93b7e8dac71c9adbd737846
Author: Shawn Routhier <sar@isc.org>
Date:   Mon Nov 16 22:02:05 2015 -0800

    [rt40190] Correct the tests for a status code in the client

    Some of the tests for the NoAddrs or NoPrefix codes in the
    were incorrect, checking for a return of not success instead
    of success.

commit 41ad9ea4438c0f64b95ec7afeac38afd2f3b36cb
Author: Shawn Routhier <sar@isc.org>
Date:   Fri Nov 13 21:04:55 2015 -0800

    [rt40190] Update site.h to have the correct default

commit cb720dac6670e1a6cc19b22550506ded4093abef
Author: Shawn Routhier <sar@isc.org>
Date:   Fri Nov 13 21:03:38 2015 -0800

    [rt40190] update per second set of review comments

    Mostly this is a set of updates to the documentation.
    The only code change is to add a backwards compatibility
    option in includes/site.h for people who want the old weightings
    for the client lease scoring.

commit 269a5324b950062380b4e3988f56593dc21d05d9
Author: Thomas Markwalder <tmark@isc.org>
Date:   Thu Nov 12 09:00:36 2015 -0500

    [40190] Fixed another typo

commit 7da158497cd9236c30dfdce2b115818d1954839f
Author: Thomas Markwalder <tmark@isc.org>
Date:   Thu Nov 12 07:29:33 2015 -0500

    [40190] Minor cosmetics in dhc6.c

commit a010737de36e5ad2f46bb11f471ac66ccbc856aa
Author: Shawn Routhier <sar@isc.org>
Date:   Sat Nov 7 00:05:20 2015 -0800

    [rt40190] Update the use of the minimum score

    Update the use of the minimum score to use #defines instead
    of 150.  This corrects it for the current values and allows
    us to change the values if we include a backwards compatibility
    option.

commit b078575da08c06a75a49110273bf42e24d03c08a
Author: Shawn Routhier <sar@isc.org>
Date:   Fri Nov 6 21:55:05 2015 -0800

    [rt40190] Updates per review comments

    Update several comments to be more informative

    The code changes are mostly to fold all the two
    bare_ia routines together.

commit 248c498d45db5533f992fb6eb30ee6c3c399ee81
Author: Shawn Routhier <sar@isc.org>
Date:   Tue Oct 20 02:06:45 2015 -0700

    [rt40190] Fix up some typos

commit ba074eff2e82af0cfd25428e7f38bccd5fef7241
Author: Shawn Routhier <sar@isc.org>
Date:   Tue Oct 20 01:28:34 2015 -0700

    [rt40190] Patch for client side of 7550

    Finish up the code to handle multiple PDs and NAs
    in a single request, this includes updating the
    command line to add the -R option to require the
    requested IAs rather than accept the best advertised
    offer.

commit 5bb4368b8410e3c7bcdc28fdf4ae5572df04d03b
Author: Shawn Routhier <sar@isc.org>
Date:   Thu Oct 15 09:50:14 2015 -0700

    [rt40190] checkpoint my work

    The basic code is working there are still some issues with how
    corner cases get handled that I need to resolve

commit 4c0dba90fcd71c85fca3612aa5083fa11645f8f6
Author: Shawn Routhier <sar@isc.org>
Date:   Sun Oct 11 19:23:53 2015 -0700

    [rt40190] Some changes for rfc7550, to be updated

    This is being checked in so I can look at other tickets
    but I plan to re-arrange the code a fair amount.
This commit is contained in:
Shawn Routhier 2015-12-01 21:58:36 -08:00
parent 7acd875396
commit c88dfebddd
7 changed files with 761 additions and 185 deletions

View File

@ -121,6 +121,10 @@ by Eric Young (eay@cryptsoft.com).
compile DHCP and its bind library dependency).
[ISC-Bugs #38836]
- Update the client code to better support getting IA_NAs and IA_PDs
in the same packet, see RFC7550 for some discussion.
[ISC-Bugs #40190]
Changes since 4.3.3b1
- None

File diff suppressed because it is too large Load Diff

View File

@ -55,6 +55,8 @@ dhclient - Dynamic Host Configuration Protocol Client
.B -P...
]
]
.B -R
]
[
.B -i
]
@ -364,8 +366,21 @@ See \fB\-N\fR to restore it.
.BI \-P
Enable IPv6 prefix delegation. This implies \fB\-6\fR and also
disables the normal address query. See \fB\-N\fR to restore it.
Multiple prefixes can be requested with multiple \fB\-P\fR flags.
Note only one requested interface is allowed.
.TP
.BI \-R
Require that responses include all of the items requested by any
\fB\-N\fR, \fB\-T\fR, or \fB\-P\fR options. Normally even if
the command line includes a number of these the client will be willing
to accept the best lease it can even if the lease doesn't include all
of the requested items. This option causes the client to only
accept leases that include all of the requested items.
Note well: enabling this may prevent the client from using any
leases it receives if the servers aren't configured to supply
all of the items.
.TP
.BI \-D \ LL\ or\ LLT
Override the default when selecting the type of DUID to use. By default,
DHCPv6 \fBdhclient\fR creates an identifier based on the link-layer address
@ -381,6 +396,7 @@ overrides these default, with a value of either \fILL\fR or \fILLT\fR.
.\" TODO: is this for telling an already running dhclient?
Restore normal address query for IPv6. This implies \fB-6\fR.
It is used to restore normal operation after using \fB-T\fR or \fB-P\fR.
Multiple addresses can be requested with multiple \fB\-N\fR flags.
.PP
.I Modifying default file locations:
The following options can be used to modify the locations a client uses

View File

@ -88,6 +88,9 @@ int stateless = 0;
int wanted_ia_na = -1; /* the absolute value is the real one. */
int wanted_ia_ta = 0;
int wanted_ia_pd = 0;
int require_all_ias = 0; /* If the user requires all of the IAs to
be available before accepting a lease
0 = no, 1 = requries */
char *mockup_relay = NULL;
char *progname = NULL;
@ -308,6 +311,13 @@ main(int argc, char **argv) {
wanted_ia_na = 0;
}
wanted_ia_pd++;
} else if (!strcmp(argv[i], "-R")) {
if (local_family_set && (local_family == AF_INET)) {
usage();
}
local_family_set = 1;
local_family = AF_INET6;
require_all_ias = 1;
#endif /* DHCPv6 */
} else if (!strcmp(argv[i], "-D")) {
duid_v4 = 1;
@ -761,7 +771,7 @@ static void usage()
log_fatal("Usage: %s "
#ifdef DHCPv6
"[-4|-6] [-SNTPI1dvrxi] [-nw] [-p <port>] [-D LL|LLT] \n"
"[-4|-6] [-SNTPRI1dvrxi] [-nw] [-p <port>] [-D LL|LLT] \n"
#else /* DHCPv6 */
"[-I1dvrxi] [-nw] [-p <port>] [-D LL|LLT] \n"
#endif /* DHCPv6 */

View File

@ -55,16 +55,15 @@ reasonable timing behaviour will be used by default - one which
results in fairly timely updates without placing an inordinate load on
the server.
.PP
The following statements can be used to adjust the timing behaviour of
the DHCP client if required, however:
If required the following statements can be used to adjust the timing
behaviour of the DHCPv4 client. The DHCPv6 protocol provides values
to use and they are not currently configurable.
.PP
.I The
.B timeout
.I statement
.PP
.B timeout
.I time
.B ;
\fBtimeout \fItime\fR\fB;\fR
.PP
The
.I timeout
@ -176,6 +175,37 @@ client used to wait random time up to 5 seconds, but that was unwanted
due to impact on startup time. As such, new versions have the default
initial delay set to 0. To restore old behavior, please set initial-delay
to 5.
.SH DHCPv6 LEASE SELECTION
In the DHCPv6 protocol the client will wait a small amount of time to
allow ADVERTISE messages from multiple servers to arrive. It will then
need to choose from all of the messages that may have arrived before
proceeding to making a request of the selected server.
The first selection criteria is the set of options and addresses
in the message. Messages that don't include an option specified
as required will be given a score of 0 and not used. If the
\fI-R\fR option is given on the command line then messages that
don't include the correct number of bindings (IA-NA, IA-TA or
IA-PD) will be discarded.
The next criteria is the preference value from the message. With
the highest preference value being used even if leases with better
addresses or options are available.
Finally the lease is scored and the lease with the highest score
is selected. A lease's score is based on the number of bindings,
number of addresses and number of options it contains:
.nf
bindings * X + addresses * Y + options
.fi
By default X = 10000 and Y = 100, this will cause the client to
select a lease with more bindings over a lease with less bindings
but more addresses. The weightings were changed as part of
implementing RFC 7550. Previously they were X = 50 and Y = 100
meaning more addresses were preferred over more bindings. If
you wish to continue using the old style you may do so by editing
the file includes/site.h and uncommenting the define for
USE_ORIGINAL_CLIENT_LEASE_WEIGHTS.
.SH LEASE REQUIREMENTS AND REQUESTS
The DHCP protocol allows the client to request that the server send it
specific information, and not send it other information that it is not

View File

@ -2863,6 +2863,7 @@ extern int nowait;
extern int wanted_ia_na;
extern int wanted_ia_ta;
extern int wanted_ia_pd;
extern int require_all_ias;
extern const char *path_dhclient_conf;
extern const char *path_dhclient_db;

View File

@ -298,6 +298,13 @@
this option will be removed at some time. */
/* #define INCLUDE_OLD_DHCP_ISC_ERROR_CODES */
/* Use the older factors for scoring a lease in the v6 client code.
The new factors cause the client to choose more bindings (IAs)
over more addresse within a binding. Most uses will get a
single address in a single binding and only get an adverstise
from a single server and there won't be a difference. */
/* #define USE_ORIGINAL_CLIENT_LEASE_WEIGHTS */
/* Include definitions for various options. In general these
should be left as is, but if you have already defined one
of these and prefer your definition you can comment the