Michal Schmidt 5a725f
From e5ef9861f95f46b0b6462b7c4de62cd470ead17f Mon Sep 17 00:00:00 2001
Michal Schmidt 5a725f
From: Michal Schmidt <mschmidt@redhat.com>
Michal Schmidt 5a725f
Date: Wed, 10 Sep 2014 19:00:56 +0200
Michal Schmidt 5a725f
Subject: [PATCH] timesyncd: check if stratum is valid
Michal Schmidt 5a725f
Michal Schmidt 5a725f
Upstream commit:
Michal Schmidt 5a725f
commit 07610e108e2d3f046da683a3a69c4d5cccd2cf8e
Michal Schmidt 5a725f
Author: Miroslav Lichvar <mlichvar@redhat.com>
Michal Schmidt 5a725f
Date:   Wed Aug 27 16:47:17 2014 +0200
Michal Schmidt 5a725f
Michal Schmidt 5a725f
    timesyncd: check if stratum is valid
Michal Schmidt 5a725f
---
Michal Schmidt 5a725f
 src/timesync/timesyncd.c | 3 ++-
Michal Schmidt 5a725f
 1 file changed, 2 insertions(+), 1 deletion(-)
Michal Schmidt 5a725f
Michal Schmidt 5a725f
diff --git a/src/timesync/timesyncd.c b/src/timesync/timesyncd.c
Michal Schmidt 5a725f
index efe95442a6..dc00b2f1f3 100644
Michal Schmidt 5a725f
--- a/src/timesync/timesyncd.c
Michal Schmidt 5a725f
+++ b/src/timesync/timesyncd.c
Michal Schmidt 5a725f
@@ -639,7 +639,8 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
Michal Schmidt 5a725f
                 return manager_connect(m);
Michal Schmidt 5a725f
         }
Michal Schmidt 5a725f
 
Michal Schmidt 5a725f
-        if (NTP_FIELD_LEAP(ntpmsg.field) == NTP_LEAP_NOTINSYNC) {
Michal Schmidt 5a725f
+        if (NTP_FIELD_LEAP(ntpmsg.field) == NTP_LEAP_NOTINSYNC ||
Michal Schmidt 5a725f
+            ntpmsg.stratum == 0 || ntpmsg.stratum >= 16) {
Michal Schmidt 5a725f
                 log_debug("Server is not synchronized. Disconnecting.");
Michal Schmidt 5a725f
                 return manager_connect(m);
Michal Schmidt 5a725f
         }