diff --git a/port_signaling.c b/port_signaling.c index f845d36..ec3ad87 100644 --- a/port_signaling.c +++ b/port_signaling.c @@ -21,6 +21,13 @@ #include "unicast_client.h" #include "unicast_service.h" +static struct PortIdentity wildcard = { + .clockIdentity = { + {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} + }, + .portNumber = 0xffff, +}; + struct ptp_message *port_signaling_construct(struct port *p, struct address *address, struct PortIdentity *tpid) @@ -67,6 +74,12 @@ int process_signaling(struct port *p, struct ptp_message *m) break; } + /* Ignore signaling messages not addressed to this port. */ + if (!pid_eq(&m->signaling.targetPortIdentity, &p->portIdentity) && + !pid_eq(&m->signaling.targetPortIdentity, &wildcard)) { + return 0; + } + TAILQ_FOREACH(extra, &m->tlv_list, list) { switch (extra->tlv->type) { case TLV_REQUEST_UNICAST_TRANSMISSION: diff --git a/unicast_client.c b/unicast_client.c index de5eee9..91b99ed 100644 --- a/unicast_client.c +++ b/unicast_client.c @@ -25,13 +25,6 @@ #define E2E_SYDY_MASK (1 << ANNOUNCE | 1 << SYNC | 1 << DELAY_RESP) #define P2P_SYDY_MASK (1 << ANNOUNCE | 1 << SYNC) -static struct PortIdentity wildcard = { - .clockIdentity = { - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} - }, - .portNumber = 0xffff, -}; - static int attach_ack(struct ptp_message *msg, uint8_t message_type_flags) { struct ack_cancel_unicast_xmit_tlv *ack; @@ -101,10 +94,6 @@ static struct unicast_master_address *unicast_client_ok(struct port *p, if (!unicast_client_enabled(p)) { return NULL; } - if (!pid_eq(&m->signaling.targetPortIdentity, &p->portIdentity) && - !pid_eq(&m->signaling.targetPortIdentity, &wildcard)) { - return NULL; - } STAILQ_FOREACH(ucma, &p->unicast_master_table->addrs, list) { if (addreq(transport_type(p->trp), &ucma->address, &m->address)) { break;