If handle unknown management tlv. The management message id and format are
also unknown, thus we may crash due to access unknown area.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
TLV_PRIORITY1 and TLV_PRIORITY2 cases in do_set_action() use the same repeated
piece of generic code for setting one-value parameter. Remove the duplicated
code and let both cases use the same code.
Signed-off-by: Petr Kulhavy <brain@jikos.cz>
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>
This patch introduces generic code for adding and parsing new options.
The public 'get' methods return option values directly. Although the
API is easy to use, it does not provide error checking in case the
option does not exist or if there is a type mismatch.
Therefore the code performs a BIST to ensure that the options are
properly populated. In addition, the code terminates the program in
case of missing options or type mismatches. This heavy handed
approach is meant to catch errors during development and should never
trigger during normal usage.
As a first element, we include an option for specifying the UDP TTL.
Users are required to call 'config_init', and so this patch add that into
all three programs, ptp4l, phc2sys and pmc.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
In the near future, the transports will need to consult the configuration
database in order to obtain various options. This patch also introduces
the idea of a configuration file into the phc2sys and pmc programs.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch lets the pmc program change the priority1 and priority2
elements of the "default data set" at run time.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
In pmc and phc2sys handle terminating signals and close the UDS
transport before exit to remove the sockets in /var/run.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
This patch adds a new pmc command called "target" that lets the user
address a particular clock and port. Previously all management requests
were sent to the wild card address.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch makes the original behavior of sending the
TLV values for GET actions with a length of zero.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Add a batch mode, where the commands are taken from the command line
instead of the standard input.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
The printing facility is used by different programs, allow to set the
program name which prefixes the messages written to stdout.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Previously if a command's full name was a prefix of another command
then parse_id would return AMBIGUOUS_ID. This was a problem for the
TIME and various TIME_* messages.