From 81db403af835d41af2b239db2099eb7fc947e0ff Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Tue, 2 Jul 2013 17:58:04 +0200 Subject: [PATCH] Reset announce timer when port is passive. Whenever a port enters the passive state, it should act like a slaved port in one respect. Incoming announce messages from the grand master are supposed to reset the announce timer. This patch fixes the port logic to properly maintain the passive state. Signed-off-by: Richard Cochran Reported-by: Rohrer Hansjoerg --- port.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/port.c b/port.c index d29a70c..c4505d8 100644 --- a/port.c +++ b/port.c @@ -1236,11 +1236,12 @@ static int update_current_master(struct port *p, struct ptp_message *m) if (!msg_source_equal(m, fc)) return add_foreign_master(p, m); - tds.currentUtcOffset = m->announce.currentUtcOffset; - tds.flags = m->header.flagField[1]; - tds.timeSource = m->announce.timeSource; - clock_update_time_properties(p->clock, tds); - + if (p->state != PS_PASSIVE) { + tds.currentUtcOffset = m->announce.currentUtcOffset; + tds.flags = m->header.flagField[1]; + tds.timeSource = m->announce.timeSource; + clock_update_time_properties(p->clock, tds); + } if (p->pod.path_trace_enabled) { ptt = (struct path_trace_tlv *) m->announce.suffix; dad = clock_parent_ds(p->clock); @@ -1281,9 +1282,9 @@ static int process_announce(struct port *p, struct ptp_message *m) case PS_PRE_MASTER: case PS_MASTER: case PS_GRAND_MASTER: - case PS_PASSIVE: result = add_foreign_master(p, m); break; + case PS_PASSIVE: case PS_UNCALIBRATED: case PS_SLAVE: result = update_current_master(p, m);