dcavalca / rpms / linuxptp

Forked from rpms/linuxptp 2 years ago
Clone

Blame SOURCES/linuxptp-statechange.patch

4693f0
commit 		17c9787b1d6891636b5be9e4e5a08278b44e9a7a
4693f0
Author: 	Miroslav Lichvar <mlichvar@redhat.com>
4693f0
Date: 		Fri Sep 01 11:42:26 2017 +0100
4693f0
4693f0
		phc2sys: fix handling of multiple state changes.
4693f0
4693f0
		When the master clock changed its state and then changed it back to the
4693f0
		original state before phc2sys could process the first change, e.g. SLAVE
4693f0
		-> UNCALIBRATED -> SLAVE after a clockcheck failure, the second change
4693f0
		was ignored because the new value was the same as the original state,
4693f0
		which wasn't updated for the first change yet. This caused phc2sys to be
4693f0
		stuck with a wrong state.
4693f0
4693f0
		Fix phc2sys to check both the state and new_state variables of the clock.
4693f0
4693f0
		Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
4693f0
4693f0
diff --git a/phc2sys.c b/phc2sys.c
4693f0
index b6f6719..e2b5c47 100644
4693f0
--- a/phc2sys.c
4693f0
+++ b/phc2sys.c
4693f0
@@ -786,7 +786,7 @@ static int recv_subscribed(struct node *node, struct ptp_message *msg,
4693f0
 			port->state = state;
4693f0
 			clock = port->clock;
4693f0
 			state = clock_compute_state(node, clock);
4693f0
-			if (clock->state != state) {
4693f0
+			if (clock->state != state || clock->new_state) {
4693f0
 				clock->new_state = state;
4693f0
 				node->state_changed = 1;
4693f0
 			}