Miroslav Lichvar
2013-10-11 15:30:28 UTC
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 <***@redhat.com>
---
port.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/port.c b/port.c
index 3fc262a..d98bb80 100644
--- a/port.c
+++ b/port.c
@@ -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);
messages. Make sure we process only responses from our current master
before switching to the new master.
Signed-off-by: Miroslav Lichvar <***@redhat.com>
---
port.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/port.c b/port.c
index 3fc262a..d98bb80 100644
--- a/port.c
+++ b/port.c
@@ -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);
--
1.8.3.1
1.8.3.1