Blame SOURCES/dhcp-4.2.4-P1-interval.patch

c8bb8f
diff -up dhcp-4.2.4/common/dispatch.c.foo dhcp-4.2.4/common/dispatch.c
c8bb8f
--- dhcp-4.2.4/common/dispatch.c.foo	2012-07-26 21:31:43.875349675 -0500
c8bb8f
+++ dhcp-4.2.4/common/dispatch.c	2012-07-26 21:39:14.961710319 -0500
c8bb8f
@@ -324,7 +324,20 @@ void add_timeout (when, where, what, ref
c8bb8f
 	q->next  = timeouts;
c8bb8f
 	timeouts = q;
c8bb8f
 
c8bb8f
-	isc_interval_set(&interval, sec & DHCP_SEC_MAX, usec * 1000);
c8bb8f
+	/* isc_time_nowplusinterval() is not safe with 64-bit time_t and will
c8bb8f
+	 * return an error for sufficiently large intervals.  We have to limit
c8bb8f
+	 * the interval to INT_MAX or less to ensure the interval doesn't
c8bb8f
+	 * overflow 32 bits, since the returned isc_time_t fields are
c8bb8f
+	 * 32-bit unsigned ints.
c8bb8f
+	 *
c8bb8f
+	 * HACK: The 9 is a magic number of seconds, since some time may have
c8bb8f
+	 * gone by since the last call to gettimeofday() and the one in
c8bb8f
+	 * isc_time_nowplusinterval().
c8bb8f
+	 */
c8bb8f
+	if (sec > TIME_MAX)
c8bb8f
+		sec = TIME_MAX - 9;
c8bb8f
+
c8bb8f
+	isc_interval_set(&interval, sec, usec * 1000);
c8bb8f
 	status = isc_time_nowplusinterval(&expires, &interval);
c8bb8f
 	if (status != ISC_R_SUCCESS) {
c8bb8f
 		/*