From: Miroslav Lichvar Date: Mon, 22 Aug 2016 11:14:45 +0000 (+0200) Subject: ntp: fix processing of kernel timestamps on non-Linux systems X-Git-Tag: 2.4.1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12befc2afd43b41c72e982e6b24966965697fcf1;p=thirdparty%2Fchrony.git ntp: fix processing of kernel timestamps on non-Linux systems 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. --- diff --git a/ntp_io.c b/ntp_io.c index cf087deb..88fc76e3 100644 --- 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));