From 81f7f6ddf08011d3b3f7bd02662e76dfa7855d78 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 14 Apr 2021 12:17:22 +0200 Subject: [PATCH] ntp: don't update source status with unsynchronized data Don't update the leap and stratum used in source selection if they indicate an unsynchronized source. Fixes: 2582be8754ab ("sources: separate update of leap status") --- ntp_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntp_core.c b/ntp_core.c index 68176ec..3742332 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -1766,7 +1766,8 @@ process_response(NCR_Instance inst, NTP_Local_Address *local_addr, inst->tx_count = 0; SRC_UpdateReachability(inst->source, synced_packet); - SRC_UpdateStatus(inst->source, MAX(message->stratum, inst->min_stratum), pkt_leap); + if (synced_packet) + SRC_UpdateStatus(inst->source, MAX(message->stratum, inst->min_stratum), pkt_leap); if (good_packet) { /* Adjust the polling interval, accumulate the sample, etc. */