]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: fix transposition with timestamping packet info
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 8 Oct 2018 13:54:07 +0000 (15:54 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 8 Oct 2018 13:54:07 +0000 (15:54 +0200)
Don't forget to include the length of the frame check sequence (FCS) in
the RX timestamp transposition when the L2 length of the received packet
is from SCM_TIMESTAMPING_PKTINFO.

This fixes commit 934d4047f12741f4052e35c7975f72c5307b3e68.

ntp_io_linux.c

index 819792aa47cb1b7bfc746e3ce3650b6bef6ee086..eb4a3a83a3baff14956ccf0e43bc6b7f9658ee39 100644 (file)
@@ -584,7 +584,11 @@ process_hw_timestamp(struct Interface *iface, struct timespec *hw_ts,
   if (rx_ntp_length && iface->link_speed) {
     if (!l2_length)
       l2_length = (family == IPADDR_INET4 ? iface->l2_udp4_ntp_start :
-                   iface->l2_udp6_ntp_start) + rx_ntp_length + 4;
+                   iface->l2_udp6_ntp_start) + rx_ntp_length;
+
+    /* Include the frame check sequence (FCS) */
+    l2_length += 4;
+
     rx_correction = l2_length / (1.0e6 / 8 * iface->link_speed);
 
     UTI_AddDoubleToTimespec(hw_ts, rx_correction, hw_ts);