Date: Wed, 23 Apr 2025 04:51:38 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 283256] CLOCK_MONOTONIC in dhclient Message-ID: <bug-283256-227-q2LuvyyrV4@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-283256-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | previous in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283256 --- Comment #6 from commit-hook@FreeBSD.org --- A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c8c624de57b072d14c1ab23167880a069ef51f11 commit c8c624de57b072d14c1ab23167880a069ef51f11 Author: Colin Percival <cperciva@FreeBSD.org> AuthorDate: 2025-04-08 22:50:01 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2025-04-23 04:50:55 +0000 dhclient: Keep two clocks Until July 2024, dhclient kept track of time as seconds-since-epoch as a time_t. This was a problem because (a) we wanted sub-second timeouts and (b) timeouts didn't always do the right thing if the system clock changed. Switching to using CLOCK_MONOTONIC and struct timespec fixed those issues but introduced a new problem: CLOCK_MONOTONIC values were being intepreted as seconds-since-epoch and written to the dhclient.leases file, causing confusion with DHCP leases expiring in early 1970. Attempt to compromise between these by keeping track of both times; any type within dhclient which is a time_t now refers to seconds past the epoch, while any struct timespec value is a CLOCK_MONOTONIC time. PR: 283256 Reviewed by: dch Fixes: f0a38976b01e ("dhclient: Use clock_gettime() instead of time()") Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D49720 (cherry picked from commit 43d19e6a4c42ade0f276ceca18a09e2e3829fce4) sbin/dhclient/dhclient.c | 50 +++++++++++++++++++++--------------------------- sbin/dhclient/dhcpd.h | 4 ++-- sbin/dhclient/dispatch.c | 14 +++++++++----- 3 files changed, 33 insertions(+), 35 deletions(-) -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-283256-227-q2LuvyyrV4>
