Skip to content

Commit

Permalink
dnsproxy: Enable DNS servers on connected VPN split routing changes
Browse files Browse the repository at this point in the history
[dnsproxy] Enable DNS servers on conn VPN split routing changes. JB#48769

If split routing is enabled on a connected VPN the DNS servers of the
VPN should be enabled as well when the default service is switched to be
the transport service.
  • Loading branch information
LaakkonenJussi committed Mar 17, 2021
1 parent 1b9ebd2 commit 9addbe6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions connman/src/dnsproxy.c
Expand Up @@ -2883,6 +2883,7 @@ static void dnsproxy_default_changed(struct connman_service *service)
bool server_enabled = false;
GSList *list;
int index;
int vpn_index;

DBG("service %p", service);

Expand All @@ -2899,13 +2900,23 @@ static void dnsproxy_default_changed(struct connman_service *service)
if (index < 0)
return;

/*
* In case non-split-routed VPN is set as split routed the DNS servers
* the VPN must be enabled as well, when the transport becomes the
* default service.
*/
vpn_index = __connman_connection_get_vpn_index(index);

for (list = server_list; list; list = list->next) {
struct server_data *data = list->data;

if (data->index == index) {
DBG("Enabling DNS server %s", data->server);
data->enabled = true;
server_enabled = true;
} else if (data->index == vpn_index) {
DBG("Enabling DNS server of VPN %s", data->server);
data->enabled = true;
} else {
DBG("Disabling DNS server %s", data->server);
data->enabled = false;
Expand Down

0 comments on commit 9addbe6

Please sign in to comment.