]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
dhclient -6 -1
authorFrancis Dupont <fdupont@isc.org>
Thu, 12 Jun 2008 13:38:41 +0000 (13:38 +0000)
committerFrancis Dupont <fdupont@isc.org>
Thu, 12 Jun 2008 13:38:41 +0000 (13:38 +0000)
RELNOTES
client/dhc6.c
client/dhclient.8

index 56f664ff78a73cf6c7b99cdbfe9f1b3133cb0487..2c83a91b1657833a0668605964139f3eadb49a97 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -91,6 +91,8 @@ work on other platforms. Please report any problems and suggested fixes to
 
 - Fix handling of format code 'Z'.
 
+- Support "-1" argument in DHCPv6.
+
                        Changes since 4.0.0 (new features)
 
 - Added DHCPv6 rapid commit support.
index b8dbdd2852855a30ab08f005a1b29222f18ce44c..b9f79af78abbe2a43c9516f35665dd7b6580c15f 100644 (file)
@@ -110,6 +110,7 @@ static void script_write_params6(struct client_state *client,
                                 struct option_state *options);
 static isc_boolean_t active_prefix(struct client_state *client);
 
+extern int onetry;
 extern int stateless;
 
 /*
@@ -1316,7 +1317,11 @@ start_init6(struct client_state *client)
        client->IRT = SOL_TIMEOUT * 100;
        client->MRT = SOL_MAX_RT * 100;
        client->MRC = 0;
-       client->MRD = 0;
+       /* Default is 0 (no max) but -1 changes this. */
+       if (!onetry)
+               client->MRD = 0;
+       else
+               client->MRD = client->config->timeout;
 
        dhc6_retrans_init(client);
 
@@ -1368,7 +1373,11 @@ start_info_request6(struct client_state *client)
        client->IRT = INF_TIMEOUT * 100;
        client->MRT = INF_MAX_RT * 100;
        client->MRC = 0;
-       client->MRD = 0;
+       /* Default is 0 (no max) but -1 changes this. */
+       if (!onetry)
+               client->MRD = 0;
+       else
+               client->MRD = client->config->timeout;
 
        dhc6_retrans_init(client);
 
@@ -1490,8 +1499,17 @@ do_init6(void *input)
                elapsed.tv_sec -= 1;
                elapsed.tv_usec += 1000000;
        }
+       /* Check if finished (-1 argument). */
        if ((client->MRD != 0) && (elapsed.tv_sec > client->MRD)) {
                log_info("Max retransmission duration exceeded.");
+               client->state = S_STOPPED;
+               if (client->active_lease != NULL) {
+                       dhc6_lease_destroy(&client->active_lease, MDL);
+                       client->active_lease = NULL;
+               }
+               /* Stop if and only if this is the last client. */
+               if (stopping_finished())
+                       exit(2);
                return;
        }
 
@@ -1901,9 +1919,10 @@ do_info_request6(void *input)
                elapsed.tv_sec -= 1;
                elapsed.tv_usec += 1000000;
        }
+       /* Check if finished (-1 argument). */
        if ((client->MRD != 0) && (elapsed.tv_sec > client->MRD)) {
                log_info("Max retransmission duration exceeded.");
-               return;
+               exit(2);
        }
 
        memset(&ds, 0, sizeof(ds));
index 21f7ed275e74986e24bd6cc2b9c6478fc672d549..49c36c440e2b6be5c12d1eb6f2b8831a3f948c10 100644 (file)
@@ -1,4 +1,4 @@
-.\"    $Id: dhclient.8,v 1.28 2008/05/23 13:56:07 fdupont Exp $
+.\"    $Id: dhclient.8,v 1.29 2008/06/12 13:38:41 fdupont Exp $
 .\"
 .\" Copyright (c) 2004,2007-2008 by Internet Systems Consortium, Inc. ("ISC")
 .\" Copyright (c) 1996-2003 by Internet Software Consortium
@@ -294,7 +294,13 @@ at shutdown with the specific reason for calling the script set.
 The
 .B -1
 flag will cause dhclient to try once to get a lease.  If it fails, dhclient
-exits with exit code two.
+exits with exit code two. In DHCPv6 the
+.B -1
+flag sets the max duration of the initial exchange to
+.I timeout
+(from
+.IR dhclient.conf ,
+default sixty seconds).
 .PP
 The DHCP client normally gets its configuration information from
 .B ETCDIR/dhclient.conf,