From: Pasi Sjöholm <pasi.sjoh...@jollamobile.com>

If domain_append is true and a valid domain tld (eg. com. net. bz.)
is queried we need to make sure that responses with ancount>0 are
preferred over ones with ancount==0. This is due queries againts
valid domain tld's will always have response code ns_r_noerror even
there are no valid records. This will solve the issue dnsproxy not
returning the expected response if hostname queried is equal to any
valid tld.
---
 src/dnsproxy.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 7232b98..73bd52b 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -2068,8 +2068,13 @@ static int forward_dns_reply(unsigned char *reply, int 
reply_len, int protocol,
        }
 
 out:
-       if (hdr->rcode > 0 && req->numresp < req->numserv)
-               return -EINVAL;
+       if (req->numresp < req->numserv) {
+               if (hdr->rcode > ns_r_noerror) {
+                       return -EINVAL;
+               } else if (hdr->ancount == 0 && req->append_domain) {
+                       return -EINVAL;
+               }
+       }
 
        request_list = g_slist_remove(request_list, req);
 
-- 
1.9.1

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to