integ/base/linuxptp/debian/patches/0057-Fix-uninitialized-variable-in-nmea_scan_rmc.patch
Andre Mauricio Zelak 06c396fbe3 Fix HA clock selection algorithm
The issue reported is a particular case of a BC configured with
redundant PTP clocks with same priority. When a clock recovers
from a failure, as both clock were configured with same priority
it's expected the active clock source to remain active. But if
the recovered clock presented a better local clock class than
active, it was being selected active. This specific case was fixed.

Closes-bug: 2084723

Test plan: BC with same priority
PASS: Start the PTP service with all clocks out of requirements,
one is selected, no matter which one.
PASS: Then, when the backup clock recovers from failure it is
selected active.
PASS: Then, when the other clock recovers from failure it remains
as backup, no matter the local clock class.
PASS: Then, when the active goes out of requirement, the backup
is set active.

Test plan: GM with same priority
PASS: Start the PTP service with all clocks out of requirements,
one is selected, no matter which one.
PASS: Then, when the backup clock recovers from failure it is selected
active.
PASS: Then, when the other clock recovers from failure it remains
as backup, no matter the local clock class.
PASS: Then, when the active goes out of requirement, the backup
is set active.

Change-Id: Id2568bc8bbaad4cbf15070314f7904d3c3bbd53d
Signed-off-by: Andre Mauricio Zelak <andre.zelak@windriver.com>
2024-10-16 18:19:55 -03:00

32 lines
1.0 KiB
Diff

From: cwalker <cole.walker@windriver.com>
Date: Fri, 1 Mar 2024 17:50:29 +0000
Subject: [PATCH 57/61] Fix uninitialized variable in nmea_scan_rmc
Initialize the tm_isdst variable to ensure that mktime does not fail on
recent versions of glibc.
This change initializes tm_isdst to 0 for compatibility with UTC.
Previously, a positive value in the uninitialized tm_isdst would cause
mktime to fail and ts2phc would repeatedly log "invalid master time
stamp". This resulted in intermittent synchronization errors.
[commit 63fc1ef4fd5e5fc45dd4de3bf27920bb109a4357 upstream]
Signed-off-by: cwalker <cole.walker@windriver.com>
---
nmea.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/nmea.c b/nmea.c
index dc865d0..44c7c01 100644
--- a/nmea.c
+++ b/nmea.c
@@ -157,6 +157,7 @@ static int nmea_scan_rmc(struct nmea_parser *np, struct nmea_rmc *result)
}
tm.tm_year += 100;
tm.tm_mon--;
+ tm.tm_isdst = 0;
result->ts.tv_sec = mktime(&tm);
result->ts.tv_nsec = msec * 1000000UL;
result->fix_valid = status == 'A' ? true : false;