If we receive nameservers from vpnd we must set them in provider.
The connman_provider_set_nameservers() function needs changes
because we get the nameservers as an array, it makes no sense to
convert the array to string and then back to array.
int connman_provider_set_domain(struct connman_provider *provider,
const char *domain);
int connman_provider_set_nameservers(struct connman_provider *provider,
- const char *nameservers);
+ char * const *nameservers);
int connman_provider_append_route(struct connman_provider *provider,
const char *key, const char *value);
resolv_host_addr(data);
+ if (data->nameservers != NULL)
+ connman_provider_set_nameservers(data->provider,
+ data->nameservers);
+
if (data->connect_pending == TRUE)
connect_provider(data, data->cb_data);
set_routes(data->provider,
CONNMAN_PROVIDER_ROUTE_USER);
} else if (g_str_equal(key, "Nameservers") == TRUE) {
- extract_nameservers(&value, data);
+ if (extract_nameservers(&value, data) == 0 &&
+ data->nameservers != NULL)
+ connman_provider_set_nameservers(data->provider,
+ data->nameservers);
}
if (ip_set == TRUE && err == 0) {
}
int connman_provider_set_nameservers(struct connman_provider *provider,
- const char *nameservers)
+ char * const * nameservers)
{
int i;
- char **nameservers_array = NULL;
- DBG("provider %p nameservers %s", provider, nameservers);
+ DBG("provider %p nameservers %p", provider, nameservers);
__connman_service_nameserver_clear(provider->vpn_service);
if (nameservers == NULL)
return 0;
- nameservers_array = g_strsplit(nameservers, " ", 0);
-
- for (i = 0; nameservers_array[i] != NULL; i++) {
+ for (i = 0; nameservers[i] != NULL; i++)
__connman_service_nameserver_append(provider->vpn_service,
- nameservers_array[i], FALSE);
- }
-
- g_strfreev(nameservers_array);
+ nameservers[i], FALSE);
return 0;
}