mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-03 13:47:04 +03:00
Merge pull request #25743 from yuwata/timesync-ipv6
timesync: ignore IPv6 addresses when the kernel does not support it
This commit is contained in:
commit
993681def8
@ -754,7 +754,7 @@ static int manager_resolve_handler(sd_resolve_query *q, int ret, const struct ad
|
||||
assert(ai->ai_addrlen >= offsetof(struct sockaddr, sa_data));
|
||||
|
||||
if (!IN_SET(ai->ai_addr->sa_family, AF_INET, AF_INET6)) {
|
||||
log_warning("Unsuitable address protocol for %s", m->current_server_name->string);
|
||||
log_debug("Ignoring unsuitable address protocol for %s.", m->current_server_name->string);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -808,11 +808,6 @@ int manager_connect(Manager *m) {
|
||||
if (m->current_server_address && m->current_server_address->addresses_next)
|
||||
manager_set_server_address(m, m->current_server_address->addresses_next);
|
||||
else {
|
||||
static const struct addrinfo hints = {
|
||||
.ai_flags = AI_NUMERICSERV|AI_ADDRCONFIG,
|
||||
.ai_socktype = SOCK_DGRAM,
|
||||
};
|
||||
|
||||
/* Hmm, we are through all addresses, let's look for the next host instead */
|
||||
if (m->current_server_name && m->current_server_name->names_next)
|
||||
manager_set_server_name(m, m->current_server_name->names_next);
|
||||
@ -880,6 +875,12 @@ int manager_connect(Manager *m) {
|
||||
|
||||
log_debug("Resolving %s...", m->current_server_name->string);
|
||||
|
||||
struct addrinfo hints = {
|
||||
.ai_flags = AI_NUMERICSERV|AI_ADDRCONFIG,
|
||||
.ai_socktype = SOCK_DGRAM,
|
||||
.ai_family = socket_ipv6_is_supported() ? AF_UNSPEC : AF_INET,
|
||||
};
|
||||
|
||||
r = resolve_getaddrinfo(m->resolve, &m->resolve_query, m->current_server_name->string, "123", &hints, manager_resolve_handler, NULL, m);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to create resolver: %m");
|
||||
|
Loading…
x
Reference in New Issue
Block a user