]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/blob - dhcp/patches/0027-dhcp-interval.patch
dhcp: Update to 4.3.5b1
[people/arne_f/ipfire-3.x.git] / dhcp / patches / 0027-dhcp-interval.patch
1 diff -up dhcp-4.3.0a1/common/dispatch.c.interval dhcp-4.3.0a1/common/dispatch.c
2 --- dhcp-4.3.0a1/common/dispatch.c.interval 2013-12-20 13:51:14.385260622 +0100
3 +++ dhcp-4.3.0a1/common/dispatch.c 2013-12-20 13:51:14.493259116 +0100
4 @@ -343,7 +343,20 @@ void add_timeout (when, where, what, ref
5 q->next = timeouts;
6 timeouts = q;
7
8 - isc_interval_set(&interval, sec & DHCP_SEC_MAX, usec * 1000);
9 + /* isc_time_nowplusinterval() is not safe with 64-bit time_t and will
10 + * return an error for sufficiently large intervals. We have to limit
11 + * the interval to INT_MAX or less to ensure the interval doesn't
12 + * overflow 32 bits, since the returned isc_time_t fields are
13 + * 32-bit unsigned ints.
14 + *
15 + * HACK: The 9 is a magic number of seconds, since some time may have
16 + * gone by since the last call to gettimeofday() and the one in
17 + * isc_time_nowplusinterval().
18 + */
19 + if (sec > TIME_MAX)
20 + sec = TIME_MAX - 9;
21 +
22 + isc_interval_set(&interval, sec, usec * 1000);
23 status = isc_time_nowplusinterval(&expires, &interval);
24 if (status != ISC_R_SUCCESS) {
25 /*