return is_connected_state(service, service->state);
}
+static const char *nameserver_get_ifname(struct connman_service *service)
+{
+ const char *ifname;
+
+ if (service->ipconfig_ipv4)
+ ifname = __connman_ipconfig_get_ifname(service->ipconfig_ipv4);
+ else if (service->ipconfig_ipv6)
+ ifname = __connman_ipconfig_get_ifname(service->ipconfig_ipv6);
+ else
+ ifname = NULL;
+
+ if (ifname == NULL)
+ return NULL;
+
+ switch (combine_state(service->state_ipv4, service->state_ipv6)) {
+ case CONNMAN_SERVICE_STATE_UNKNOWN:
+ case CONNMAN_SERVICE_STATE_IDLE:
+ case CONNMAN_SERVICE_STATE_ASSOCIATION:
+ case CONNMAN_SERVICE_STATE_CONFIGURATION:
+ case CONNMAN_SERVICE_STATE_FAILURE:
+ case CONNMAN_SERVICE_STATE_DISCONNECT:
+ return NULL;
+ case CONNMAN_SERVICE_STATE_READY:
+ case CONNMAN_SERVICE_STATE_ONLINE:
+ break;
+ }
+
+ return ifname;
+}
+
+static void remove_nameservers(struct connman_service *service,
+ const char* interface, char **ns)
+{
+ const char *ifname = interface;
+ int i;
+
+ if (ns == NULL)
+ return;
+
+ if (interface == NULL)
+ ifname = nameserver_get_ifname(service);
+
+ if (ifname == NULL)
+ return;
+
+ for (i = 0; ns[i] != NULL; i++)
+ connman_resolver_remove(ifname, NULL, ns[i]);
+}
+
+static void remove_searchdomains(struct connman_service *service,
+ const char *interface, char **sd)
+{
+ const char *ifname = interface;
+ int i;
+
+ if (sd == NULL)
+ return;
+
+ if (interface == NULL)
+ ifname = nameserver_get_ifname(service);
+
+ if (ifname == NULL)
+ return;
+
+ for (i = 0; sd[i] != NULL; i++)
+ connman_resolver_remove(ifname, sd[i], NULL);
+}
+
static void update_nameservers(struct connman_service *service)
{
const char *ifname;
if (service->userconnect == TRUE &&
__connman_agent_report_error(service,
error2string(service->error),
- report_error_cb, NULL) == -EIO)
+ report_error_cb, NULL) == -EINPROGRESS)
return 0;
service_complete(service);
} else
return -EINPROGRESS;
}
- __connman_service_ipconfig_indicate_state(service,
- CONNMAN_SERVICE_STATE_FAILURE,
- CONNMAN_IPCONFIG_TYPE_IPV4);
- __connman_service_ipconfig_indicate_state(service,
- CONNMAN_SERVICE_STATE_FAILURE,
- CONNMAN_IPCONFIG_TYPE_IPV6);
-
if (service->network != NULL)
__connman_network_disconnect(service->network);
else if (service->type == CONNMAN_SERVICE_TYPE_VPN &&
if (service->userconnect == TRUE) {
if (err == -ENOKEY || err == -EPERM) {
- if (__connman_agent_request_passphrase_input(service,
- request_input_cb,
- NULL) == -EIO)
- return -EINPROGRESS;
+ return __connman_agent_request_passphrase_input(service,
+ request_input_cb, NULL);
}
reply_pending(service, -err);
}
if (service->favorite == TRUE) {
device = connman_network_get_device(service->network);
- if (device && __connman_device_scanning(device) == FALSE)
+ if (device && connman_device_get_scanning(device) == FALSE)
__connman_service_auto_connect();
}