Skip to content

Commit

Permalink
port: Drop received 802.1AS packets with invalid transportSpecific va…
Browse files Browse the repository at this point in the history
…lues

According to IEEE Std 1588-2019 Table 2 and IEEE Std 802.1AS-2020
Sections 11.2.17.1 and 13.3.1.2.16, the permitted transportSpecific
(or majorSdoId) values for 802.1AS are 0x1 for a gPTP domain and 0x2
for CMLDS. Any message received with values other than these is not
from an IEEE802.1AS-2020 PTP Instance and should be dropped.

This fix ensures that incoming 802.1AS packets with an invalid transportSpecific
value, such as 0x3, are dropped. This is particularly necessary when
ignore_transport_specific=1 is set to allow Pdelay measurements between
CMLDS-enabled (TS_CMLDS value=0x2) and non-CMLDS systems (TS_IEEE_8021AS value=0x1).

v2: Fixed indentation.
v3: Added pr_err and fixed trailing whitespace.
v4: Changed pr_err to pr_debug

Signed-off-by: Chwee-Lin Choong <chwee.lin.choong@intel.com>
Signed-off-by: Andrew Zaborowski <andrew.zaborowski@intel.com>
  • Loading branch information
chweelinchoong authored and richardcochran committed Sep 1, 2024
1 parent 59e6f2e commit 365c994
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

/* Values for the transportSpecific field */
#define TS_IEEE_8021AS (1<<4)
#define TS_CMLDS (2<<4)

/* Values for the messageType field */
#define SYNC 0x0
Expand Down
9 changes: 9 additions & 0 deletions port.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,15 @@ static int port_ignore(struct port *p, struct ptp_message *m)
if (path_trace_ignore(p, m)) {
return 1;
}
if (port_is_ieee8021as(p)) {
if (msg_transport_specific(m) != TS_IEEE_8021AS &&
msg_transport_specific(m) != TS_CMLDS) {
pr_debug("%s: received %s with invalid transport specific value %d "
"for IEEE8021as", p->log_name, msg_type_string(msg_type(m)),
msg_transport_specific(m)>>4);
return 1;
}
}
if (p->match_transport_specific &&
msg_transport_specific(m) != p->transportSpecific) {
return 1;
Expand Down

0 comments on commit 365c994

Please sign in to comment.