Allow ignoring source port identity in end to end mode.

The "inhibit_announce" and "ignore_source_id" options were introduced
in order to support the automotive profile.  That profile happens to
specify using the peer to peer delay mechanism, but there is no reason
to restrict them to that mechanism.  As it now stands, enabling these
two options prevents E2E slaves from synchronizing.  This patch fixes
the issue by checking the "ignore_source_id" option when accepting E2E
delay response messages.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2019-01-06 14:15:56 -08:00
parent e27cc2d8a8
commit 563c52b833
1 changed files with 12 additions and 15 deletions

27
port.c
View File

@ -99,6 +99,17 @@ int clear_fault_asap(struct fault_interval *faint)
return 0;
}
static int check_source_identity(struct port *p, struct ptp_message *m)
{
struct PortIdentity master;
if (p->ignore_source_id) {
return 0;
}
master = clock_parent_identity(p->clock);
return pid_eq(&master, &m->header.sourcePortIdentity) ? 0 : -1;
}
static void extract_address(struct ptp_message *m, struct PortAddress *paddr)
{
int len = 0;
@ -1825,19 +1836,16 @@ out:
void process_delay_resp(struct port *p, struct ptp_message *m)
{
struct delay_resp_msg *rsp = &m->delay_resp;
struct PortIdentity master;
struct ptp_message *req;
tmv_t c3, t3, t4, t4c;
master = clock_parent_identity(p->clock);
if (p->state != PS_UNCALIBRATED && p->state != PS_SLAVE) {
return;
}
if (!pid_eq(&rsp->requestingPortIdentity, &p->portIdentity)) {
return;
}
if (!pid_eq(&master, &m->header.sourcePortIdentity)) {
if (check_source_identity(p, m)) {
return;
}
TAILQ_FOREACH(req, &p->delay_req, list) {
@ -1878,17 +1886,6 @@ void process_delay_resp(struct port *p, struct ptp_message *m)
port_set_delay_tmo(p);
}
static int check_source_identity(struct port *p, struct ptp_message *m)
{
struct PortIdentity master;
if (p->ignore_source_id) {
return 0;
}
master = clock_parent_identity(p->clock);
return pid_eq(&master, &m->header.sourcePortIdentity) ? 0 : -1;
}
void process_follow_up(struct port *p, struct ptp_message *m)
{
enum syfu_event event;