From 0b2e77ae647b35ec5897354f6f8e903c6f56712d Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Wed, 15 Apr 2020 16:26:43 +0200 Subject: [PATCH] ntp: update auth-specific address sooner When replacing an NTP source, update the NTS address before the NTP address to save cookies with the old NTP address instead of the newly resolved address (which may immediately change to an address provided by NTS-KE). --- ntp_core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ntp_core.c b/ntp_core.c index c4da33d..3b262ea 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -703,6 +703,11 @@ NCR_ChangeRemoteAddress(NCR_Instance inst, NTP_Remote_Address *remote_addr, int { memset(&inst->report, 0, sizeof (inst->report)); NCR_ResetInstance(inst); + + /* Update the authentication-specific address before NTP address */ + if (!ntp_only) + NAU_ChangeAddress(inst->auth, &remote_addr->ip_addr); + inst->remote_addr = *remote_addr; if (inst->mode == MODE_CLIENT) @@ -718,9 +723,6 @@ NCR_ChangeRemoteAddress(NCR_Instance inst, NTP_Remote_Address *remote_addr, int SRC_SetRefid(inst->source, UTI_IPToRefid(&remote_addr->ip_addr), &inst->remote_addr.ip_addr); SRC_ResetInstance(inst->source); - - if (!ntp_only) - NAU_ChangeAddress(inst->auth, &remote_addr->ip_addr); } /* ================================================== */