Skip to content

Commit

Permalink
Print dns errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Oct 26, 2023
1 parent 2bb908f commit df0b45e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit df0b45e

Please sign in to comment.