]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[master] Changes DHCLIENT_DEFAULT_PREFIX_LEN to 128, adds --address-prefix-len to...
authorThomas Markwalder <tmark@isc.org>
Mon, 11 Dec 2017 14:19:54 +0000 (09:19 -0500)
committerThomas Markwalder <tmark@isc.org>
Mon, 11 Dec 2017 14:19:54 +0000 (09:19 -0500)
    Merges in rt23252.

RELNOTES
client/dhc6.c
client/dhclient.c
includes/site.h

index 426492069c56420f0c889c2ec405576dc571d221..42e1fa750bf46812d5cafd55d8040f04bddc565f 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -303,6 +303,15 @@ dhcp-users@lists.isc.org.
   leases file.  Default is true.
   [ISC-Bugs #45046]
 
+- Changed the default value of the prefix length passed by dhclient into the
+  client script for each IPv6 address, from 64 to 128. In addition, dhclient
+  now supports a command line argument, --address-prefix-len <len>, which may
+  be used to override the default value.  PLEASE NOTE: If your DHCPv6 clients
+  require a value other than 128, you MUST specify the value via this new
+  command line argument.  Prior to this the only way to alter the value was at
+  compile time by changing DHCLIENT_DEFAULT_PREFIX_LEN in include/sites.h.
+  [ISC-Bugs #23252]
+
                        Changes since 4.3.0 (bug fixes)
 
 - Tidy up several small tickets.
index 357b40e953fb16b9b990efc11ccdc106a9678239..e0d052e572dee0fbf2d25187788f1ee9dcb9178a 100644 (file)
@@ -154,7 +154,7 @@ static int drop_declined_addrs(struct dhc6_lease *lease);
 extern int onetry;
 extern int stateless;
 extern int prefix_len_hint;
-
+extern int address_prefix_len;
 
 /*
  * Assign DHCPv6 port numbers as a client.
@@ -4434,7 +4434,7 @@ dhc6_marshall_values(const char *prefix, struct client_state *client,
                                      (unsigned) addr->plen);
                } else {
                        client_envadd(client, prefix, "ip6_prefixlen",
-                                     "%d", DHCLIENT_DEFAULT_PREFIX_LEN);
+                                     "%d", address_prefix_len);
                        client_envadd(client, prefix, "ip6_address",
                                      "%s", piaddr(addr->address));
                }
index 94dfbd9177aec70ce8f5375ece5b805c4f2289ac..55e1c61c333fcc3ea0b27bc6d08b2230ab8d54f5 100644 (file)
@@ -105,6 +105,7 @@ int dad_wait_time = 0;
 int prefix_len_hint = 0;
 #endif
 
+int address_prefix_len = DHCLIENT_DEFAULT_PREFIX_LEN;
 char *mockup_relay = NULL;
 
 char *progname = NULL;
@@ -163,12 +164,14 @@ static const char use_v6command[] = "Command not used for DHCPv4: %s";
 #define DHCLIENT_USAGE0 \
 "[-4|-6] [-SNTPRI1dvrxi] [-nw] -4o6 <port>] [-p <port>] [-D LL|LLT]\n" \
 "                [--dad-wait-time <seconds>] [--prefix-len-hint <length>]\n" \
-"                [--decline-wait-time <seconds>]\n"
+"                [--decline-wait-time <seconds>]\n" \
+"                [--address-prefix-len length]\n"
 #else /* DHCP4o6 */
 #define DHCLIENT_USAGE0 \
 "[-4|-6] [-SNTPRI1dvrxi] [-nw] [-p <port>] [-D LL|LLT]\n" \
 "                [--dad-wait-time <seconds>] [--prefix-len-hint <length>]\n" \
-"                [--decline-wait-time <seconds>]\n"
+"                [--decline-wait-time <seconds>]\n" \
+"                [--address-prefix-len length]\n"
 #endif
 #else /* DHCPv6 */
 #define DHCLIENT_USAGE0 \
@@ -495,7 +498,6 @@ main(int argc, char **argv) {
                        if (++i == argc) {
                                usage(use_noarg, argv[i-1]);
                        }
-
                        errno = 0;
                        dad_wait_time = (int)strtol(argv[i], &s, 10);
                        if (errno || (*s != '\0') || (dad_wait_time < 0)) {
@@ -513,6 +515,17 @@ main(int argc, char **argv) {
                                usage("Invalid value for --prefix-len-hint: %s",
                                      argv[i]);
                        }
+               } else if (!strcmp(argv[i], "--address-prefix-len")) {
+                       if (++i == argc) {
+                               usage(use_noarg, argv[i-1]);
+                       }
+                       errno = 0;
+                       address_prefix_len = (int)strtol(argv[i], &s, 10);
+                       if (errno || (*s != '\0') ||
+                           (address_prefix_len < 0)) {
+                               usage("Invalid value for"
+                                     " --address-prefix-len: %s", argv[i]);
+                       }
 #endif /* DHCPv6 */
                } else if (!strcmp(argv[i], "--decline-wait-time")) {
                        if (++i == argc) {
index 461eaccf16aca05678d45a4fc732ec08995cea2b..d9c1494b17ab0c8f5acc696abc7ee0dea6d240e4 100644 (file)
    is a host address and doesn't include any on-link information.
    64 indicates that the first 64 bits are the subnet or on-link
    prefix. */
-#define DHCLIENT_DEFAULT_PREFIX_LEN 64
+#define DHCLIENT_DEFAULT_PREFIX_LEN 128
 
 /* Enable the gentle shutdown signal handling.  Currently this
    means that on SIGINT or SIGTERM a client will release its