[2/2] resolv: do not add search domains to PTR queries

Submitted by Mathias Kresin on Oct. 18, 2014, 3:16 p.m.

Details

Message ID 1413645366-28119-2-git-send-email-openwrt@kresin.me
State New
Headers show

Commit Message

Mathias Kresin Oct. 18, 2014, 3:16 p.m.
The "IN-ADDR.ARPA" domain is fixed and never needs a search domain.

Signed-off-by: Mathias Kresin <openwrt@kresin.me>
---
 libc/inet/resolv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 3d3a540..7638526 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1478,7 +1478,7 @@  int __dns_lookup(const char *name,
 		 * We were incurring long delays because of this. */
 		if (h.rcode == NXDOMAIN || h.rcode == SERVFAIL) {
 			/* if possible, try first/next search domain */
-			if (!is_fqdn) {
+			if (!is_fqdn && q.qtype != T_PTR) {
 				DPRINTF("variant:%d sdomains:%d\n", variant, sdomains);
 				if (variant < sdomains - 1 || (variant == sdomains -1 && !looks_like_fqdn)) {
 					/* first/next search domain */