@@ -525,7 +525,8 @@ void __connman_wpad_stop(struct connman_service *service);
typedef void (*__connman_wispr_cb_t) (struct connman_service *service,
enum connman_ipconfig_type type,
- bool success);
+ bool success,
+ int err);
int __connman_wispr_init(void);
void __connman_wispr_cleanup(void);
@@ -163,7 +163,8 @@ static void vpn_auto_connect(void);
static void trigger_autoconnect(struct connman_service *service);
static void complete_online_check(struct connman_service *service,
enum connman_ipconfig_type type,
- bool success);
+ bool success,
+ int err);
static bool service_downgrade_online_state(struct connman_service *service);
struct find_data {
@@ -1902,6 +1903,11 @@ static void reschedule_online_check(struct connman_service *service,
* check.
* @param[in] success A Boolean indicating whether the previously-
* requested online check was successful.
+ * @param[in] err The error status associated with previously-
+ * requested online check. This is expected
+ * to be zero ('0') if @a success is @a true
+ * and less than zero ('< 0') if @a success
+ * is @a false.
*
* @sa cancel_online_check
* @sa start_online_check
@@ -1911,16 +1917,17 @@ static void reschedule_online_check(struct connman_service *service,
*/
static void complete_online_check(struct connman_service *service,
enum connman_ipconfig_type type,
- bool success)
+ bool success,
+ int err)
{
unsigned int *interval;
guint *timeout;
- DBG("service %p (%s) type %d (%s) success %d\n",
+ DBG("service %p (%s) type %d (%s) success %d err %d (%s)\n",
service,
connman_service_get_identifier(service),
type, __connman_ipconfig_type2string(type),
- success);
+ success, err, strerror(-err));
if (type == CONNMAN_IPCONFIG_TYPE_IPV4) {
interval = &service->online_check_interval_ipv4;
@@ -564,7 +564,7 @@ static void portal_manage_success_status(GWebResult *result,
&str))
connman_info("Client-Timezone: %s", str);
- wp_context->cb(service, type, true);
+ wp_context->cb(service, type, true, 0);
}
static bool wispr_route_request(const char *address, int ai_family,
@@ -618,6 +618,8 @@ static bool wispr_route_request(const char *address, int ai_family,
static void wispr_portal_request_portal(
struct connman_wispr_portal_context *wp_context)
{
+ int err = 0;
+
DBG("wispr/portal context %p service %p (%s) type %d (%s)",
wp_context,
wp_context->service,
@@ -634,10 +636,13 @@ static void wispr_portal_request_portal(
wp_context->status_url,
wispr_portal_web_result,
wispr_route_request,
- wp_context, NULL);
+ wp_context, &err);
if (wp_context->request_id == 0) {
- wp_context->cb(wp_context->service, wp_context->type, false);
+ wp_context->cb(wp_context->service,
+ wp_context->type,
+ false,
+ err);
wispr_portal_error(wp_context);
wispr_portal_context_unref(wp_context);
}
@@ -910,11 +915,26 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
goto done;
case GWEB_HTTP_STATUS_CODE_BAD_REQUEST:
+ wp_context->cb(wp_context->service,
+ wp_context->type,
+ false,
+ -EINVAL);
+ break;
+
case GWEB_HTTP_STATUS_CODE_NOT_FOUND:
- case GWEB_HTTP_STATUS_CODE_REQUEST_TIMEOUT:
- wp_context->cb(wp_context->service, wp_context->type, false);
+ wp_context->cb(wp_context->service,
+ wp_context->type,
+ false,
+ -ENOENT);
+ break;
+ case GWEB_HTTP_STATUS_CODE_REQUEST_TIMEOUT:
+ wp_context->cb(wp_context->service,
+ wp_context->type,
+ false,
+ -ETIMEDOUT);
break;
+
case GWEB_HTTP_STATUS_CODE_HTTP_VERSION_NOT_SUPPORTED:
wispr_portal_context_ref(wp_context);
__connman_agent_request_browser(wp_context->service,
@@ -977,7 +997,10 @@ static void proxy_callback(const char *proxy, void *user_data)
if (!proxy) {
DBG("no valid proxy");
- wp_context->cb(wp_context->service, wp_context->type, false);
+ wp_context->cb(wp_context->service,
+ wp_context->type,
+ false,
+ -EINVAL);
return;
}
@@ -1312,7 +1335,7 @@ int __connman_wispr_start(struct connman_service *service,
return 0;
free_wp:
- wp_context->cb(wp_context->service, wp_context->type, false);
+ wp_context->cb(wp_context->service, wp_context->type, false, err);
g_hash_table_remove(wispr_portal_hash, GINT_TO_POINTER(index));
return err;