summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorTim Hockin <thockin@google.com>2016-03-09 22:12:23 +0100
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-03-10 21:50:25 +0100
commit8c85b44f6ab42561207365f19b9d1fd69d960771 (patch)
treebbdf13106ea6564eeb4cce008f436cb962cd44f9 /libc
parent2ac8348609b63d6f3a87cb27ce17deff889c6a73 (diff)
DNS: Don't apply search domains to PTR lookups
This lessens the load on upstream DNS servers (and it was just nonsensical). Signed-off-by: Tim Hockin <thockin@google.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/resolv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index e676f5371..f378c9b9d 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1264,7 +1264,7 @@ int __dns_lookup(const char *name,
int variant = -1; /* search domain to append, -1: none */
int local_ns_num = -1; /* Nth server to use */
int local_id = local_id; /* for compiler */
- int sdomains;
+ int sdomains = 0;
bool ends_with_dot;
sockaddr46_t sa;
@@ -1302,7 +1302,9 @@ int __dns_lookup(const char *name,
* or do other Really Bad Things. */
__UCLIBC_MUTEX_LOCK(__resolv_lock);
__open_nameservers();
- sdomains = __searchdomains;
+ if (type != T_PTR) {
+ sdomains = __searchdomains;
+ }
lookup[name_len] = '\0';
if ((unsigned)variant < sdomains) {
/* lookup is name_len + 1 + MAXLEN_searchdomain + 1 long */