mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:45:07 -05:00
ntp: drop precompensation of TX timestamp
The daemon transmit timestamps are precompensated for the time it takes to generate a MAC using a symmetric key (as measured on chronyd start) and also an average round-trip time of the Samba signing of MS-SNTP responses. This improves accuracy of the transmit timestamp, but it has some issues. The correction has a random error which is changing over time due to variable CPU frequency, system load, migration to a different machine, etc. If the measured delay is too large, the correction may cause the transmit timestamp to be later than the actual transmission. Also, the delay is measured for a packet of a minimal length with no extension fields, and there is no support for NTS. Drop the precompensation in favor of the interleaved mode, which now avoids the authentication delay even when no kernel/hardware timestamps are available.
This commit is contained in:
34
ntp_auth.c
34
ntp_auth.c
@@ -96,24 +96,6 @@ check_symmetric_auth(NTP_Packet *packet, NTP_PacketInfo *info)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
adjust_timestamp(NTP_AuthMode mode, uint32_t key_id, struct timespec *ts)
|
||||
{
|
||||
switch (mode) {
|
||||
case NTP_AUTH_SYMMETRIC:
|
||||
ts->tv_nsec += KEY_GetAuthDelay(key_id);
|
||||
UTI_NormaliseTimespec(ts);
|
||||
break;
|
||||
case NTP_AUTH_MSSNTP:
|
||||
ts->tv_nsec += NSD_GetAuthDelay(key_id);
|
||||
UTI_NormaliseTimespec(ts);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static int
|
||||
is_zero_data(unsigned char *data, int length)
|
||||
{
|
||||
@@ -230,14 +212,6 @@ NAU_PrepareRequestAuth(NAU_Instance instance)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
NAU_AdjustRequestTimestamp(NAU_Instance instance, struct timespec *ts)
|
||||
{
|
||||
adjust_timestamp(instance->mode, instance->key_id, ts);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
int
|
||||
NAU_GenerateRequestAuth(NAU_Instance instance, NTP_Packet *request, NTP_PacketInfo *info)
|
||||
{
|
||||
@@ -397,14 +371,6 @@ NAU_CheckRequestAuth(NTP_Packet *request, NTP_PacketInfo *info, uint32_t *kod)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
void
|
||||
NAU_AdjustResponseTimestamp(NTP_Packet *request, NTP_PacketInfo *info, struct timespec *ts)
|
||||
{
|
||||
adjust_timestamp(info->auth.mode, info->auth.mac.key_id, ts);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
int
|
||||
NAU_GenerateResponseAuth(NTP_Packet *request, NTP_PacketInfo *request_info,
|
||||
NTP_Packet *response, NTP_PacketInfo *response_info,
|
||||
|
||||
Reference in New Issue
Block a user