dhclient doen't renew a lease on raspberry pi

Bug #1695702 reported by Takakazu Satoh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
isc-dhcp (Ubuntu)
New
Undecided
Unassigned

Bug Description

OS version: Ubuntu MATE 16.04 armhf
HW: raspberry pi 3B WITHOUT a battery backed up RTC
package verison: isc-dhcp-client 4.3.3-5ubuntu12.6

How to reproduce this bug: Power off a raspberry pi machine (without a battery backed up RTC: this is default)
longer than DCHP lease time. Then power it on. Then, DHCP lease is not renewed.

Work around: After correct date is set (by NTP or manually), reboot again.

Cause of the bug: Right after boot, Rapsberry pi (without a battery backed up RTC) uses the last shutdown time as a current time. When dhclient obtains a DHCP lease, it sets a renewal time to the incorrect current time plus renewal time and set an interval timer (which is maintained by relative time). Sooner or later, the system gets correct time from NTP and the system current time jumps. When the interval timer expires, dhclient first compares current time (which is now correct) and the lease expire time (which is computed based on incrrect time) and shifts to the state EXPIRED. Cf. functions bind_lease() and state_bound() in dhclient.c

Somehow, I cannot build dhclient from the source code obtained by apt-get source.
However, I could build dhclient (4.3.5) from a tarball from ISC website and the same problem occurred.
I modified some source files:
   use clock_gettime(CLOCK_BOOTTIME, *) instead of gettimeofday in appropriate places
   modify lease file read/write functions to convert time from boot to (possibly incorrect) time in GMT.
With the modifed dhclient, dhcp leases are correctly renewed on my machines, so far.
I use IPV4 over ethernet only and I have no idea what to do with tr.c (functions for token ring) which calls gettimeofday.
But if I understand correctly, I believe mixture use of absolute times and relative times is responsible for the bug.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.