I'll change this patch to use hints.ai_socktype = SOCK_DGRAM; as suggested in comment 2, because we're resolving for a UDP socket here, so we should specify that in the query. Setting the 2nd argument of getaddrinfo() to NULL asks for an arbitrary port rather than the port for NTP (123), and I wonder why this change hasn't broken anything (or it has and we just didn't notice). BTW, if reading /etc/services once is still too much, we can additionally change "ntp" to "123" and set the AI_NUMERICSRV flag, to disable name resolution on the service argument entirely, as it is already being done for the node argument.