Skip to content

Commit

Permalink
dnsproxy: Check split routing when creating a server
Browse files Browse the repository at this point in the history
If VPN is not the default service i.e., default route is not via
VPN service then we need to add the VPN specified DNS server to
the proxy because some of the DNS queries might be to the VPN domain.

Reported-by: Yevhen Kyriukha <kirgene@gmail.com>
  • Loading branch information
jukkar authored and pfl committed Mar 7, 2014
1 parent 27dba28 commit 86373b4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/connman.h
Expand Up @@ -738,6 +738,7 @@ void __connman_service_set_pac(struct connman_service *service,
const char *pac);
bool __connman_service_is_hidden(struct connman_service *service);
bool __connman_service_is_split_routing(struct connman_service *service);
bool __connman_service_index_is_split_routing(int index);
int __connman_service_get_index(struct connman_service *service);
void __connman_service_set_hidden(struct connman_service *service);
void __connman_service_set_hostname(struct connman_service *service,
Expand Down
4 changes: 3 additions & 1 deletion src/dnsproxy.c
Expand Up @@ -2282,7 +2282,9 @@ static struct server_data *create_server(int index,
}

if (protocol == IPPROTO_UDP) {
if (__connman_service_index_is_default(data->index)) {
if (__connman_service_index_is_default(data->index) ||
__connman_service_index_is_split_routing(
data->index)) {
data->enabled = true;
DBG("Adding DNS server %s", data->server);
}
Expand Down
14 changes: 14 additions & 0 deletions src/service.c
Expand Up @@ -2393,6 +2393,20 @@ __connman_service_is_split_routing(struct connman_service *service)
return service->do_split_routing;
}

bool __connman_service_index_is_split_routing(int index)
{
struct connman_service *service;

if (index < 0)
return false;

service = __connman_service_lookup_from_index(index);
if (!service)
return false;

return __connman_service_is_split_routing(service);
}

int __connman_service_get_index(struct connman_service *service)
{
if (!service)
Expand Down

0 comments on commit 86373b4

Please sign in to comment.