]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: fix processing of kernel timestamps on non-Linux systems
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 22 Aug 2016 11:14:45 +0000 (13:14 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 21 Nov 2016 11:02:51 +0000 (12:02 +0100)
When the SO_TIMESTAMP socket option was enabled, the expected type of
control messages containing timestamps was SO_TIMESTAMP instead of
SCM_TIMESTAMP. This worked on Linux, where the two values are equal, but
not on the other supported systems. The timestamps were ignored and this
probably worsened the accuracy and stability of the synchronisation.

ntp_io.c

index cf087deb224e93c11b6b41c85f1512dd3075047c..88fc76e3c8f653f9c4883248b0e7e6111f038a5f 100644 (file)
--- a/ntp_io.c
+++ b/ntp_io.c
@@ -556,7 +556,7 @@ read_from_socket(void *anything)
 #endif
 
 #ifdef SO_TIMESTAMP
-      if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SO_TIMESTAMP) {
+      if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_TIMESTAMP) {
         struct timeval tv;
 
         memcpy(&tv, CMSG_DATA(cmsg), sizeof(tv));