dcavalca / rpms / linuxptp

Forked from rpms/linuxptp 2 years ago
Clone
Blob Blame History Raw
commit 7455c241485e01da12d107f5b665e10794330967
Author: Jiri Benc <jbenc@redhat.com>
Date:   Thu Nov 13 18:18:12 2014 +0100

    phc2sys: fix overwriting of the clock state
    
    The reconfigure function is missing a check whether state for the given
    clock actually changed or not. This caused state for all unchanged ports to
    be zeroed.
    
    Reported-by: Richard Cochran <richardcochran@gmail.com>
    Signed-off-by: Jiri Benc <jbenc@redhat.com>

diff --git a/phc2sys.c b/phc2sys.c
index 22eb9c9..67d8a58 100644
--- a/phc2sys.c
+++ b/phc2sys.c
@@ -305,11 +305,13 @@ static void reconfigure(struct node *node)
 			continue;
 		}
 
-		if (c->new_state == PS_MASTER)
-			clock_reinit(c);
+		if (c->new_state) {
+			if (c->new_state == PS_MASTER)
+				clock_reinit(c);
 
-		c->state = c->new_state;
-		c->new_state = 0;
+			c->state = c->new_state;
+			c->new_state = 0;
+		}
 
 		if (c->state == PS_SLAVE) {
 			src = c;