teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0002-timesyncd-check-if-stratum-is-valid.patch

Michal Schmidt d962ba
From df5380ac8abfc615b4baa0d001afe0e605d34d9b Mon Sep 17 00:00:00 2001
Michal Schmidt d962ba
From: Miroslav Lichvar <mlichvar@redhat.com>
Michal Schmidt d962ba
Date: Wed, 27 Aug 2014 16:47:17 +0200
Michal Schmidt d962ba
Subject: [PATCH 02/12] timesyncd: check if stratum is valid
Michal Schmidt d962ba
Michal Schmidt d962ba
(cherry picked from commit 07610e108e2d3f046da683a3a69c4d5cccd2cf8e)
Michal Schmidt d962ba
---
Michal Schmidt d962ba
 src/timesync/timesyncd-manager.c | 3 ++-
Michal Schmidt d962ba
 1 file changed, 2 insertions(+), 1 deletion(-)
Michal Schmidt d962ba
Michal Schmidt d962ba
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
Michal Schmidt d962ba
index d80c72f..60f39c6 100644
Michal Schmidt d962ba
--- a/src/timesync/timesyncd-manager.c
Michal Schmidt d962ba
+++ b/src/timesync/timesyncd-manager.c
Michal Schmidt d962ba
@@ -574,7 +574,8 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
Michal Schmidt d962ba
                 return manager_connect(m);
Michal Schmidt d962ba
         }
Michal Schmidt d962ba
 
Michal Schmidt d962ba
-        if (NTP_FIELD_LEAP(ntpmsg.field) == NTP_LEAP_NOTINSYNC) {
Michal Schmidt d962ba
+        if (NTP_FIELD_LEAP(ntpmsg.field) == NTP_LEAP_NOTINSYNC ||
Michal Schmidt d962ba
+            ntpmsg.stratum == 0 || ntpmsg.stratum >= 16) {
Michal Schmidt d962ba
                 log_debug("Server is not synchronized. Disconnecting.");
Michal Schmidt d962ba
                 return manager_connect(m);
Michal Schmidt d962ba
         }
Michal Schmidt d962ba
-- 
Michal Schmidt d962ba
2.1.0
Michal Schmidt d962ba