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).
This commit is contained in:
Miroslav Lichvar 2020-04-15 16:26:43 +02:00
parent 2a4fd0a5c6
commit 0b2e77ae64

View file

@ -703,6 +703,11 @@ NCR_ChangeRemoteAddress(NCR_Instance inst, NTP_Remote_Address *remote_addr, int
{ {
memset(&inst->report, 0, sizeof (inst->report)); memset(&inst->report, 0, sizeof (inst->report));
NCR_ResetInstance(inst); 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; inst->remote_addr = *remote_addr;
if (inst->mode == MODE_CLIENT) 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), SRC_SetRefid(inst->source, UTI_IPToRefid(&remote_addr->ip_addr),
&inst->remote_addr.ip_addr); &inst->remote_addr.ip_addr);
SRC_ResetInstance(inst->source); SRC_ResetInstance(inst->source);
if (!ntp_only)
NAU_ChangeAddress(inst->auth, &remote_addr->ip_addr);
} }
/* ================================================== */ /* ================================================== */