Blame SOURCES/dhcp-4.2.1-retransmission.patch

54343e
diff -up dhcp-4.2.1b1/client/dhc6.c.retransmission dhcp-4.2.1b1/client/dhc6.c
54343e
--- dhcp-4.2.1b1/client/dhc6.c.retransmission	2011-01-28 08:40:56.000000000 +0100
54343e
+++ dhcp-4.2.1b1/client/dhc6.c	2011-01-28 08:39:22.000000000 +0100
54343e
@@ -361,7 +361,7 @@ dhc6_retrans_init(struct client_state *c
54343e
 static void
54343e
 dhc6_retrans_advance(struct client_state *client)
54343e
 {
54343e
-	struct timeval elapsed;
54343e
+	struct timeval elapsed, elapsed_after_RT;
54343e
 
54343e
 	/* elapsed = cur - start */
54343e
 	elapsed.tv_sec = cur_tv.tv_sec - client->start_time.tv_sec;
54343e
@@ -378,6 +378,8 @@ dhc6_retrans_advance(struct client_state
54343e
 		elapsed.tv_sec += 1;
54343e
 		elapsed.tv_usec -= 1000000;
54343e
 	}
54343e
+	elapsed_after_RT.tv_sec = elapsed.tv_sec;
54343e
+	elapsed_after_RT.tv_usec = elapsed.tv_usec;
54343e
 
54343e
 	/*
54343e
 	 * RT for each subsequent message transmission is based on the previous
54343e
@@ -415,13 +417,10 @@ dhc6_retrans_advance(struct client_state
54343e
 		elapsed.tv_usec -= 1000000;
54343e
 	}
54343e
 	if (elapsed.tv_sec >= client->MRD) {
54343e
-		/*
54343e
-		 * wake at RT + cur = start + MRD
54343e
-		 */
54343e
-		client->RT = client->MRD +
54343e
-			(client->start_time.tv_sec - cur_tv.tv_sec);
54343e
-		client->RT = client->RT * 100 +
54343e
-			(client->start_time.tv_usec - cur_tv.tv_usec) / 10000;
54343e
+		client->RT = client->MRD - elapsed_after_RT.tv_sec;
54343e
+		client->RT = client->RT * 100 - elapsed_after_RT.tv_usec / 10000;
54343e
+		if (client->RT < 0)
54343e
+			client->RT = 0;
54343e
 	}
54343e
 	client->txcount++;
54343e
 }
54343e
@@ -1497,7 +1496,7 @@ check_timing6 (struct client_state *clie
54343e
 	}
54343e
 
54343e
 	/* Check if finished (-1 argument). */
54343e
-	if ((client->MRD != 0) && (elapsed.tv_sec > client->MRD)) {
54343e
+	if ((client->MRD != 0) && (elapsed.tv_sec >= client->MRD)) {
54343e
 		log_info("Max retransmission duration exceeded.");
54343e
 		return(CHK_TIM_MRD_EXCEEDED);
54343e
 	}