Merge tag 'upstream/1.40' into tizen.
[platform/upstream/connman.git] / src / wispr.c
old mode 100644 (file)
new mode 100755 (executable)
index c63dc81..fb101a1
@@ -424,6 +424,10 @@ static void wispr_portal_error(struct connman_wispr_portal_context *wp_context)
        DBG("Failed to proceed wispr/portal web request");
 
        wp_context->wispr_result = CONNMAN_WISPR_RESULT_FAILED;
+
+#if defined TIZEN_EXT
+       connman_service_set_internet_connection(wp_context->service, false);
+#endif
 }
 
 static void portal_manage_status(GWebResult *result,
@@ -713,6 +717,9 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
        const char *str = NULL;
        guint16 status;
        gsize length;
+#if defined TIZEN_MAINTAIN_ONLINE
+       static int retried = 0;
+#endif
 
        DBG("");
 
@@ -744,6 +751,9 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
                                wp_context->status_url, wp_context);
                break;
        case 200:
+#if defined TIZEN_MAINTAIN_ONLINE
+               retried = 0;
+#endif
                if (wp_context->wispr_msg.message_type >= 0)
                        break;
 
@@ -786,7 +796,19 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
        case 404:
                __connman_service_online_check(wp_context->service,
                                                wp_context->type, false);
-
+#if defined TIZEN_MAINTAIN_ONLINE
+                       if (wp_context->type == CONNMAN_IPCONFIG_TYPE_IPV4) {
+                               if (retried == 0) {
+                                       connman_agent_report_error(wp_context->service,
+                                               __connman_service_get_path(wp_context->service),
+                                               "internet-unreachable",
+                                               NULL, NULL, NULL);
+
+                                       retried = 1;
+                               }
+                               break;
+                       }
+#endif
                break;
        case 505:
                __connman_agent_request_browser(wp_context->service,
@@ -875,6 +897,9 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
        case CONNMAN_SERVICE_TYPE_GPS:
        case CONNMAN_SERVICE_TYPE_VPN:
        case CONNMAN_SERVICE_TYPE_P2P:
+#if defined TIZEN_EXT_WIFI_MESH
+       case CONNMAN_SERVICE_TYPE_MESH:
+#endif
                return -EOPNOTSUPP;
        }
 
@@ -905,7 +930,9 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
                goto done;
        }
 
+#if !defined TIZEN_EXT
        if (getenv("CONNMAN_WEB_DEBUG"))
+#endif
                g_web_set_debug(wp_context->web, web_debug, "WEB");
 
        if (wp_context->type == CONNMAN_IPCONFIG_TYPE_IPV4) {
@@ -951,6 +978,11 @@ int __connman_wispr_start(struct connman_service *service,
 
        DBG("service %p", service);
 
+#if defined TIZEN_EXT
+       if (connman_service_get_type(service) == CONNMAN_SERVICE_TYPE_CELLULAR)
+               return -EPERM;
+#endif
+
        if (!wispr_portal_list)
                return -EINVAL;