Drop incoming packets on transportSpecific mismatch.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-07-27 22:17:56 +02:00
parent 9bdf92a7cf
commit 6258aa0bad
2 changed files with 14 additions and 0 deletions

11
msg.h
View File

@ -212,6 +212,17 @@ static inline Boolean field_is_set(struct ptp_message *m, int index, Octet bit)
return m->header.flagField[index] & bit ? TRUE : FALSE;
}
/**
* Obtain the transportSpecific field from a message.
* @param m Message to test.
* @return The value of the transportSpecific field. Note that the
* value is returned unshifted, in the upper nibble.
*/
static inline UInteger8 msg_transport_specific(struct ptp_message *m)
{
return m->header.tsmt & 0xf0;
}
/**
* Obtain the message type.
* @param m Message to test.

3
port.c
View File

@ -290,6 +290,9 @@ static int port_ignore(struct port *p, struct ptp_message *m)
{
struct ClockIdentity c1, c2;
if (msg_transport_specific(m) != p->transportSpecific) {
return 1;
}
if (pid_eq(&m->header.sourcePortIdentity, &p->portIdentity)) {
return 1;
}