Since size_t is an unsigned data type, it won't evaluate correctly on errors
of vasprintf(). This patch makes 'len2' a signed integer, as expected by
vasprintf().
'len2' is of type 'size_t' in util.c:451, but vasprintf in line
457 returns '-1' on error which is checked in line 460. Currently
this check will always fail (regardless of the return value of
vasprintf()), according to its declaration as unsigned int.
[ RC: Added more explanation taken from another list message. ]
Signed-off-by: Henry Jesuiter <henry.jesuiter@alcnetworx.de>
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>
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.
This modifies all transports to use a new common address type, struct
address. This address is stored in a ptp_message for all received messages.
For sending, the "default" address is used with the default sending
functions, transport_send and transport_peer. The default address depends on
the transport; it's supposed to be the multicast address assigned by the
transport specification.
Later, a new transport_sendto function will be implemented that sends to the
address contained in the passed ptp_message.
Signed-off-by: Jiri Benc <jbenc@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>
The get_ranged_ and get_arg_ declarations and definitions are just a wee
bit much too long. This patch breaks the overly long lines into two.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This patch adds functions to get int, uint, double value from string
with error checking and range specification.
These functions don't allow overflow and outside of the range values.
In addition, it adds parser_result cases "MALFORMED" and "OUT_OF_RANGE" to make
reason of parse error more clear.
Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
Update the currentUtcOffset and leap61/59 values at one minute
interval. When a leap second is detected, set the STA_INS/STA_DEL
bit for the system clock.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Modifies existing structs changing Octet *foo -> Octet foo[0] and
marks them PACKED so the message buffer can be cast to the structs.
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
static_ptp_text is like a PTPText that includes space for the text
which makes it more convenient for ptp texts stored in the clock.
Signed-off-by: Geoff Salmon <gsalmon@se-instruments.com>
We already have a grand master state. Adding this event will simplify the
overall logic, since it will avoid the silly requirement to set the
qualification timeout to zero when entering the grand master state.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>