From fd9b063db9ea7e9fdc4073e565f6c5c406d298a6 Mon Sep 17 00:00:00 2001 From: Antonio Mignolli Date: Tue, 1 Aug 2023 21:07:57 +0200 Subject: [PATCH] Retry according to number of desired retries, no matter the error type. Signed-off-by: Antonio Mignolli --- src/config.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/config.c b/src/config.c index 81ccb479..43a4ea70 100644 --- a/src/config.c +++ b/src/config.c @@ -242,21 +242,11 @@ static inline bool parse_endpoint(struct sockaddr *endpoint, const char *value) ret = getaddrinfo(begin, end, &hints, &resolved); if (!ret) break; - /* The set of return codes that are "permanent failures". All other possibilities are potentially transient. - * - * This is according to https://sourceware.org/glibc/wiki/NameResolver which states: - * "From the perspective of the application that calls getaddrinfo() it perhaps - * doesn't matter that much since EAI_FAIL, EAI_NONAME and EAI_NODATA are all - * permanent failure codes and the causes are all permanent failures in the - * sense that there is no point in retrying later." - * - * So this is what we do, except FreeBSD removed EAI_NODATA some time ago, so that's conditional. - */ - if (ret == EAI_NONAME || ret == EAI_FAIL || - #ifdef EAI_NODATA - ret == EAI_NODATA || - #endif - (retries >= 0 && !retries--)) { + /* + Treating all errors as possibly temporary. + Armbian has been reported to not distinguish between a temporary and a permanent DNS resolution error + */ + if (retries >= 0 && !retries--) { free(mutable); fprintf(stderr, "%s: `%s'\n", ret == EAI_SYSTEM ? strerror(errno) : gai_strerror(ret), value); return false;