]> git.ipfire.org Git - thirdparty/chrony.git/commit
refclock: rework update of reachability again
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 11 Aug 2025 14:13:20 +0000 (16:13 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 14 Aug 2025 12:25:38 +0000 (14:25 +0200)
commit51d161a0283aa6133931dbbe97825c4b4bc70e2b
tree72c16b26a56e1cae838497f9c54a156144d61fd2
parent5535384878901c6ce77066a3fbdb7d2ae1aeef12
refclock: rework update of reachability again

The recent rework of refclock reachability to better work with
driver-specific filtering (PHC driver dropping samples with unexpected
delay) introduced an issue that a PPS refclock is indicated as reachable
even when its "lock" refclock is permanently unreachable, or its samples
constistently fail in other sample checks, and no actual samples can be
accumulated. This breaks the new maxunreach option.

Rework the refclock code to provide samples from drivers together with
their quality level (all drivers except PHC provide samples with
constant quality of 1) and drop samples with quality 0 after passing
all checks, right before the actual accumulation in the median sample
filter. Increment the reachability counter only for samples that would
be accumulated.

This fixes the problem with refclocks indicated as reachable when their
samples would be dropped for other reasons than the PHC-specific delay
filter, and the maxunreach option can work as expected.

Fixes: b9b338a8df23 ("refclock: rework update of reachability")
refclock.c
refclock.h
refclock_phc.c
refclock_pps.c
refclock_rtc.c
refclock_shm.c
refclock_sock.c
test/simulation/106-refclock