diff options
author | David Hankins <dhankins@isc.org> | 2007-11-20 21:07:12 +0000 |
---|---|---|
committer | David Hankins <dhankins@isc.org> | 2007-11-20 21:07:12 +0000 |
commit | c0216cb7c9c717a890519ba6294149af412ca766 (patch) | |
tree | 9609bf3c6129ba842c78fe7edff40dbe94b1ea50 | |
parent | b024480eba62d1fbb63770739c0c86cb22df722c (diff) | |
download | isc-dhcp-c0216cb7c9c717a890519ba6294149af412ca766.tar.gz |
- The DHCPv6 client now issues fresh transaction IDs on Renew and Rebind
message exchanges, rather than using the most recent ID. [ISC-Bugs #17300]
-rw-r--r-- | RELNOTES | 3 | ||||
-rw-r--r-- | client/dhc6.c | 47 |
2 files changed, 21 insertions, 29 deletions
@@ -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 diff --git a/client/dhc6.c b/client/dhc6.c index 33a5101e..4001c0eb 100644 --- a/client/dhc6.c +++ b/client/dhc6.c @@ -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; |