dnsproxy: Use TCP connections only for the intended request
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 16 Nov 2012 12:32:58 +0000 (14:32 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 19 Nov 2012 12:55:55 +0000 (14:55 +0200)
The DNS proxy code creates and uses a TCP connection only for a single
request at a time. A TCP DNS proxy is added to the end of the server
list, but should not be used for generic requests as the connection
will be closed down after the response to the initial request. Any
other requests sent over the connection will silently disappear.

Add a check to ignore TCP DNS servers for generic lookups.

src/dnsproxy.c

index 7de4e38..df1f6d2 100644 (file)
@@ -2224,6 +2224,11 @@ static gboolean resolv(struct request_data *req,
        for (list = server_list; list; list = list->next) {
                struct server_data *data = list->data;
 
+               if (data->protocol == IPPROTO_TCP) {
+                       DBG("server %s ignored proto TCP", data->server);
+                       continue;
+               }
+
                DBG("server %s enabled %d", data->server, data->enabled);
 
                if (data->enabled == FALSE)