mod thread;
use error::{Context, Error};
-use parse::{PtpClockIdentity, PtpMessagePayload, ReadBytesBEExt, WriteBytesBEExt};
+use parse::{PtpClockIdentity, PtpMessagePayload, PtpMessageType, ReadBytesBEExt, WriteBytesBEExt};
use rand::rand;
/// PTP Multicast group.
trace!("Received PTP message {:#?}", ptp_message);
}
- if ptp_message.source_port_identity.clock_identity == u64::from_be_bytes(clock_id) {
- if args.verbose {
- trace!("Ignoring our own PTP message");
+ // The delay request is the only message that is sent
+ // from PTP clock implementation, if others are added
+ // additional match arms should be added.
+ match ptp_message.message_type {
+ PtpMessageType::DELAY_REQ => {
+ if args.verbose {
+ trace!("Ignoring our own PTP message");
+ }
+ continue 'next_packet;
}
- continue 'next_packet;
+ _ => (),
}
+
if let PtpMessagePayload::DelayResp {
requesting_port_identity: PtpClockIdentity { clock_identity, .. },
..