Commit Graph

1206 Commits (2f0bfb2837573c4dcbbe440e642aabda0e5d5131)

Author SHA1 Message Date
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
Richard Cochran 3d1d93bcb2 config: convert 'network_transport' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 5d184839d0 config: add support for enumerated types with string labels.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 1080826d6c config: convert 'domainNumber' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 9d929fe424 config: convert 'offsetScaledLogVariance' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 4e27856c8b config: convert 'clockAccuracy' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran a71ecc2816 config: convert 'clockClass' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 0c9d54d3ff config: convert 'priority1' and 'priority2' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran ea574c7e4f config: convert 'slaveOnly' and 'twoStepFlag' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 6fa42d3491 config: convert 'udp6_scope' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 0bb690c16c config: remove the 'port_defaults' structure.
This definition is now empty and can serve no purpose any more.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran bbd8d62bec config: convert the fault interval options to the new scheme.
This conversion is not straightforward due to the fact that these options
can take a value of "ASAP" or a number.  We check for the special ASAP
case in a helper function and leave the numbers to the generic code.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 76f8d5eb48 config: convert 'timeSource' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 5277396b3a config: convert 'sanity_freq_limit' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 0aff268a4e config: convert 'kernel_leap' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran f2da3cc484 config: convert 'summary_interval' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 2816133b5e config: convert 'gmCapable' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 5eeea13652 config: convert 'free_running' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 38c891b2c8 config: clock, port: convert 'boundary_clock_jbod' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran eaa70f165f config: port: convert 'delay_filter_length' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 83e26ec68b config: port: convert 'ingressLatency' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran a19318b413 config: port: convert 'egressLatency' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00
Richard Cochran 3ff0e4a589 config: port: convert 'min_neighbor_prop_delay' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
2015-08-23 21:09:45 +02:00