From df0b45e61c7f8fda5e376bdeadfb58783e8a8ed1 Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Thu, 26 Oct 2023 10:47:56 -0700 Subject: [PATCH] Print dns errors --- net_util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net_util.c b/net_util.c index 19ec49f..f7e2193 100644 --- a/net_util.c +++ b/net_util.c @@ -31,6 +31,7 @@ static char *dns_resolve_filter(const char *host, int32_t family, uint8_t max_ad // If no host supplied, then use local machine name if (!host) { err = gethostname(name, sizeof(name)); + printf("gethostname %d\n", err); if (err != 0) goto dns_resolve_error; } else { @@ -44,6 +45,7 @@ static char *dns_resolve_filter(const char *host, int32_t family, uint8_t max_ad hints.ai_protocol = IPPROTO_TCP; err = getaddrinfo(name, NULL, &hints, &address_info); + printf("getaddrinfo1 %d\n", err); if (err != EAI_NONAME) { if (err != 0) goto dns_resolve_error; @@ -55,6 +57,7 @@ static char *dns_resolve_filter(const char *host, int32_t family, uint8_t max_ad hints.ai_flags = 0; err = getaddrinfo(name, NULL, &hints, &address_info); + printf("getaddrinfo2 %d\n", err); if (err != 0) goto dns_resolve_error; @@ -90,6 +93,7 @@ static char *dns_resolve_filter(const char *host, int32_t family, uint8_t max_ad // Copy address name into return string err = getnameinfo(address->ai_addr, (socklen_t)address->ai_addrlen, ai_string + ai_string_len, (uint32_t)(max_ai_string - ai_string_len), NULL, 0, NI_NUMERICHOST); + printf("getnameinfo %d\n", err); if (err != 0) goto dns_resolve_error;