Blame SOURCES/dhcp-dhclient_ipv6_prefix.patch

072f0f
diff --git a/client/dhc6.c b/client/dhc6.c
072f0f
index 47bf0a2..6f12a86 100644
072f0f
--- a/client/dhc6.c
072f0f
+++ b/client/dhc6.c
072f0f
@@ -120,6 +120,7 @@ static int check_timing6(struct client_state *client, u_int8_t msg_type,
072f0f
 
072f0f
 extern int onetry;
072f0f
 extern int stateless;
072f0f
+extern int address_prefix_len;
072f0f
 
072f0f
 /*
072f0f
  * The "best" default DUID, since we cannot predict any information
072f0f
@@ -3968,7 +3969,7 @@ dhc6_marshall_values(const char *prefix, struct client_state *client,
072f0f
 			 * some suspect this may not be permanent.
072f0f
 			 */
072f0f
 			client_envadd(client, prefix, "ip6_prefixlen",
072f0f
-				      "%d", 64);
072f0f
+				      "%d", address_prefix_len);
072f0f
 			client_envadd(client, prefix, "ip6_address",
072f0f
 				      "%s", piaddr(addr->address));
072f0f
 		}
072f0f
diff --git a/client/dhclient.c b/client/dhclient.c
072f0f
index f9d0493..d1ab473 100644
072f0f
--- a/client/dhclient.c
072f0f
+++ b/client/dhclient.c
072f0f
@@ -106,6 +106,7 @@ int wanted_ia_na = -1;		/* the absolute value is the real one. */
072f0f
 int wanted_ia_ta = 0;
072f0f
 int wanted_ia_pd = 0;
072f0f
 char *mockup_relay = NULL;
072f0f
+int address_prefix_len = DHCLIENT_DEFAULT_PREFIX_LEN;
072f0f
 int bootp_broadcast_always = 0;
072f0f
 
072f0f
 extern struct option *default_requested_options[];
072f0f
@@ -288,6 +289,15 @@ main(int argc, char **argv) {
072f0f
 			tmp->next = client_env;
072f0f
 			client_env = tmp;
072f0f
 			client_env_count++;
072f0f
+		} else if (!strcmp(argv[i], "--address-prefix-len")) {
072f0f
+			if (++i == argc) {
072f0f
+				usage();
072f0f
+			}
072f0f
+			errno = 0;
072f0f
+			address_prefix_len = (int)strtol(argv[i], &s, 10);
072f0f
+			if (errno || (*s != '\0') ||
072f0f
+			    (address_prefix_len < 0)) {
072f0f
+				usage();			}
072f0f
 #ifdef DHCPv6
072f0f
 		} else if (!strcmp(argv[i], "-S")) {
072f0f
 			if (local_family_set && (local_family == AF_INET)) {
072f0f
@@ -1127,6 +1137,7 @@ static void usage()
072f0f
 		  "[-4|-6] [-SNTPI1dvrxc] [-nw] [-p <port>] [-D LL|LLT] \n"
072f0f
 #else /* DHCPv6 */
072f0f
 		  "[-C1dvrxc] [-nw] [-p <port>] [-D LL|LLT] \n"
072f0f
+                  "                [--address-prefix-len length]\n"
072f0f
 #endif /* DHCPv6 */
072f0f
 		  "                [-s server-addr] [-cf config-file] "
072f0f
 		  "[-lf lease-file]\n"
072f0f
diff --git a/includes/site.h b/includes/site.h
072f0f
index 1c7ec96..c87cfe9 100644
072f0f
--- a/includes/site.h
072f0f
+++ b/includes/site.h
072f0f
@@ -295,3 +295,12 @@
072f0f
    up. */
072f0f
 #define DDNS_UPDATE_SLOW_TRANSITION
072f0f
    
072f0f
+/* Define the default prefix length passed from the client to
072f0f
+   the script when modifying an IPv6 IA_NA or IA_TA address.
072f0f
+   The two most useful values are 128 which is what the current
072f0f
+   specifications call for or 64 which is what has been used in
072f0f
+   the past.  For most OSes 128 will indicate that the address
072f0f
+   is a host address and doesn't include any on-link information.
072f0f
+   64 indicates that the first 64 bits are the subnet or on-link
072f0f
+   prefix. */
072f0f
+#define DHCLIENT_DEFAULT_PREFIX_LEN 128