From: Azat Khuzhin Date: Mon, 24 May 2021 18:03:58 +0000 (+0300) Subject: dns-example: add CNAME support X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=862b83f9b6296eddd44d637897b6c86545797e7f;p=libevent dns-example: add CNAME support --- diff --git a/sample/dns-example.c b/sample/dns-example.c index 2d07c387..87221fdc 100644 --- a/sample/dns-example.c +++ b/sample/dns-example.c @@ -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])); @@ -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);