Skip to content

Commit

Permalink
dns-example: add CNAME support
Browse files Browse the repository at this point in the history
  • Loading branch information
azat committed May 24, 2021
1 parent 19b3fd0 commit 862b83f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sample/dns-example.c
Expand Up @@ -60,6 +60,11 @@ main_callback(int result, char type, int count, int ttl,
void *addrs, void *orig) {
char *n = (char*)orig;
int i;

if (type == DNS_CNAME) {
printf("%s: %s (CNAME)\n", n, (char*)addrs);
}

for (i = 0; i < count; ++i) {
if (type == DNS_IPv4_A) {
printf("%s: %s\n", n, debug_ntoa(((u32*)addrs)[i]));
Expand Down Expand Up @@ -252,7 +257,7 @@ main(int c, char **v) {
gai_callback, v[optind]);
} else {
fprintf(stderr, "resolving (fwd) %s...\n",v[optind]);
evdns_base_resolve_ipv4(evdns_base, v[optind], 0, main_callback, v[optind]);
evdns_base_resolve_ipv4(evdns_base, v[optind], DNS_CNAME_CALLBACK, main_callback, v[optind]);
}
}
fflush(stdout);
Expand Down

0 comments on commit 862b83f

Please sign in to comment.