summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-11-12 16:30:39 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2010-11-13 23:35:37 +0100
commit18151aa9ff937fe04abea3af39fbbe442565dc31 (patch)
tree0e3a41d1e295a515f6d38c49ba27fd8b3b59e65a
parent357f45e79a88d01d0a605d1e3dc50d729f047adf (diff)
downloadconnman-18151aa9ff937fe04abea3af39fbbe442565dc31.tar.gz
connman-18151aa9ff937fe04abea3af39fbbe442565dc31.tar.bz2
connman-18151aa9ff937fe04abea3af39fbbe442565dc31.zip
dnsproxy: Handle POLLERR and POLLHUP on the nameserver UDP socket
poll is restarted when ConnMan receives a new UDP request from the client. Fixes BMC#9960
-rw-r--r--plugins/dnsproxy.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/dnsproxy.c b/plugins/dnsproxy.c
index 448c7a5e..a2413990 100644
--- a/plugins/dnsproxy.c
+++ b/plugins/dnsproxy.c
@@ -450,12 +450,13 @@ static void destroy_server(struct server_data *server)
static gboolean udp_server_event(GIOChannel *channel, GIOCondition condition,
gpointer user_data)
{
- struct server_data *data = user_data;
unsigned char buf[4096];
int sk, err, len;
if (condition & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
- connman_error("Error with server channel");
+ struct server_data *data = user_data;
+
+ connman_error("Error with UDP server %s", data->server);
data->watch = 0;
return FALSE;
}
@@ -676,7 +677,8 @@ static struct server_data *create_server(const char *interface,
data->timeout = g_timeout_add_seconds(30, tcp_idle_timeout,
data);
} else
- data->watch = g_io_add_watch(data->channel, G_IO_IN,
+ data->watch = g_io_add_watch(data->channel,
+ G_IO_IN | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
udp_server_event, data);
data->interface = g_strdup(interface);
@@ -727,6 +729,11 @@ static gboolean resolv(struct request_data *req,
if (data->enabled == FALSE)
continue;
+ if (data->watch == 0 && data->protocol == IPPROTO_UDP)
+ data->watch = g_io_add_watch(data->channel,
+ G_IO_IN | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
+ udp_server_event, data);
+
if (ns_resolv(data, req, request, name) < 0)
continue;
}