Coder Social home page Coder Social logo

ptpd's Introduction

PTPd

PTP daemon (PTPd) is an implementation the Precision Time Protocol (PTP) version 2 as defined by 'IEEE Std 1588-2008'. PTP provides precise time coordination of Ethernet LAN connected computers. It was designed primarily for instrumentation and control systems.

Use

PTPd can coordinate the clocks of a group of LAN connected computers with each other. It has been shown to achieve microsecond level coordination, even on limited platforms.

The 'ptpd' program can be built from the included source code. To use the program, run 'ptpd' on a group of LAN connected computers. Compile with 'PTPD_DBG' defined and run with the '-C' or -V argument to watch what's going on.

If you are just looking for software to update the time on your desktop, you probably want something that implements the Network Time Protocol. It can coordinate computer clocks with an absolute time reference such as UTC.

Please refer to the INSTALL file for build instructions and configuration options. Please refer to the README.repocheckout file for information on how to build from source code repositories.

Legal notice

PTPd was written by using only information contained within 'IEEE Std 1588-2008'. IEEE 1588 may contain patented technology, the use of which is not under the control of the authors of PTPd. Users of IEEE 1588 may need to obtain a license for the patented technology in the protocol. Contact the IEEE for licensing information.

PTPd is licensed under a 2 Clause BSD Open Source License. Please refer to the COPYRIGHT file for additional information.

PTPd comes with absolutely no warranty.

ptpd's People

Contributors

bsdphk avatar cperl82 avatar florianmickler avatar giuliobenetti avatar gvnn3 avatar j123b567 avatar mburnicki avatar skreuzer avatar stdweird avatar vincentbernat avatar wowczarek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ptpd's Issues

One Way Delay, Slave to Master --> 0.000000000 when using ptpd as Slave

I am using ptpd in slave mode. This is the version that I'm using, it is not the newest one, but this one was available from package sources.
ptpd -g -b eth0 -D -f /var/log/ptpd/stats.log

Installed: 2.2.2-debian1-2
Candidate: 2.2.2-debian1-2
Version table:
*** 2.2.2-debian1-2 0
500 http://ba.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
100 /var/lib/dpkg/status

My master clock is running ptp4l with (hopefully?) hardware timestamping.
ptp4l -4 -H -i p1p1

The associated network card doing this is an Intel 82574L.

ethtool output:

Time stamping parameters for p1p1:
Capabilities:
    hardware-transmit     (SOF_TIMESTAMPING_TX_HARDWARE)
    software-transmit     (SOF_TIMESTAMPING_TX_SOFTWARE)
    hardware-receive      (SOF_TIMESTAMPING_RX_HARDWARE)
    software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)
    software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
    hardware-raw-clock    (SOF_TIMESTAMPING_RAW_HARDWARE)
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
    off                   (HWTSTAMP_TX_OFF)
    on                    (HWTSTAMP_TX_ON)
Hardware Receive Filter Modes:
    none                  (HWTSTAMP_FILTER_NONE)
    all                   (HWTSTAMP_FILTER_ALL)
    ptpv1-l4-sync         (HWTSTAMP_FILTER_PTP_V1_L4_SYNC)
    ptpv1-l4-delay-req    (HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ)
    ptpv2-l4-sync         (HWTSTAMP_FILTER_PTP_V2_L4_SYNC)
    ptpv2-l4-delay-req    (HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ)
    ptpv2-l2-sync         (HWTSTAMP_FILTER_PTP_V2_L2_SYNC)
    ptpv2-l2-delay-req    (HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ)
    ptpv2-event           (HWTSTAMP_FILTER_PTP_V2_EVENT)
    ptpv2-sync            (HWTSTAMP_FILTER_PTP_V2_SYNC)
    ptpv2-delay-req       (HWTSTAMP_FILTER_PTP_V2_DELAY_REQ)

Now to the issue.

If I look in the slave log, I see lines like this:

2016-02-22 09:11:24.258947, slv, 6805cafffe39dabc(unknown)/01,  0.000000000,  0.000000365,  0.000000000,  0.000001337, 31081, 0, S
2016-02-22 09:11:25.259040, slv, 6805cafffe39dabc(unknown)/01,  0.000000000,  0.000002293,  0.000000000,  0.000003250, 31083, 0, S
2016-02-22 09:11:26.259097, slv, 6805cafffe39dabc(unknown)/01,  0.000000000,  0.000002104,  0.000000000,  0.000000958, 31085, 0, S
2016-02-22 09:11:27.259169, slv, 6805cafffe39dabc(unknown)/01,  0.000000000,  0.000000642,  0.000000000,  0.000000327, 31085, 0, S

One Way Delay and Slave to Master are 0, my feeling says that this can not be correct, as the one-way-delay should at least be larger than 0.
This slave has a Broadcom BCM5754 NIC.

Time stamping parameters for eth1:
Capabilities:
    software-transmit     (SOF_TIMESTAMPING_TX_SOFTWARE)
    software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)
    software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes:
    off                   (HWTSTAMP_TX_OFF)
    on                    (HWTSTAMP_TX_ON)
Hardware Receive Filter Modes:
    none                  (HWTSTAMP_FILTER_NONE)
    ptpv1-l4-event        (HWTSTAMP_FILTER_PTP_V1_L4_EVENT)
    ptpv2-l4-event        (HWTSTAMP_FILTER_PTP_V2_L4_EVENT)
    ptpv2-l2-event        (HWTSTAMP_FILTER_PTP_V2_L2_EVENT)

I also have another slave, same output in the logfile:

2016-02-22 09:13:36.265614, slv, 6805cafffe39dabc(unknown)/01,  0.000000000,  0.000021380,  0.000000000,  0.000030137, -3721, 0, S
2016-02-22 09:13:37.265580, slv, 6805cafffe39dabc(unknown)/01,  0.000000000,  0.000001287,  0.000000000, -0.000027563, -3720, 0, S
2016-02-22 09:13:38.265691, slv, 6805cafffe39dabc(unknown)/01,  0.000000000, -0.000005543,  0.000000000,  0.000016477, -3725, 0, S

The drift here is way better than the other slave, probably because the NIC (Intel 82579LM) on this machine has some hardware timestamping function. But I thought they are not active in ptpd, or is the NIC doing some stuff here?

Time stamping parameters for eth1:
Capabilities:
    hardware-transmit     (SOF_TIMESTAMPING_TX_HARDWARE)
    software-transmit     (SOF_TIMESTAMPING_TX_SOFTWARE)
    hardware-receive      (SOF_TIMESTAMPING_RX_HARDWARE)
    software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)
    software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
    hardware-raw-clock    (SOF_TIMESTAMPING_RAW_HARDWARE)
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
    off                   (HWTSTAMP_TX_OFF)
    on                    (HWTSTAMP_TX_ON)
Hardware Receive Filter Modes:
    none                  (HWTSTAMP_FILTER_NONE)
    all                   (HWTSTAMP_FILTER_ALL)
    ptpv1-l4-sync         (HWTSTAMP_FILTER_PTP_V1_L4_SYNC)
    ptpv1-l4-delay-req    (HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ)
    ptpv2-l4-sync         (HWTSTAMP_FILTER_PTP_V2_L4_SYNC)
    ptpv2-l4-delay-req    (HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ)
    ptpv2-l2-sync         (HWTSTAMP_FILTER_PTP_V2_L2_SYNC)
    ptpv2-l2-delay-req    (HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ)
    ptpv2-event           (HWTSTAMP_FILTER_PTP_V2_EVENT)
    ptpv2-sync            (HWTSTAMP_FILTER_PTP_V2_SYNC)
    ptpv2-delay-req       (HWTSTAMP_FILTER_PTP_V2_DELAY_REQ)

Is this behaviour correct?

Thank you.

ptpd in slaveonly mode stops running after some hours

I want to synchronize a slave cpu to a master cpu. The ptpd in masteronly mode runs perfectly. But I have problems with the ptpd in slaveonly mode. After some hours it is dead and I have to kill it (kill -8) an restart it.

Version: ptpd v2.3.1
Hardware: IMX6

This is how I startet ptpd:

# strace -o strace.log /usr/bin/ptpd2 --config-file /etc/ptpd.conf -C
Warning: It is recommended to set the delay request interval (ptpengine:log_dela
yreq_interval) in unicast mode
2016-06-16 06:04:36.195419 ptpd2[438].startup (info)      (___) Configuration OK
2016-06-16 06:04:36.209302 ptpd2[438].startup (info)      (___) Successfully acquired lock on /var/run/ptpd2.lock
2016-06-16 06:04:36.218048 ptpd2[438].startup (notice)    (___) PTPDv2 started successfully on eth0.2 using "slaveonly" preset (PID 438)
2016-06-16 06:04:36.219717 ptpd2[438].startup (info)      (___) TimingService.PTP0: PTP service init

I use unicast mode but I also had the same problem in multicast mode.
The logs of the ptpd are attached and I also added my pdpd.conf and a shortend strace log.

I can't recognize any error, but maybe someone else could help me. I also can provide more information if needed.

ptp-strace-short.log.txt
ptpd.conf.txt
ptpd2.event.log.txt
ptpd2.stats.log.txt
ptpd2.status.log.txt

Thanks Chris

(init) failed to join the multicast group

Hi folks,

i'm using ptpd2 v2.3.1 and can synchronize clocks between my Vmware and my slave in Unicast.
When i try multicast gives me that error:
(init) failed to join the multicast group (strerror: No such file or directory)

Anyidea what can be?
Regards

Setup for Multiple NICs

We have a setup where we would like to connect 3 PTP ethernet cameras to a main computer that will both receive the data and serve as a PTP master. Since each camera uses nearly the full bandwidth of gigabit ethernet, we decided to place each camera on its own network interface to improve bandwidth and reduce congestion. However, I cannot figure out how I would setup a ptpd master in this scenario, since the master is tied to a specific network interface. Placing all the cameras on a switch would allow me to easily use ptpd, but that would significantly reduce the framerate of the cameras since there would not be enough bandwidth. Is there any way to use ptp synchronization across different interfaces?

How to use PTPd

Hi, I have installed ptpd by following commands from install file, now what how it works? i am blank here. Thanks

Regards
Asad

Year 2038 problem and ptpd (802.1AS)

I have come to a recent problem where I tested ptpd and it seems that integer32 are used for seconds, which leads to year 2038 problem...
I am referring to this: https://en.wikipedia.org/wiki/Year_2038_problem

Eventhough the types are defiend correctly (UInteger48), they are not used:
https://github.com/ptpd/ptpd/blob/master/src/ptp_primitives.h

Instead, TimeInternal defines signed integer32 as seconds:
typedef struct {
Integer32 seconds;
Integer32 nanoseconds;
} TimeInternal;
https://github.com/ptpd/ptpd/blob/master/src/ptp_datatypes.h

My suggestion would be:

  1. Hotfix would be using unsigned integer32 to extend the time until year 2106.
  2. Use the Uinteger48 (specified in 802.1AS spec) and adjust all algorithms.
  3. Use Uinteger64 (not specified) for seconds

P.S.: Is this page still supported?

On QNX ptpd only works when RUNTIME_DEBUG is enabled on master

I'm currently testing the latest version of ptpd on QNX 6.5.0 machines and apparently neither multicast nor unicast communication work.
However, during debugging the issue I found it really weird that once I build ptpd with RUNTIME_DEBUG enabled:

./configure --enable-runtime-debug

and turning it on by adding -D to the invocation on the master side it somehow works.

I've encountered many #ifdef RUNTIME_DEBUG statements everywhere in the code, so I think somewhere in combination with a #ifdef __QNXNTO__ statement might be the bug.

How to build a boundary clock with ptpd software? Thank U!

I’m going to build a boundary clock with the ptpd software, which can receive timestamp from a master clock and send the local time to some ordinary clocks. The boundary clock has serval Ethernet ports which are bonded with a bridge, so none of the ports has an IP address, but the bridge has an IP address. Any advice? Thank you!

ptpd TLV suffix

My application for ptpd requires experimental TLV suffixes at the end of Announce messages.
(See sections 13.4 and 14 of IEEE 1588-2008.)

How would you recommend this be implemented within the existing codebase?

Allow to use slave mode on all network interfaces

We use ptpd on network-booted nodes, on which the name of the network interfaces can vary (e.g. eth0, enp1s0, enp3s0, etc). We would like to use the same ptpd config on all nodes.

However, after reading the man page and the default config, I didn't find any way to make ptpd run on all available network interfaces, without having to specify them by name. The closest would be to use ptpengine:interface and ptpengine:backup_interface to handle two different interface names, but it's not really a general solution.

Is this already possible, and if not, how hard would it be? We run Linux (Debian).

step_startup_force Does not work from a cold-boot.

Hello,

For one of our experimental sorting machines I make use of ptpd to keep a couple of PCs synchronized without the aid of a (grand)master clock and so at boot there's always some time difference that needs to be smoothed out. As the PCs are meant to be modular and have no special or distinguishing manual configurations the ptp daemons have been configured to be master-slaves and I wrote a startup script so that it would boot together with the OS.

After the fight on who's going to be the master has been won by one of the PCs I noticed that bigger time differences cause the slaves to step straight away. Which is perfectly acceptable as I want my time to be synchronized ASAP. Smaller differences can sometimes take up to half an hour to smooth out because the clock is slewed instead of stepped, which is unacceptable.

After some more careful examination of the documentation I noticed the step_startup_force option and thought that this is exactly what I needed. And it is. But only when I manually restart the daemons. When I start the sorting machine by switching the power back on the daemons do not perform this sync once to get into the slave state. When I next restart the daemon or the PC the clock is stepped properly again.

So, long story short: step_startup_force does not work from a cold boot.

This concerns ptpd2 version 2.3.2. Running on Ubuntu 14.04.5

Is ptpdv2.3.1 strictly for OS environments?

@j123b567
Is it possible to port the ptpdv2.3.1 to microcontrollers without any OS?
To be specific, there's no NO_SYS directive like in lwIP usually. So, I was wondering if ptpdv2.3.1 is even intended for devices running without an OS.
Even if it's not intended, is it feasible and advisable to port it to one?
Thanks.

Hardware PTP support with wowczarek/ptpd

Hi,
I am working to bringup Hardware PTP feature on a PHY chip with wowczarek/ptpd, the ptp protocol packet looks good, and could get the time offset. but the time offset cannot reach in 50ns, and not stabilized. I am a newer for PTP. I supported the driver to hook PTP ops in kernel including adjfreq, adjtime, gettime64 and settime64. And I am using the the linuxphc_hw.conf in wowczarek/ptpd. could someone help me out for the issue, or any reference code and document? Attached files are the configuration file and log file.
linuxphc_hw.conf.txt
ptpd.log.txt

ptpd not working as slave on macOS

using ptpd on macOS with parameters: -s -i en0 -y -C -V -L
Will not operate as a slave to any other PTPv2 clock I have tried. I have tried using Merging HAPI, and Hasseb AoE as masters, also tried ptpd on another Mac as master. In all cases ptpd will not slave.

It does work as a master with -m and other PTPv2 devices slave to it happily. However I have never been able to get ptpd to act as a slave on macOS (testing on 10.13.4).

It repeats the same thing over and over as shown below:

2018-05-26 13:33:02.042269, flt,
2018-05-26 13:33:02.042281, init,
2018-05-26 13:33:02.074418 ptpd2[78469].en0 (notice) (lstn_reset) Now in state: PTP_LISTENING
2018-05-26 13:33:02.074514, lstn_reset, 4
2018-05-26 13:33:14.074664, lstn_reset, 4
2018-05-26 13:33:26.074897, lstn_reset, 4
2018-05-26 13:33:38.075157, lstn_reset, 4
2018-05-26 13:33:50.075419, lstn_reset, 4
2018-05-26 13:34:02.043480 ptpd2[78469].en0 (warning) (lstn_reset) Still in LISTENING after 5 restarts - restarting transports

Any ideas?

NTPd integration is broken

I configured integration of PTPd with NTPd and when I start PTPd I'm getting following warning message:

TimingService.NTP0: Could not start NTP service. Will keep retrying.

After adding enable mode7 in ntp.conf I managed to fix this issue.
Seems that PTPd uses deprecated NTP stuff (see this thread).

PTP masters running on RHEL 5.4 send malformed follow up messages

Hello,
I've got a legacy Red Hat 5.4 i686 machine we want to run ptpd 2.3.1 on as a master clock. When I run the program ptpd starts up as a master as expected. However, on the slave end, all I see are Delay Response packets with all fields set to 0 like this

2015-12-03 07:10:29.107100, slv, 525400fffe202102(unknown)/1, 0.000000000, 0.000000000, 0.000000000, 0.000000000, 11467.193603516, D, 0.000000000, 0, 0.000000000, 0, 0, 0, 0.000000000, 0.000000000

When I enable debug mode on the slave I see this error message

(slv) ignord unicast message in multicast mode 2

This doesn't make any sense, since I'm running both master and slave in multicast mode. I've tried 5.4 x86_64 in an attempt to track down the issue and it still has the same behavior. I don't see this issue in RHEL 6, but upgrading would affect other legacy programs we have in the system.

Incompatibility with libressl

Downstream bug: https://bugs.gentoo.org/664500

There is custom definition of EVP_MD_CTX in src/dep/ntpengine/ntp_isc_md5.h which is included in global src/ptpd.h. MD5 Functionality is used only by src/dep/ntpengine/ntpdcontrol.c so it should be included only there.

OpenSSL/LibreSSL library is pulled by net-snmp also to global scope which cause conflict with LibreSSL implementation.

                 from /usr/include/net-snmp/net-snmp-includes.h:78,
                 from dep/net.c:73:
/usr/include/openssl/ossl_typ.h:114:30: error: conflicting types for ‘EVP_MD_CTX’
 typedef struct env_md_ctx_st EVP_MD_CTX;
                              ^~~~~~~~~~
In file included from dep/../ptpd.h:153,

Sufficient fix should be to use the ntp_isc_md5.h on the right place.

PTPDv2 startup failed because interface eth0 has no IPv4 address set

Hi,

I want to start a ptp daemon on system start. I set /etc/default/ptpd to:

# /etc/default/ptpd

# Set to "yes" to actually start ptpd automatically
START_DAEMON=yes

# Add command line options for ptpd
PTPD_OPTS=" -i eth0 -M"

After a reboot, service ptpd status tells me

● ptpd.service - LSB: start and stop ptpd
   Loaded: loaded (/etc/init.d/ptpd; bad; vendor preset: enabled)
   Active: active (exited) since Fri 2018-03-02 15:03:21 UTC; 5min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 960 ExecStart=/etc/init.d/ptpd start (code=exited, status=0/SUCCESS)

Mar 02 15:03:20 tegra-ubuntu-1 systemd[1]: Starting LSB: start and stop ptpd...
Mar 02 15:03:21 tegra-ubuntu-1 ptpd2[1007]: PTPDv2 version 2.3.1 starting
Mar 02 15:03:21 tegra-ubuntu-1 ptpd2[1007]: Starting ptpd2 daemon with parameters:      /usr/sbin/ptpd -i eth0 -M
Mar 02 15:03:21 tegra-ubuntu-1 ptpd2[1007]: Checking configuration
Mar 02 15:03:21 tegra-ubuntu-1 ptpd2[1007]: Configuration OK
Mar 02 15:03:21 tegra-ubuntu-1 ptpd[960]: Interface eth0 has no IPv4 address set
Mar 02 15:03:21 tegra-ubuntu-1 ptpd[960]: Error: Cannot use eth0 interface
Mar 02 15:03:21 tegra-ubuntu-1 ptpd[960]: PTPDv2 startup failed
Mar 02 15:03:21 tegra-ubuntu-1 systemd[1]: Started LSB: start and stop ptpd.

eth0 uses DHCP so I guess it did not immediately have an IP.

This is on Ubuntu 16.04.

What can I do to make this work? Can I have the ptpd wait for eth0 to be ready?

New release?

As far as I can tell, there was a 2.3.1.1 release planned a few years ago but never tagged.

There have been a lot of changes since then, probably it's time for a new release?

Introducing SQLITE to PTP

Hello All,

I am facing some problems linking sqlite to the ptp project.
Any hints on needed changes to the configure file are highly appreciated.

Why is there a need to re-arm timer for sending delay request?

Hi, this is not a bug.

I'm in the process of modifying ptpd to include hardware timing from the FPGA.

I would like to understand why is there a need to rearm the timer for sending Delay Request.

In file "protocol.c" inside function "issueDelayReq", there is a comment that says:

"Explicitly re-arm timer for sending the next delay request.
9.5.11.2: arm the timer with a uniform range from 0 to 2 x interval."

As a result of the above, I see delay request being sent one after another.

Why don't we use a periodic timer for sending Delay Request for the PTP_SLAVE? A periodic timer is used to send SYNC message from the PTP_MASTER.

Thanks for reading.

wlan0 doesn't exist, until manually restart ptpd

Mar 03 13:46:52 jetson-0423018055033 ptpd2[5653]: Loading configuration file: /e
Mar 03 13:46:52 jetson-0423018055033 ptpd2[5653]: Checking configuration
Mar 03 13:46:52 jetson-0423018055033 ptpd2[5653]: Configuration OK
Mar 03 13:46:52 jetson-0423018055033 ptpd2[5653]: Interface wlan0 does not exist
Mar 03 13:46:52 jetson-0423018055033 ptpd[5241]: Interface wlan0 does not exist.
Mar 03 13:46:52 jetson-0423018055033 ptpd[5241]: Error: Cannot use wlan0 interfa
Mar 03 13:46:52 jetson-0423018055033 ptpd[5241]: PTPDv2 startup failed
Mar 03 13:46:52 jetson-0423018055033 ptpd2[5653]: Error: Cannot use wlan0 interf
Mar 03 13:46:52 jetson-0423018055033 ptpd2[5653]: PTPDv2 startup failed
Mar 03 13:46:52 jetson-0423018055033 systemd[1]: Started LSB: start and stop ptp

Configuring the ptp daemon on QNX 7.0

Hi @wowczarek ,

I am trying to configure the PTPd on QNX 7.0 (command line interface). I have used the ptpd open source source code and was able to modify configuration file there, but in QNX I am not sure where this file is located or how to modify it. Is there any documentation for the same ?

Thanks,
Shreyas

BMC Algorithm logic is backwards

Line 769-772 of BMC states:
for (i=1,best = 0; inumber_foreign_records;i++)
if ((bmcDataSetComparison(&foreignMaster[i], &foreignMaster[best],
ptpClock, rtOpts)) < 0)
best = i;
Where the bmcDataSetComparison returns -1 for B better than A, meaning if best is better than i, it replaces best with i, which is the opposite of what it should do. This works for most cases because the statement below will deal with it. But when you have many daemons running on different devices on a network and they all enable at the same time, you can get a loop where oyu have several masters set incorrectly. I have solved an verified the fix of changing to > 0 on my devices.

IPv6 support

Hi.
Is there any plans on supporting IPv6?
Thanks

PTPd - dump packets does not show msgDebugDelayReq

Hello,

Currently using ptpd for ubuntu 16.04 and I am doing some data storage on the packets being sent out from ptpd and I am using the option global:dump_packets from http://manpages.ubuntu.com/manpages/xenial/man5/ptpd.conf.5.html

Packets are all dumping fine however there seems to be no ptp delay request packets being dumped into my ptp log file. Is this intended? Is there a way I can see the ptp delay request packets from ptpd itself. I can confirm that ptpd is making the ptp delay requests using tcpdump they are there.

Here is an example of the ptpd2.logs

2019-08-13 14:13:58.270998 ptpd2[32211].net0 (notice)    (slv) msgDebugDelayResp: delayReceiptTimestamp.seconds 1565720075
2019-08-13 14:13:58.271003 ptpd2[32211].net0 (notice)    (slv) msgDebugDelayResp: delayReceiptTimestamp.nanoseconds 270520775
2019-08-13 14:13:58.271008 ptpd2[32211].net0 (notice)    (slv) msgDebugDelayResp: requestingPortIdentity.clockIdentity 00:02:c5:ff:fe:1898:1b
2019-08-13 14:13:58.271013 ptpd2[32211].net0 (notice)    (slv) msgDebugDelayResp: requestingPortIdentity.portNumber 1
2019-08-13 14:13:58.416796 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: messageType 9
2019-08-13 14:13:58.416809 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: versionPTP 2
2019-08-13 14:13:58.416816 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: messageLength 54
2019-08-13 14:13:58.416821 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: domainNumber 0
2019-08-13 14:13:58.416827 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: flags 00 00
2019-08-13 14:13:58.416833 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: correctionfield 0
2019-08-13 14:13:58.416838 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: sourcePortIdentity.clockIdentity 00:02:c5:ff:fe:1371:7c
2019-08-13 14:13:58.416845 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: sourcePortIdentity.portNumber 1
2019-08-13 14:13:58.416850 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: sequenceId 9
2019-08-13 14:13:58.416855 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: controlField 3
2019-08-13 14:13:58.416861 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: logMessageIntervale 0
2019-08-13 14:13:58.416866 ptpd2[32211].net0 (notice)    (slv) msgDebugDelayResp: delayReceiptTimestamp.seconds 1565720075
2019-08-13 14:13:58.416872 ptpd2[32211].net0 (notice)    (slv) msgDebugDelayResp: delayReceiptTimestamp.nanoseconds 415590671
2019-08-13 14:13:58.416877 ptpd2[32211].net0 (notice)    (slv) msgDebugDelayResp: requestingPortIdentity.clockIdentity 00:25:90:ff:fe:ec38:86
2019-08-13 14:13:58.416883 ptpd2[32211].net0 (notice)    (slv) msgDebugDelayResp: requestingPortIdentity.portNumber 1
2019-08-13 14:13:58.592843 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: messageType 0
2019-08-13 14:13:58.592863 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: versionPTP 2
2019-08-13 14:13:58.592885 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: messageLength 44
2019-08-13 14:13:58.592894 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: domainNumber 0
2019-08-13 14:13:58.592902 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: flags 00 00
2019-08-13 14:13:58.592910 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: correctionfield 0
2019-08-13 14:13:58.592918 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: sourcePortIdentity.clockIdentity 00:02:c5:ff:fe:1371:7c
2019-08-13 14:13:58.592926 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: sourcePortIdentity.portNumber 1
2019-08-13 14:13:58.592948 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: sequenceId 62643
2019-08-13 14:13:58.592956 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: controlField 0
2019-08-13 14:13:58.592964 ptpd2[32211].net0 (notice)    (slv) msgDebugHeader: logMessageIntervale -1
2019-08-13 14:13:58.592972 ptpd2[32211].net0 (notice)    (slv) msgDebugSync: originTimestamp.seconds 1565720075
2019-08-13 14:13:58.592980 ptpd2[32211].net0 (notice)    (slv) msgDebugSync: originTimestamp.nanoseconds 593074438

The announce, sync, and delay responses from master are here, but I would also like to see the delay request sent from the slave. Is there an option I am missing is this even supported in the version of ptpd I am using?

Here is what my config file looks like:

; ==============================================================================
; This is a minimal configuration for a PTPv2 slave
; For a full list of options run ptpd2 -H or see the documentation and man pages.
;
; NOTE: for best results, do read the ptpd2.conf(5) man page as many settings
;       such as outlier filters and statistics filters can greatly improve
;       the operation of PTPd.
; ==============================================================================

; interface has to be specified
ptpengine:interface=net0

; PTP domain
ptpengine:domain=0

; available presets are slaveonly, masteronly and masterslave (full IEEE 1588 implementation)
ptpengine:preset=slaveonly

; multicast for both sync and delay requests - use hybrid for unicast delay requests
ptpengine:ip_mode=multicast

; when enabled, sniffing is used instead of sockets to send and receive packets
ptpengine:use_libpcap=n

; log file, event log only. if timing statistics are needed, see statistics_file
global:log_file=/var/log/ptpd2.log

; status file providing an overview of ptpd's operation and statistics
global:log_status=y

; required if ip_mode is set to hybrid
;ptpengine:log_delayreq_interval=0

; uncomment this to log a timing log like in previous ptpd versions
global:statistics_file=/var/log/ptpd2.stats

; File used to log ptpd2 status information.
global:status_file=/var/run/ptpd2.status

; Enable / disable writing status information to file.
global:log_status=y

; Dump the contents of every PTP packet
global:dump_packets = y

; always keep a new line in the end

Thanks for your time.

ptpd2 responding to management frames with unicast instead of multicast

Is it possible to have ptpd2 respond to PTP Management frames via unicast directly to the master as opposed to sending the PTP management response to the multicast group 224.0.1.129?

With ptpd2 configured as slaveonly in hybrid mode, PTP management queries from the master (sent to 224.0.1.129) are received by ptpd2 and ptpd2 dutifully responds back with the response also sent to 224.0.1.129. This means that every ptpd2 slave now becomes a multicast source, and that (S,G) state must now be tracked by the network. This behavior presents scaling problems.

I was not able to find a configuration option to change this behavior. My goal is to have ptpd2 sent management responses to the unicast address of the master, similar to how delay requests/responses are sent via unicast in hybrid mode.

Thanks for your help.

Help regarding installing PTPd

Hi, can someone please tell me what value to give for interface? I gave my IP address but it didnt work. Thanks.

Update test/client-e2e-socket.conf so that its
"ptpengine:interface = " setting points to a network interface on
your test machine that can see PTP packets from a grandmaster.

multiple ptpd instances

Hi,

Does anyone know a way to configure ptpd to have multiple instances with different domains running at startup?
I'm trying to have one instance running under multicast to a set of slaves running linux, with another running via unicast to another slave running DOS. For some reason the I can't get the DOS machine to find the server when we are using multicast, but if I move to unicast the linux machines stop finding the server. This dual service setup might get around the problem.

Thanks.

Get current Timestamp

Hi all,

first of all thank you for this cool library.

I could bring it to life on my raspi3 and wanted to know if it is possible to get the current timestamp of the ptp clock as I want to send a CAN-message parallelly with the same interval as the PTP Sync is sent.

Or is there any other possibility to realize that?

Thanks a lot.

Niko

how to uses offset_stats.m file?

Hi,
the source code delivers also octave scripts to plot statitics about the clock synch process. How can I get the data ("t" and "tr" in the scripts) out of ptpd? how to uses offset_stats.m file?
Many thanks in advance!

originTimestamp is zero

Hi,

I'm trying to setup a Ubuntu server that synchronizes its time via NTP and sends PTPv2 downstream via unicast messages. In my current setup I'm using unicast negotiation.
The problem that I'm facing is that after the host sends a "Signalling message" with the requested rate to the server, the server answers with another "Signalling message" granting the requests and then following a number of "Announce message" with originTimestamp (both seconds and nanoseconds) set to zero. My host does not seem to like it and fails to synchronize and request unicast transmission in another "Signalling message". However, I have noticed that the current clock we have running in the network actually sends the originTimestamp with some initial values...

Thanks!
Jesus

accumulates open sockets if no PTP master is present until no more file descriptors are available

While running ptpd2 v2.3.2 as slave-only I noticed, that ptpd does stop workingcorrectly when no master has been available for a while (>20h)(test if reproducable is running), or the master reports a time near unix time epoch begin for about 20min (reproducable).

A) While no master is available it does this in the event log roughly every minute:

2016-10-13 12:43:20.057055 ptpd2[5407].eth0 (warning)   (lstn_reset) Still in LISTENING after 5 restarts - restarting transports
2016-10-13 12:43:20.422848 ptpd2[5407].eth0 (notice)    (lstn_reset) Now in state: PTP_LISTENING

B) When master is reporting wrong time 01/01/1970 00:xx:xx, then my client dies this every second:

2016-10-13 11:00:42.131852 ptpd2[492].eth0 (notice)    (lstn_reset) Now in state: PTP_LISTENING
2016-10-13 11:00:42.299015 ptpd2[492].eth0 (info)      (lstn_reset) New best master selected: a0369ffffe9240b4(unknown)/1
2016-10-13 11:00:42.299358 ptpd2[492].eth0 (notice)    (slv) Now in state: PTP_SLAVE, Best master: a0369ffffe9240b4(unknown)/1 (IPv4:192.168.209.236)
2016-10-13 11:00:42.769114 ptpd2[492].eth0 (notice)    (slv) Received first Sync from Master
2016-10-13 11:00:42.789209 ptpd2[492].eth0 (critical)  (slv) Offset above 1 second (1476348743.061028957 s). Clock will step.
2016-10-13 11:00:42.789431 ptpd2[492].eth0 (error)     (slv) Could not set system time      (strerror: Invalid argument)

For every A) and B) it also gets two more open sockets, shown below with lsof:

COMMAND  PID USER   FD   TYPE     DEVICE SIZE/OFF   NODE NAME
... <usual ports>
ptpd2   5407 root   15u  sock        0,8      0t0  11455 can't identify protocol
ptpd2   5407 root   16u  sock        0,8      0t0  11552 can't identify protocol
... <increasing list of shown ports>

Once it "stops working", this is what the event log shows every ten seconds:

2016-10-13 11:13:34.812035 ptpd2[492].eth0 (error)     (init) Could not get interface list      (strerror: Too many open files)
2016-10-13 11:13:34.812266 ptpd2[492].eth0 (error)     (init) Failed to initialize network
2016-10-13 11:13:34.812404 ptpd2[492].eth0 (error)     (flt) PTPd init failed - will retry in 10 seconds

I looked through the code, but could not find a place, where sockets are left behind / are not closed.

Attached the event log of a 20 min run, which ended in the "stop working" state. (PTP master falsely reported 01/01/1970 00:00, which caused ptpd2[492].eth0 (error) (slv) Could not set system time (strerror: Invalid argument) and thus ptpd2[492].eth0 (notice) (lstn_reset) Now in state: PTP_LISTENING is executed twice every second. Thus sockets are used up more quickly.)
ptpd2_master_wrong_time___ptpd_failed_after_20min.txt

Attached the event log and lsof output of a 2h run without PTP master, which is still ongoing and likely to fail after 20h (prediction). Will come back to this, once I can reproduce it.
ptpd2__no_master__2h_elapsed__eventlog.txt
ptpd2_master_wrong_time___ptpd_failed_after_20min.txt

ptpd for android

Hello,

I want to syncronize Android devices via PTP.
Is it possible to port ptpd to an Android device?? Or there is a plan for it? I‘m a beginner on PTP.
And I want to know which project is recommended for porting? ptpd or linuxptp?

Thank you very much!

Default Configuration for Debian, Unbuntu, Mint, MINIX3, Haiku (aka BeOS), Win10 ...

When one installs PTPd, there is no default configuration for it at all.

SO WHEN YOU INSTALL IT, IT IS BROKEN.

THIS IS JUST BAD AND UNCALLED FOR.

THERE IS NO "Character Mode" Configuration Agent -- NOR GUI ONE EITHER ...
-- Nor is there a default configuration file, as far as I can tell ... even NTP has one ...

I have not checked the source code, but I assume it detects Architecture and OS Version and CPUID on x86 and ARM (via non-CPUID instruction)

A Default Configuration (database?) is needed for

  • Debian
  • Unbuntu
  • Mint
  • MINIX3
  • Haiku (aka BeOS)
  • Win10 ...

Quorum of Grandmaster Clocks or Quorum of any PTPd clients-servers RE NTP-SEC Quorum Fix

Quorum of Grandmaster Clocks
or a
Quorum of any PTPd clients-servers

RE NTP-SEC Quorum Fix

NTP-org only recently fixed a long running "Security Issue" by requiring client-server sync to only be made final or doable if and only if there is a quorum of available NTP servers (LOCAL or GLOBAL).

The way PTPd seems to depend on "one and only one" or at best local 2 Grandmasters is just begging for spoofing, local or global.

There is NO DEFAULT CONFIG for most LINUX BRANCHES -- so it all just begs for trouble.

As most PTP configs have NTP also running, this massive security and reliability problem has been hidden by over-provisioning.

PTP should be able to run SOLO like NTP, and work with reasonably better reliability.

Make Error: error: duplicate ‘unsigned’

Hi,

I get this error when ever i start 'make':

In file included from ptpd.h:22:0,
from arith.c:54:
../config.h:351:17: error: duplicate ‘unsigned’
#define uint8_t unsigned char
^
../config.h:351:26: error: two or more data types in declaration specifiers
#define uint8_t unsigned char
^
../config.h:343:18: error: duplicate ‘unsigned’
#define uint32_t unsigned int
^
../config.h:343:27: error: two or more data types in declaration specifiers
#define uint32_t unsigned int
^
../config.h:347:18: error: duplicate ‘unsigned’
#define uint64_t unsigned long int
^
../config.h:347:32: error: two or more data types in declaration specifiers
#define uint64_t unsigned long int

And i am unable to fix config.h as it is being created every time during make.
Please suggest a fix.

How can we generate a PPS signal after synchronizing the PTP with PTPd?

Hi,
I am new to RPI and the PTP concept.

  1. First I would like to ask what hardware do we require to generate a PPS pulse in the GPIO of the RPI and how to transfer it to data acquisition board (for ex: LOGI-PI) for sampling the data?
  2. Can we connect the computer with the RPI3 and make the computer as the grandmaster clock synchronising RPI in micro-sec (like through USB to UART connection- laptop to RPI3) treating the RPI as the master and then slave clock with a computer as grandmaster clock?

Thanks a mil in advance.

Best Regards.

Ignore lock file option causing sync and messaging problems

I have a use case where a single machine runs multiple daemons in parallel where each is bound to separate interface. One daemon runs as a slave while the others run as masters. The idea here is that the slave daemon sets the local time while the master daemons synchronize with computers connected to the associated interface. There are two distinct issues I've encountered in configuring the daemons:

  1. When a daemon is in slave only mode and told to ignore lock files, it does not synchronize with the grand master, nor does it respond to management messages. The .status file shows that the daemon stays in a listening mode with no RX packets received. When using the default locking mechanism (no option passed), it works as expected - it enters slave mode and responds to management messages.
  2. When the daemon is in masterslave mode and passed the argument to ignore lock files, it does not respond to management messages, but does synchronize properly with a slave located on another machine. When using the default locking mechanism (no option passed), it works as expected - it responds to management messages.
  • I have tested the above with both short and long versions of the flags as well as passing a configuration file.
  • I have used both a hard and soft grand master - no change.
  • I am running CentOS 6.6

Triggering a program through ptpd

Hi,

Is there a way to trigger a software/do some action once synchronized bellow a certain threshold?
If not I thought implementing it through the messages management handler.

Thanks!

Update releases for version 2.3.2

Reviewing the Changelog suggests version 2.3.2 has been released. However when viewing the "releases" the latest is 2.3.1.

Hoping to see some new packages rolled for 2.3.2.

good hardware for grandmaster

Hello,
I need a grandmaster to sync my devices. I dont need the exact atomic clock time. I dont need gps. I only want that my network devices runs in sync. I think when the µC has RTC (realt time clock) it is enough. I want to connect the devices over ethernet to the grandmaster.
I need a accuracy of ( < 5µs). First I am seachring a Grandmaster. I did some research and found out, that the raspberry pi is not really suitable for ptp.
Can you recommend some hardware to use as a grandmaster?
I found this µC (https://www.nxp.com/design/development-boards/i.mx-evaluation-and-development-boards/i.mx-rt1020-evaluation-kit:MIMXRT1020-EVK) which is running FreeRTOS. People say you can use this library in FreeRTOS.
Do you recommend this?

Missing definition of MANUFACTURER_ID in 'src/constants.h'

MANUFACTURER_ID is not defined and gets printed out in src/protocol.c, but only if RUNTIME_DEBUG is set, that might be the reason why nobody encountered a build error lately.
It should be assigned a default value in src/constants.h.

The masteronly preset does not support Signalling for Unitcast negotiation

As per IEEE1588, A port that receives a REQUEST_UNICAST_TRANSMISSION TLV entity shall response with a GRANT_UNICAST_TRANSMISSION TLV entity.

screenshot from 2016-06-10 11 20 05

It looks that the master didn't respond anything. Or do I miss any config?


*Update: *
Sorry, I didn't add param ptpengine:unicast_negotiation = Y in the configuration file. Issue closed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.