diff options
author | Chao Chen <cchen@cyngn.com> | 2014-09-15 15:41:26 -0700 |
---|---|---|
committer | Chao Chen <cchen@cyngn.com> | 2014-09-15 15:42:23 -0700 |
commit | 8a2d041a2fce6b557cabd212af68a521a02de55a (patch) | |
tree | 06969cff0e3a124b3187542c2178f8390b37f7c4 | |
parent | 53c2af91d6bc2e44c53aea98a06a76834e59fe09 (diff) | |
download | bionic-8a2d041a2fce6b557cabd212af68a521a02de55a.zip bionic-8a2d041a2fce6b557cabd212af68a521a02de55a.tar.gz bionic-8a2d041a2fce6b557cabd212af68a521a02de55a.tar.bz2 |
Revert "DNS: make the same ip type DNS query as the interface address type"
This reverts commit 53c2af91d6bc2e44c53aea98a06a76834e59fe09.
The reverted commit broke vpn connect.
Change-Id: I7e80dcf1fa1ba86effbe7716d50a5a08be7898ad
-rw-r--r-- | libc/netbsd/net/getaddrinfo.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/libc/netbsd/net/getaddrinfo.c b/libc/netbsd/net/getaddrinfo.c index 8aee153..937c423 100644 --- a/libc/netbsd/net/getaddrinfo.c +++ b/libc/netbsd/net/getaddrinfo.c @@ -1880,57 +1880,6 @@ static bool _using_default_dns(const char *iface) return false; } - -static bool _iface_has_ipv4_addr(const char *iface) -{ - int fd; - struct ifreq ifr; - struct sockaddr* sa; - - if (iface == NULL || *iface == '\0') return true; - - fd = socket(AF_INET, SOCK_DGRAM, 0); - - strlcpy(ifr.ifr_name, iface, sizeof(iface)); - if ( ioctl(fd, SIOCGIFADDR, &ifr) < 0 ) { - close(fd); - return false; - } - close(fd); - - sa = (struct sockaddr*)&ifr.ifr_addr; - if ( sa->sa_family == AF_INET) { - return true; - } else { - return false; - } -} - -static bool _iface_has_ipv6_addr(const char *iface) -{ - FILE* fp; - char buff[35]; - int if_index,len,scope,dad_status; - char if_name[IFNAMSIZ]; - - if (iface == NULL || *iface == '\0') return true; - - if ((fp=fopen("/proc/net/if_inet6", "r")) != NULL) - { - while (fscanf(fp, "%32s %08x %02x %02x %02x %20s\n", - buff, &if_index, &len, - &scope, &dad_status, if_name)!=EOF) - { - if (!strcmp(if_name, iface)) { - fclose(fp); - return true; - } - } - fclose(fp); - } - return false; -} - /*ARGSUSED*/ static int _dns_getaddrinfo(void *rv, void *cb_data, va_list ap) @@ -1983,17 +1932,6 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap) if (_using_default_dns(iface)) { query_ipv6 = _have_ipv6(); query_ipv4 = _have_ipv4(); - } else { - if (_iface_has_ipv4_addr(iface)) { - query_ipv4 = 1; - } else { - query_ipv4 = 0; - } - if (_iface_has_ipv6_addr(iface)) { - query_ipv6 = 1; - } else { - query_ipv6 = 0; - } } } if (query_ipv6) { |