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 <richardcochran@gmail.com>
Reported-by: Rohrer Hansjoerg <hj.rohrer@mobatime.com>
master
Richard Cochran 2013-07-02 17:58:04 +02:00
parent 5be0770dfc
commit 81db403af8
1 changed files with 7 additions and 6 deletions

5
port.c
View File

@ -1236,11 +1236,12 @@ static int update_current_master(struct port *p, struct ptp_message *m)
if (!msg_source_equal(m, fc)) if (!msg_source_equal(m, fc))
return add_foreign_master(p, m); return add_foreign_master(p, m);
if (p->state != PS_PASSIVE) {
tds.currentUtcOffset = m->announce.currentUtcOffset; tds.currentUtcOffset = m->announce.currentUtcOffset;
tds.flags = m->header.flagField[1]; tds.flags = m->header.flagField[1];
tds.timeSource = m->announce.timeSource; tds.timeSource = m->announce.timeSource;
clock_update_time_properties(p->clock, tds); clock_update_time_properties(p->clock, tds);
}
if (p->pod.path_trace_enabled) { if (p->pod.path_trace_enabled) {
ptt = (struct path_trace_tlv *) m->announce.suffix; ptt = (struct path_trace_tlv *) m->announce.suffix;
dad = clock_parent_ds(p->clock); 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_PRE_MASTER:
case PS_MASTER: case PS_MASTER:
case PS_GRAND_MASTER: case PS_GRAND_MASTER:
case PS_PASSIVE:
result = add_foreign_master(p, m); result = add_foreign_master(p, m);
break; break;
case PS_PASSIVE:
case PS_UNCALIBRATED: case PS_UNCALIBRATED:
case PS_SLAVE: case PS_SLAVE:
result = update_current_master(p, m); result = update_current_master(p, m);