Richard Cochran
2016-08-03 12:49:23 UTC
If a non-slave port on a boundary clock see an announce message, then it
must decide whether it should take on the MASTER or the PASSIVE role. When
the GM fields from the local clock are identical to those in the announce,
then the sender/receiver ports are used as a tie breaker.
Following a typographical error in 1588, the code wrongly uses the port
identity of the upstream parent as the "receiver" id. As a result, a port
that should be PASSIVE may choose MASTER instead. This patch fixes the
code to use local port id.
Signed-off-by: Richard Cochran <***@gmail.com>
---
port.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/port.c b/port.c
index 9f07cea..5868983 100644
--- a/port.c
+++ b/port.c
@@ -145,7 +145,7 @@ static int announce_compare(struct ptp_message *m1, struct ptp_message *m2)
return memcmp(&a->grandmasterPriority1, &b->grandmasterPriority1, len);
}
-static void announce_to_dataset(struct ptp_message *m, struct clock *c,
+static void announce_to_dataset(struct ptp_message *m, struct port *p,
struct dataset *out)
{
struct announce_msg *a = &m->announce;
@@ -155,7 +155,7 @@ static void announce_to_dataset(struct ptp_message *m, struct clock *c,
out->priority2 = a->grandmasterPriority2;
out->stepsRemoved = a->stepsRemoved;
out->sender = m->header.sourcePortIdentity;
- out->receiver = clock_parent_identity(c);
+ out->receiver = p->portIdentity;
}
static int msg_current(struct ptp_message *m, struct timespec now)
@@ -2032,7 +2032,7 @@ struct foreign_clock *port_compute_best(struct port *p)
if (!tmp)
continue;
- announce_to_dataset(tmp, p->clock, &fc->dataset);
+ announce_to_dataset(tmp, p, &fc->dataset);
fc_prune(fc);
must decide whether it should take on the MASTER or the PASSIVE role. When
the GM fields from the local clock are identical to those in the announce,
then the sender/receiver ports are used as a tie breaker.
Following a typographical error in 1588, the code wrongly uses the port
identity of the upstream parent as the "receiver" id. As a result, a port
that should be PASSIVE may choose MASTER instead. This patch fixes the
code to use local port id.
Signed-off-by: Richard Cochran <***@gmail.com>
---
port.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/port.c b/port.c
index 9f07cea..5868983 100644
--- a/port.c
+++ b/port.c
@@ -145,7 +145,7 @@ static int announce_compare(struct ptp_message *m1, struct ptp_message *m2)
return memcmp(&a->grandmasterPriority1, &b->grandmasterPriority1, len);
}
-static void announce_to_dataset(struct ptp_message *m, struct clock *c,
+static void announce_to_dataset(struct ptp_message *m, struct port *p,
struct dataset *out)
{
struct announce_msg *a = &m->announce;
@@ -155,7 +155,7 @@ static void announce_to_dataset(struct ptp_message *m, struct clock *c,
out->priority2 = a->grandmasterPriority2;
out->stepsRemoved = a->stepsRemoved;
out->sender = m->header.sourcePortIdentity;
- out->receiver = clock_parent_identity(c);
+ out->receiver = p->portIdentity;
}
static int msg_current(struct ptp_message *m, struct timespec now)
@@ -2032,7 +2032,7 @@ struct foreign_clock *port_compute_best(struct port *p)
if (!tmp)
continue;
- announce_to_dataset(tmp, p->clock, &fc->dataset);
+ announce_to_dataset(tmp, p, &fc->dataset);
fc_prune(fc);
--
2.1.4
------------------------------------------------------------------------------
2.1.4
------------------------------------------------------------------------------