Ignore delay_resp messages from foreign masters.

When a new master appears, it will start to respond to our delay_req
messages. Make sure we process only responses from our current master
before switching to the new master.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2013-10-11 17:30:28 +02:00 committed by Richard Cochran
parent 45493756f8
commit ea4201298c
1 changed files with 4 additions and 0 deletions

4
port.c
View File

@ -1486,10 +1486,12 @@ static void process_delay_resp(struct port *p, struct ptp_message *m)
{
struct delay_req_msg *req;
struct delay_resp_msg *rsp = &m->delay_resp;
struct PortIdentity master;
if (!p->delay_req)
return;
master = clock_parent_identity(p->clock);
req = &p->delay_req->delay_req;
if (p->state != PS_UNCALIBRATED && p->state != PS_SLAVE)
@ -1498,6 +1500,8 @@ static void process_delay_resp(struct port *p, struct ptp_message *m)
return;
if (rsp->hdr.sequenceId != ntohs(req->hdr.sequenceId))
return;
if (!pid_eq(&master, &m->header.sourcePortIdentity))
return;
clock_path_delay(p->clock, p->delay_req->hwts.ts, m->ts.pdu,
m->header.correction);