chiark / gitweb /
timesyncd: check if stratum is valid
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 27 Aug 2014 14:47:17 +0000 (16:47 +0200)
committerKay Sievers <kay@vrfy.org>
Fri, 29 Aug 2014 16:13:00 +0000 (18:13 +0200)
src/timesync/timesyncd-manager.c

index d80c72f..60f39c6 100644 (file)
@@ -574,7 +574,8 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
                 return manager_connect(m);
         }
 
-        if (NTP_FIELD_LEAP(ntpmsg.field) == NTP_LEAP_NOTINSYNC) {
+        if (NTP_FIELD_LEAP(ntpmsg.field) == NTP_LEAP_NOTINSYNC ||
+            ntpmsg.stratum == 0 || ntpmsg.stratum >= 16) {
                 log_debug("Server is not synchronized. Disconnecting.");
                 return manager_connect(m);
         }