hack: use dietlibc's resolver to avoid static compiliation issues with bionic's getaddrinfo() returning only null instead of opening the expected connection to /dev/socket/dnsproxyd

This commit is contained in:
Chris Renshaw 2019-10-30 02:47:24 -03:00 committed by topjohnwu
parent adb9e131ce
commit 4b30a324c4

View File

@ -11,6 +11,8 @@
#include <netinet/in.h>
#include <net/if.h>
#include <sys/un.h>
#include <netdb.h>
#include "../libres/dietdns.h"
#if ENABLE_IFPLUGD || ENABLE_FEATURE_MDEV_DAEMON || ENABLE_UEVENT
# include <linux/netlink.h>
#endif
@ -277,7 +279,7 @@ IF_NOT_FEATURE_IPV6(sa_family_t af = AF_INET;)
* for each possible socket type (tcp,udp,raw...): */
hint.ai_socktype = SOCK_STREAM;
hint.ai_flags = ai_flags & ~DIE_ON_ERROR;
rc = getaddrinfo(host, NULL, &hint, &result);
rc = diet_getaddrinfo(host, NULL, &hint, &result); /* hack to use dietlibc's resolver to work around static compile issue */
if (rc || !result) {
bb_error_msg("bad address '%s'", org_host);
if (ai_flags & DIE_ON_ERROR)
@ -304,7 +306,7 @@ IF_NOT_FEATURE_IPV6(sa_family_t af = AF_INET;)
set_nport(&r->u.sa, htons(port));
ret:
if (result)
freeaddrinfo(result);
diet_freeaddrinfo(result); /* hack to use dietlibc's resolver to work around static compile issue */
return r;
}
#if !ENABLE_FEATURE_IPV6