mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-06 19:55:06 -05:00
conf: add ipv4 and ipv6 options to server/pool/peer directive
Accept "ipv4" and "ipv6" options in the server/pool/peer directive to use only IPv4 or IPv6 addresses respectively. The configuration is different from the "server [-4|-6] hostname" syntax supported by ntpd to avoid breaking existing scripts which expect the hostname to always be the first argument of the directives.
This commit is contained in:
6
conf.c
6
conf.c
@@ -1664,6 +1664,8 @@ compare_sources(const void *a, const void *b)
|
||||
return d;
|
||||
if ((d = (int)sa->pool - (int)sb->pool) != 0)
|
||||
return d;
|
||||
if ((d = (int)sa->params.family - (int)sb->params.family) != 0)
|
||||
return d;
|
||||
if ((d = (int)sa->params.port - (int)sb->params.port) != 0)
|
||||
return d;
|
||||
return memcmp(&sa->params.params, &sb->params.params, sizeof (sa->params.params));
|
||||
@@ -1728,7 +1730,7 @@ reload_source_dirs(void)
|
||||
/* Add new sources */
|
||||
if (pass == 1 && d > 0) {
|
||||
source = &new_sources[j];
|
||||
s = NSR_AddSourceByName(source->params.name, IPADDR_UNSPEC, source->params.port,
|
||||
s = NSR_AddSourceByName(source->params.name, source->params.family, source->params.port,
|
||||
source->pool, source->type, &source->params.params,
|
||||
&new_ids[j]);
|
||||
|
||||
@@ -1843,7 +1845,7 @@ CNF_AddSources(void)
|
||||
for (i = 0; i < ARR_GetSize(ntp_sources); i++) {
|
||||
source = (NTP_Source *)ARR_GetElement(ntp_sources, i);
|
||||
|
||||
s = NSR_AddSourceByName(source->params.name, IPADDR_UNSPEC, source->params.port,
|
||||
s = NSR_AddSourceByName(source->params.name, source->params.family, source->params.port,
|
||||
source->pool, source->type, &source->params.params, NULL);
|
||||
if (s != NSR_Success && s != NSR_UnresolvedName)
|
||||
LOG(LOGS_ERR, "Could not add source %s", source->params.name);
|
||||
|
||||
Reference in New Issue
Block a user