Commit Graph

1028 Commits (0c30ab463f13073bc48fc9a3393c2e1bac1ef116)

Author SHA1 Message Date
Richard Cochran 8f7fb11fbc Perform the time stamping mode check in the clock module.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 14:45:41 +02:00
Richard Cochran adf36154f5 clock: offer a method to get the first port in the list.
This function will allow the TC code to iterate over the ports without
calling into the clock logic.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 14:45:41 +02:00
Richard Cochran 948d511550 clock: offer a method to get the type rather than the number of ports.
The port code is not interested in the number of ports but rather the
clock type.  Since the polymorphic clock object will be able to report
its own type, this patch changes the clock interface accordingly.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 14:45:41 +02:00
Richard Cochran fd2eb9411f Move the clock type enumeration into the clock header.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 14:45:41 +02:00
Richard Cochran bbe55fbea4 clock: remove redundant parameter from the create method.
There is no need for the 'ifaces' parameter since the list of network
interfaces is already present in the configuration.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 14:45:41 +02:00
Richard Cochran 9b27664cfc clock: simplify the create method.
With the new configuration API, there is no need to pass the default data
set.  Instead, the clock code can read the configuration directly.  This
patch simplifies the clock create method by removing the 'dds' parameter
and moving the code that initialized the data set into the clock module.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 14:45:41 +02:00
Richard Cochran 2fc2af97d8 config: get the time stamp information early.
There is no need to have a function to get this information as
we can easily obtain it when the interface is first created.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 14:45:41 +02:00
Richard Cochran 1b7088dea8 print: add missing include directive.
This patch adds a #include needed for the declaration of the function,
rate_limited.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 14:45:41 +02:00
Richard Cochran 62ce44a08a fault: protect header against multiple inclusion.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 14:45:41 +02:00
Richard Cochran 01dcf7e9ac Properly initialize the message lists.
The message lists are implemented using a TAILQ from queue(3).  The heads
of the list must be initialized using the provided macros, since the field
called 'tqh_last' is non-zero in the initial state.  This patch fixes a
potential null pointer dereference by properly initializing the queues.

Note that there is no actual bug in the current code, because it uses the
lists in such a way as to initialize 'tqh_last' before any dereference.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 14:45:41 +02:00
Richard Cochran 3f2ef92052 tsproc: Fix time stamp handling with P2P one shot mode.
When the P2P link partner is using one shot mode, the residence time
in the peer (t3 - t2) is reflected in the correction field of the
peer delay response message, and t2 and t3 are both zero.

The function port_peer_delay() calls clock_peer_delay(), passing in
the zero valued 't2' to the 'rx' argument.  The latter function then
stores the zero value in the 't4' field of the clock's tsproc
instance.

As a result, tsproc_update_offset() returns an error to
clock_synchronize(), and so a slave clock will never leave the
"uncalibrated" state.

This patch fixes the issue by removing the test for a non-zero 't4'
field within the tsproc.

Acked-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2016-04-03 13:33:10 +02:00
Miroslav Lichvar 999c86f4a9 tsproc: allow zero remote timestamps in delay update
When remote timestamps from P2P delay measurement are not known (the
remote processing time is saved in the correction field), they are set
to zero. Fix tsproc to not require non-zero t1 and t4.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2015-11-20 20:00:37 +01:00
Wolfgang Wallner 6eec5a0d48 Fix typo in manpage of ptp4l
There is one parenthesis too many in the manpage of ptp4l.
2015-11-01 19:46:19 +01:00
Richard Cochran b9aa4d783e Version 1.6
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-09-19 16:25:11 +02:00
Libor Pechacek 4a875d4e3d Update UTC offset
The difference between Coordinated Universal Time UTC and the International
Atomic Time TAI is :

     from 2015 July 1, 0h UTC, until further notice : UTC-TAI = -36 s

https://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat

Signed-off-by: Libor Pechacek <lpechacek@suse.com>
2015-09-17 13:12:28 +02:00
Miroslav Lichvar cdd11b744b port: print bogus delay request message as rate limited info.
Upgrade the message level to info so the user can see it, but print it
at most once per 5 minutes to not spam the syslog too much.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2015-09-11 21:24:34 +02:00
Miroslav Lichvar ddd653e7a9 print: add rate limited versions of pr_* macros.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2015-09-11 21:24:34 +02:00
Miroslav Lichvar 01d523fb48 util: add function for simple rate limiting.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2015-09-11 21:24:34 +02:00
Richard Cochran 776f772c36 Merge the hybrid E2E work.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-09-05 21:40:48 +02:00
Richard Cochran 2201345058 uds: restore delay mechanism to zero value.
The new configuration code inadvertently causes the UDS port to use P2P
messaging when P2P is set as a global option.  This results in a never
ending series of "missing timestamp" error messages from the UDS port as
it vainly tries to send peer delay requests.

This patch fixes the bug by changing the UDS delay mechanism back to zero
as it was before.  This is the appropriate setting for the UDS port,
because it never leaves the listening state and thus never sends an E2E
delay request.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-09-05 21:27:04 +02:00
Miroslav Lichvar d8bfa0fa69 udp6: set hop limit with udp_ttl option.
Use the udp_ttl option to configure both IPv4 and IPv6 transports.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2015-08-31 15:39:41 +02:00
Richard Cochran e85cb68320 Support hybrid E2E using unicast delay requests and responses.
The draft Enterprise Profile [1] specifies a hybrid E2E delay mechanism,
where the delay response message is sent "in kind".  That is, if the
request is unicast, then the response is also unicast.  Apparently this
scheme is already in widespread use in some industries.  Also, it makes
sense, because those messages are of no interest to the other slaves in
the PTP network.

Because of the address work already in place, in turns out that adding
this mode is almost trivial.  This patch introduces an "hybrid_e2e" option
that enabled the new mode.

1. https://datatracker.ietf.org/doc/draft-ietf-tictoc-ptp-enterprise-profile

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-29 11:33:34 +02:00
Richard Cochran d0eb73c87b Use the standardized low level socket address format.
The raw Ethernet transport code invented its own way of storing the MAC
address into our "struct address" data structure.  However, this private
format is incompatible with the sockaddr_ll returned from the networking
stack.  This patch converts the code to use the proper format.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-29 11:32:41 +02:00
Richard Cochran 1e35b91c6a udp6: set the destination port unconditionally.
Even if the caller provides the destination address, still the port must
depend on the passed 'event' value for correct delivery.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-29 11:32:29 +02:00
Richard Cochran 8d1b30d91c udp: set the destination port unconditionally.
Even if the caller provides the destination address, still the port must
depend on the passed 'event' value for correct delivery.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-29 11:32:29 +02:00
Miroslav Lichvar f44178476b timemaster: use wrapped memory allocation functions. 2015-08-29 10:33:35 +02:00
Miroslav Lichvar 16bb89d5bf util: exit in string_* and parray_* functions when allocation fails. 2015-08-29 10:33:35 +02:00
Miroslav Lichvar e4325ee3fb util: add wrappers for memory allocation functions.
Add wrappers for malloc(), calloc(), realloc() and strdup() that check
if the allocation failed, print an error message and call exit(1). This
allows the caller to use the returned value without checking for errors.
2015-08-29 10:33:35 +02:00
Richard Cochran 0135e5344d port: constrain the master's logMinDelayReqInterval.
Buggy or mis-configured masters can place bogus logMessageInterval values
in their delay response messages.  This patch places reasonable limits on
the range of values that we will accept.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-28 17:55:32 +02:00
Richard Cochran a8a3ddec6a Fix integer overflow in the foreign master bookkeeping code.
The logMessageInterval field has an improbable range from 2^-128 to 2^127
seconds.  The extreme ends cause an integer overflow in the calculation
of the "foreign master time window".  Buggy or mis-configured foreign
masters advertising extreme values will cause incorrect announce message
aging.

This patch fixes the issue by adding thresholds for the bogus extremes.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-28 17:02:01 +02:00
Richard Cochran 7b438defe5 config: introduce a proper creation method.
Now that all of the legacy, open coded configuration fields are gone,
we can follow a normal create/destroy pattern for the configuration.
This patch add the new method and converts the programs to use it.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:48:09 +02:00
Richard Cochran 70ea3f3f32 config: refactor the parsing code.
Now that all of the legacy parsing code is gone, there remain two
identical parsing functions.  This patch removes them both and places
the common code at the original call site.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:21:43 +02:00
Richard Cochran 1e9ffd50ae config: save a block from falling off the RHS of the page.
This patch rearranges the guts of the main parsing loop to keep it
more within the 80th column.  The logic has not been changed.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:21:43 +02:00
Richard Cochran 13aec6d133 config: remove the last remaining legacy item.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:21:43 +02:00
Richard Cochran e82462e295 config: convert 'manufacturerIdentity' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:21:43 +02:00
Richard Cochran bf229e1e0f config: convert 'userDescription' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:21:43 +02:00
Richard Cochran b708ee3845 config: convert 'revisionData' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:21:43 +02:00
Richard Cochran 4e23ac1b21 config: convert 'productDescription' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:21:43 +02:00
Richard Cochran efa91dda77 util: provide the 'count_char' helper function.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:21:43 +02:00
Richard Cochran e27b036d09 config: convert 'uds_address' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran 852c288ebe config: convert 'p2p_dst_mac', letting it be a per-port option.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran a31f2d0ddf config: convert 'ptp_dst_mac', letting it be a per-port option.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran 5fe77584b4 util: add a helper function to scan a MAC address.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran c05dcce724 config: introduce a string type.
Global default values will be static strings, but values from the
configuration file will be dynamic, so the code remembers whether or it
should free the string when cleaning up.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran 30157821f7 ptp4l: set print levels earlier.
Now we have debug messages in the configuration code.  Therefore set up
the print levels immediately after parsing the command line and the file,
so that those messages have a chance to be seen.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran 8836f3cc67 config: convert 'clock_servo' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran ed566513e0 config: convert 'time_stamping' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran b6a91303a9 config: convert 'delay_filter' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:46 +02:00
Richard Cochran a8b550887d config: convert 'tsproc_mode' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran bf29022005 config: convert 'delay_mechanism' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00