dhcp/dhcp-4.2.0-retransmission.patch
2010-07-21 16:56:35 +00:00

76 lines
2.6 KiB
Diff

diff -up dhcp-4.2.0/client/dhc6.c.retransmission dhcp-4.2.0/client/dhc6.c
--- dhcp-4.2.0/client/dhc6.c.retransmission 2010-07-21 16:18:51.000000000 +0200
+++ dhcp-4.2.0/client/dhc6.c 2010-07-21 16:19:52.000000000 +0200
@@ -357,7 +357,7 @@ dhc6_retrans_init(struct client_state *c
static void
dhc6_retrans_advance(struct client_state *client)
{
- struct timeval elapsed;
+ struct timeval elapsed, elapsed_after_RT;
/* elapsed = cur - start */
elapsed.tv_sec = cur_tv.tv_sec - client->start_time.tv_sec;
@@ -374,6 +374,8 @@ dhc6_retrans_advance(struct client_state
elapsed.tv_sec += 1;
elapsed.tv_usec -= 1000000;
}
+ elapsed_after_RT.tv_sec = elapsed.tv_sec;
+ elapsed_after_RT.tv_usec = elapsed.tv_usec;
/*
* RT for each subsequent message transmission is based on the previous
@@ -411,13 +413,10 @@ dhc6_retrans_advance(struct client_state
elapsed.tv_usec -= 1000000;
}
if (elapsed.tv_sec >= client->MRD) {
- /*
- * wake at RT + cur = start + MRD
- */
- client->RT = client->MRD +
- (client->start_time.tv_sec - cur_tv.tv_sec);
- client->RT = client->RT * 100 +
- (client->start_time.tv_usec - cur_tv.tv_usec) / 10000;
+ client->RT = client->MRD - elapsed_after_RT.tv_sec;
+ client->RT = client->RT * 100 - elapsed_after_RT.tv_usec / 10000;
+ if (client->RT < 0)
+ client->RT = 0;
}
client->txcount++;
}
@@ -1505,7 +1504,7 @@ do_init6(void *input)
elapsed.tv_usec += 1000000;
}
/* Check if finished (-1 argument). */
- if ((client->MRD != 0) && (elapsed.tv_sec > client->MRD)) {
+ if ((client->MRD != 0) && (elapsed.tv_sec >= client->MRD)) {
log_info("Max retransmission duration exceeded.");
client->state = S_STOPPED;
if (client->active_lease != NULL) {
@@ -1925,7 +1924,7 @@ do_info_request6(void *input)
elapsed.tv_usec += 1000000;
}
/* Check if finished (-1 argument). */
- if ((client->MRD != 0) && (elapsed.tv_sec > client->MRD)) {
+ if ((client->MRD != 0) && (elapsed.tv_sec >= client->MRD)) {
log_info("Max retransmission duration exceeded.");
exit(2);
}
@@ -2046,7 +2045,7 @@ do_confirm6(void *input)
elapsed.tv_sec -= 1;
elapsed.tv_usec += 1000000;
}
- if ((client->MRD != 0) && (elapsed.tv_sec > client->MRD)) {
+ if ((client->MRD != 0) && (elapsed.tv_sec >= client->MRD)) {
log_info("Max retransmission duration exceeded.");
start_bound(client);
return;
@@ -3293,7 +3292,7 @@ do_select6(void *input)
elapsed.tv_sec -= 1;
elapsed.tv_usec += 1000000;
}
- if ((client->MRD != 0) && (elapsed.tv_sec > client->MRD)) {
+ if ((client->MRD != 0) && (elapsed.tv_sec >= client->MRD)) {
log_info("Max retransmission duration exceeded.");
abort = ISC_TRUE;
}