]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: fix loop test for special reference modes
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 6 Apr 2021 16:05:54 +0000 (18:05 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 7 Apr 2021 15:14:22 +0000 (17:14 +0200)
It is not sufficient to check for disabled server sockets as they are
not open only after the special reference modes end (e.g. initstepslew).

Fixes: 004986310d2a ("ntp: skip loop test if no server socket is open")
ntp_core.c

index f4b0f1ca6e159fde3da149e0596cd5d90741ae46..68176ec0a9e30b7c9357f2bd89e4de9856c6097b 100644 (file)
@@ -1381,9 +1381,8 @@ check_sync_loop(NCR_Instance inst, NTP_Packet *message, NTP_Local_Address *local
   NTP_Leap leap_status;
   uint32_t our_ref_id;
 
-  /* Check if a server socket is open, i.e. a client or peer can actually
-     be synchronised to us */
-  if (!NIO_IsServerSocketOpen())
+  /* Check if a client or peer can be synchronised to us */
+  if (!NIO_IsServerSocketOpen() || REF_GetMode() != REF_ModeNormal)
     return 1;
 
   /* Check if the source indicates that it is synchronised to our address