Blame SOURCES/dhcp-dhclient_ipv6_prefix.patch

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