summaryrefslogtreecommitdiff
path: root/src/connection.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-07-08 19:27:40 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-07-12 20:44:26 +0200
commit5c00b517f7dfcd8edef4819580fa21c38d19c2bc (patch)
tree2b000e9f09c2297d2ca4c934da5a4321234561f2 /src/connection.c
parentec2adfa818da0d6845ff5f0ad1a8e1017cf4461d (diff)
downloadconnman-5c00b517f7dfcd8edef4819580fa21c38d19c2bc.tar.gz
connman-5c00b517f7dfcd8edef4819580fa21c38d19c2bc.tar.bz2
connman-5c00b517f7dfcd8edef4819580fa21c38d19c2bc.zip
Set DNS host routes before toggling the service READY state
update_nameservers() is called when a service hits the READY state. The DNS proxy code will be able to connect to the added nameservers if the right host routes have been set.
Diffstat (limited to 'src/connection.c')
-rw-r--r--src/connection.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/connection.c b/src/connection.c
index 82648d65..dcaa8fe1 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -157,8 +157,6 @@ static void set_default_gateway(struct gateway_data *data)
goto done;
}
- connman_inet_add_host_route(element->index, data->gateway, NULL);
-
if (connman_inet_set_gateway_address(element->index, data->gateway) < 0)
return;
@@ -276,14 +274,20 @@ static int connection_probe(struct connman_element *element)
element->ipv4.gateway = g_strdup(gateway);
}
- service = __connman_element_get_service(element);
- __connman_service_indicate_state(service,
- CONNMAN_SERVICE_STATE_READY);
-
connman_element_set_enabled(element, TRUE);
active_gateway = find_active_gateway();
new_gateway = add_gateway(element->index, gateway);
+ service = __connman_element_get_service(element);
+
+ if (new_gateway) {
+ connman_inet_add_host_route(element->index,
+ new_gateway->gateway, NULL);
+ __connman_service_nameserver_add_routes(service,
+ new_gateway->gateway);
+ }
+
+ __connman_service_indicate_state(service, CONNMAN_SERVICE_STATE_READY);
if (service == NULL) {
new_gateway->vpn = TRUE;
@@ -325,6 +329,7 @@ static void connection_remove(struct connman_element *element)
DBG("element %p name %s", element, element->name);
service = __connman_element_get_service(element);
+ __connman_service_nameserver_del_routes(service);
__connman_service_indicate_state(service,
CONNMAN_SERVICE_STATE_DISCONNECT);