Blame SOURCES/dhcp-4.2.1-retransmission.patch

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