Comment 26 for bug 1189571

Revision history for this message
In , Jiri (jiri-redhat-bugs) wrote :

Created attachment 562491
Provisional patch

I hopefully localized the problem and have a patch.
I locally built the packages but don't know if it's safe tu upload them (not the srpm of course) to a public site like http://jpopelka.fedorapeople.org so John can test them.
Meanwhile there's only the patched dhcpd binary http://jpopelka.fedorapeople.org/789601/dhcpd

Some comment what's (I think) going on is in the patch.
The core fix with comment should be:

dhcp-4.2.3-P2/common/dispatch.c
@@ -246,26 +246,40 @@ void add_timeout (when, where, what, ref
   * the working code use the same values.
   */

+ /*
+ * We need to reduce (to 2^^32-1) the absolute time from an epoch
+ * (i.e. value of when->tv_sec) and not the relative time (value of
+ * sec variable).
+ * In other words, we have to make sure that once the
+ * isc_time_nowplusinterval() adds current time to the given relative
+ * time the result will be less than 2^^32-1.
+ */
+ if (when->tv_sec > DHCP_SEC_MAX) {
+ log_error("Timeout requested too large "
+ "reducing to 2^^32-10");
+ /*
+ * HACK: 9 is some magic number of seconds
+ * because some time goes by between the last call of gettimeofday()
+ * and the one in isc_time_nowplusinterval()
+ * I'm sure the ISC guys will figure out something better ;-)
+ */
+ when->tv_sec = DHCP_SEC_MAX - 9;
+ }
  sec = when->tv_sec - cur_tv.tv_sec;
  usec = when->tv_usec - cur_tv.tv_usec;