Re: [chrony-dev] Chrony 1.26 released

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Wed, Jul 13, 2011 at 04:41:57PM +0100, Ed W wrote:
> - with 1.25 (by default) using dns names for servers and starting chrony
> before networking is up, causes chrony to fail to resolve the names and
> essentially those servers are dropped.

Only if the returned error is different from EAI_AGAIN.

With the forcednsretry option (in 1.26 by default) all errors are
treated as EAI_AGAIN and chronyd will retry in exponentially
increasing intervals until it succeeds.

> - networking comes up even a few seconds later (oops forgot to plug in
> the cable) but now chrony continues without any servers?

Yes.

> I guess the ideal situation would be that dns request failures (network
> failures) cause a retry, but an authoritive name server declaring
> NXDOMAIN causes the server to be dropped?

It would be. The problem seems to be that it's not possible to
reliably tell which one of the two really happened. Things may be
further complicated by having a local caching nameserver.

> Presumably the issue is that
> Network Manager answers NXDOMAIN if the network down? (untested - just
> guessing?)

NetworkManager just configures /etc/resolv.conf. One problem is that
the file is not cleared on shutdown/reboot, so there can be some
nameservers specified in the file before the network is up. Another
problem could be with the IPv6 tentative addresses, they can't be used
for few seconds after the interface is brought up. And now there is
the problem that EAI_NONAME is returned even with empty resolv.conf. 

I've attached a small C program which you can use to test what errors
getaddrinfo() returns. On Linux the error codes are:

# define EAI_NONAME       -2    /* NAME or SERVICE is unknown.  */
# define EAI_AGAIN        -3    /* Temporary failure in name resolution.  */
# define EAI_FAIL         -4    /* Non-recoverable failure in name res.  */

-- 
Miroslav Lichvar
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

#include <string.h>

#include <stdio.h>
#include <unistd.h>

#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>


int main(int argc, char **argv) {
	struct addrinfo hints, *addr;
	int r;

	memset(&hints, 0, sizeof(hints));
	hints.ai_family = AF_UNSPEC;
	//hints.ai_family = AF_INET;
	hints.ai_socktype = SOCK_STREAM;

	r = getaddrinfo(argv[1], NULL, &hints, &addr);

	if (!r) {
		do {
			printf("flags=%d family=%d socktype=%d protocol=%d canonname=%s \n", addr->ai_flags, addr->ai_family, addr->ai_socktype, addr->ai_protocol, addr->ai_canonname);
		} while ((addr = addr->ai_next));
	} else {
		printf("error = %d (%s)\n", r, gai_strerror(r));
	}

	return 0;
}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/