ntp: enable NTS support

Add an option to enable NTS for an NTP source. Check for NTS-specific
extension fields and pass the packets to the NTS-NTP code in order to
enable the NTS client and server.
This commit is contained in:
Miroslav Lichvar
2020-02-04 15:27:24 +01:00
parent 6043632f80
commit c41508723f
7 changed files with 74 additions and 1 deletions

View File

@@ -559,7 +559,17 @@ NCR_CreateInstance(NTP_Remote_Address *remote_addr, NTP_Source_Type type,
result->auto_offline = params->auto_offline;
result->poll_target = params->poll_target;
if (params->authkey != INACTIVE_AUTHKEY) {
if (params->nts) {
IPSockAddr nts_address;
if (result->mode == MODE_ACTIVE)
LOG(LOGS_WARN, "NTS not supported with peers");
nts_address.ip_addr = remote_addr->ip_addr;
nts_address.port = params->nts_port;
result->auth = NAU_CreateNtsInstance(&nts_address, name, &result->remote_addr);
} else if (params->authkey != INACTIVE_AUTHKEY) {
result->auth = NAU_CreateSymmetricInstance(params->authkey);
} else {
result->auth = NAU_CreateNoneInstance();