port: Fix input to the BMC for forming the spanning tree.

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 <richardcochran@gmail.com>
master
Richard Cochran 2016-08-03 14:00:04 +02:00
parent 159f4a265d
commit 5e5c98b3da
1 changed files with 3 additions and 3 deletions

6
port.c
View File

@ -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);