]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- The DHCPv6 client now issues fresh transaction IDs on Renew and Rebind
authorDavid Hankins <dhankins@isc.org>
Tue, 20 Nov 2007 21:07:12 +0000 (21:07 +0000)
committerDavid Hankins <dhankins@isc.org>
Tue, 20 Nov 2007 21:07:12 +0000 (21:07 +0000)
  message exchanges, rather than using the most recent ID.  [ISC-Bugs #17300]

RELNOTES
client/dhc6.c

index 28a531bcab8c2b4547624bde73b2fc18476299e6..c74be7d15051ec4ec308ac5fc799bbd380e573c3 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -69,6 +69,9 @@ suggested fixes to <dhcp-users@isc.org>.
   address per IA by default, which can be adjusted through the
   "limit-addrs-per-ia" configuration option.
 
+- The DHCPv6 client now issues fresh transaction IDs on Renew and Rebind
+  message exchanges, rather than using the most recent ID.
+
                        Changes since 4.0.0b2
 
 - Clarified error message when lease limit exceeded
index 33a5101e8bf7d44ccb4ef9e8c5151347ccd83870..4001c0eb72a9c37ef73188fd776f2a2bd00fb174 100644 (file)
@@ -249,33 +249,34 @@ dhc6_rand(TIME base)
        return rval;
 }
 
-/* Get a new dhcpv6_transaction_id and store it to the client state. */
+/* Initialize message exchange timers (set RT from Initial-RT). */
 static void
-dhc6_new_xid(struct client_state *client)
+dhc6_retrans_init(struct client_state *client)
 {
        int xid;
 
-       if (RAND_MAX >= 0x00ffffff)
-               xid = random();
-       else if (RAND_MAX >= 0x0000ffff)
-               xid = (random() << 16) | random();
-       else
-               xid = (random() << 24) | (random() << 16) | random();
+       /* Initialize timers. */
+       client->start_time = cur_time;
+       client->txcount = 0;
+       client->RT = client->IRT + dhc6_rand(client->IRT);
+
+       /* Generate a new random 24-bit transaction ID for this exchange. */
+
+#if (RAND_MAX >= 0x00ffffff)
+       xid = random();
+#elif (RAND_MAX >= 0x0000ffff)
+       xid = (random() << 16) ^ random();
+#elif (RAND_MAX >= 0x000000ff)
+       xid = (random() << 16) ^ (random() << 8) ^ random();
+#else
+# error "Random number generator of less than 8 bits not supported."
+#endif
 
        client->dhcpv6_transaction_id[0] = (xid >> 16) & 0xff;
        client->dhcpv6_transaction_id[1] = (xid >>  8) & 0xff;
        client->dhcpv6_transaction_id[2] =  xid        & 0xff;
 }
 
-/* Set RT from initial RT. */
-static void
-dhc6_retrans_init(struct client_state *client)
-{
-       client->start_time = cur_time;
-       client->txcount = 0;
-       client->RT = client->IRT + dhc6_rand(client->IRT);
-}
-
 /* Advance the DHCPv6 retransmission state once. */
 static void
 dhc6_retrans_advance(struct client_state *client)
@@ -857,9 +858,6 @@ start_init6(struct client_state *client)
        log_debug("PRC: Soliciting for leases (INIT).");
        client->state = S_INIT;
 
-       /* Fetch a 24-bit transaction ID. */
-       dhc6_new_xid(client);
-
        /* Initialize timers, RFC3315 section 17.1.2. */
        client->IRT = SOL_TIMEOUT;
        client->MRT = SOL_MAX_RT;
@@ -904,9 +902,6 @@ start_confirm6(struct client_state *client)
        log_debug("PRC: Confirming active lease (INIT-REBOOT).");
        client->state = S_REBOOTING;
 
-       /* Fetch a 24-bit transaction ID. */
-       dhc6_new_xid(client);
-
        /* Initialize timers, RFC3315 section 17.1.3. */
        client->IRT = CNF_TIMEOUT;
        client->MRT = CNF_MAX_RT;
@@ -1210,9 +1205,6 @@ start_release6(struct client_state *client)
          */
         unconfigure6(client, "RELEASE6");
 
-       /* Fetch a 24-bit transaction ID. */
-       dhc6_new_xid(client);
-
        /* Set timers per RFC3315 section 18.1.1. */
        client->IRT = REL_TIMEOUT;
        client->MRT = 0;
@@ -1983,9 +1975,6 @@ start_selecting6(struct client_state *client)
 
        client->selected_lease = lease;
 
-       /* Fetch a 24-bit transaction ID. */
-       dhc6_new_xid(client);
-
        /* Set timers per RFC3315 section 18.1.1. */
        client->IRT = REQ_TIMEOUT;
        client->MRT = REQ_MAX_RT;