It was a cute idea to have the raw Ethernet layer use just one socket,
but it ended up not working on some specific PTP time stamping hardware.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Although the UDP/IPv4 layer does not need any state per instance (other
than the two file descriptors), the raw Ethernet layer will need this.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
If the networking stack fails to provide a transmit time stamp, then we
might feed uninitialized stack data to the CMSG(3) macros. This can result
in a segfault or other badness.
The fix is to simply clear the control buffer in advance.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Commit 32133050 introduced a bug that gives a bogus error message on
every 'general' (non-event) PTP packet. If we want to catch missing
time stamps, then it has to occur at the port level.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Without this Linux specific option, multicast packets arrive on one
interface are delivered by the kernel to all others.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
For some reason, MCAST_JOIN_GROUP is not working under uClinux. We can
just stick with the more traditional method.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Even though the MCAST_JOIN_GROUP socket option includes the interface
index, this applies to the received packets only. To bind the outgoing
packets to a particular interface, the IP_MULTICAST_IF option is needed.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>