summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaesub kim <taesub.kim@samsung.com>2017-02-07 02:24:21 -0800
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2017-02-07 02:24:21 -0800
commit074b6f009a49abab5e55e3bddd3bd90e59c27bc6 (patch)
tree2d8e82ac954ee13f0a817966237184cdae4f0462
parentdab24ad2d7cd118d10099ab0bc6d3c96b14988a5 (diff)
parent77076d221356867d576bba8084614f1b15700597 (diff)
downloadconnman-074b6f009a49abab5e55e3bddd3bd90e59c27bc6.tar.gz
connman-074b6f009a49abab5e55e3bddd3bd90e59c27bc6.tar.bz2
connman-074b6f009a49abab5e55e3bddd3bd90e59c27bc6.zip
Merge "[connman]: Fixed: ConnMan keep trying connection infintely" into tizen
-rwxr-xr-xinclude/network.h2
-rwxr-xr-xinclude/service.h1
-rwxr-xr-xplugins/wifi.c29
-rwxr-xr-xsrc/network.c16
-rwxr-xr-xsrc/service.c2
5 files changed, 45 insertions, 5 deletions
diff --git a/include/network.h b/include/network.h
index a6095224..68dc4107 100755
--- a/include/network.h
+++ b/include/network.h
@@ -58,6 +58,8 @@ enum connman_network_error {
#if defined TIZEN_EXT
CONNMAN_NETWORK_ERROR_DHCP_FAIL = 5,
#endif
+ CONNMAN_NETWORK_ERROR_BLOCKED = 6,
+
};
#define CONNMAN_NETWORK_PRIORITY_LOW -100
diff --git a/include/service.h b/include/service.h
index fe55d4bc..ff296138 100755
--- a/include/service.h
+++ b/include/service.h
@@ -83,6 +83,7 @@ enum connman_service_error {
CONNMAN_SERVICE_ERROR_LOGIN_FAILED = 5,
CONNMAN_SERVICE_ERROR_AUTH_FAILED = 6,
CONNMAN_SERVICE_ERROR_INVALID_KEY = 7,
+ CONNMAN_SERVICE_ERROR_BLOCKED = 8,
};
enum connman_service_proxy_method {
diff --git a/plugins/wifi.c b/plugins/wifi.c
index c9d8c808..84d07088 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -133,6 +133,8 @@ struct wifi_data {
struct connman_network *scan_pending_network;
bool allow_full_scan;
#endif
+ int disconnect_code;
+
};
#if defined TIZEN_EXT
@@ -2661,6 +2663,25 @@ static void interface_state(GSupplicantInterface *interface)
network, wifi))
break;
+#if defined TIZEN_EXT
+ wifi->disconnect_code = g_supplicant_interface_get_disconnect_reason(wifi->interface);
+ DBG("Disconnect Reason code %d", wifi->disconnect_code);
+#endif
+ /* See table 8-36 Reason codes in IEEE Std 802.11 */
+ switch (wifi->disconnect_code) {
+ case 1: /* Unspecified reason */
+ /* Let's assume it's because we got blocked */
+
+ case 6: /* Class 2 frame received from nonauthenticated STA */
+ connman_network_set_error(network,
+ CONNMAN_NETWORK_ERROR_BLOCKED);
+ break;
+
+ default:
+ break;
+ }
+
+
/* We disable the selected network, if not then
* wpa_supplicant will loop retrying */
if (g_supplicant_interface_enable_selected_network(interface,
@@ -2669,13 +2690,11 @@ static void interface_state(GSupplicantInterface *interface)
#if defined TIZEN_EXT
int err;
- int reason_code = 0;
err = g_supplicant_interface_remove_network(wifi->interface);
if (err < 0)
DBG("Failed to remove network(%d)", err);
- reason_code = g_supplicant_interface_get_disconnect_reason(wifi->interface);
/* Some of Wi-Fi networks are not comply Wi-Fi specification.
* Retry association until its retry count is expired */
@@ -2685,9 +2704,9 @@ static void interface_state(GSupplicantInterface *interface)
break;
}
- if(reason_code > 0){
- DBG("Set disconnect reason code(%d)", reason_code);
- connman_network_set_disconnect_reason(network, reason_code);
+ if(wifi->disconnect_code > 0){
+ DBG("Set disconnect reason code(%d)", wifi->disconnect_code);
+ connman_network_set_disconnect_reason(network, wifi->disconnect_code);
}
/* To avoid unnecessary repeated association in wpa_supplicant,
diff --git a/src/network.c b/src/network.c
index 715c8ea9..86876192 100755
--- a/src/network.c
+++ b/src/network.c
@@ -1403,6 +1403,17 @@ static void set_connect_error(struct connman_network *network)
CONNMAN_SERVICE_ERROR_CONNECT_FAILED);
}
+static void set_blocked_error(struct connman_network *network)
+{
+ struct connman_service *service;
+
+ service = connman_service_lookup_from_network(network);
+
+ __connman_service_indicate_error(service,
+ CONNMAN_SERVICE_ERROR_BLOCKED);
+}
+
+
#if defined TIZEN_EXT
static void set_dhcp_error(struct connman_network *network)
{
@@ -1477,6 +1488,11 @@ void connman_network_set_error(struct connman_network *network,
set_dhcp_error(network);
break;
#endif
+
+ case CONNMAN_NETWORK_ERROR_BLOCKED:
+ set_blocked_error(network);
+ break;
+
}
__connman_network_disconnect(network);
diff --git a/src/service.c b/src/service.c
index f24f4913..f5611705 100755
--- a/src/service.c
+++ b/src/service.c
@@ -412,6 +412,8 @@ static const char *error2string(enum connman_service_error error)
return "auth-failed";
case CONNMAN_SERVICE_ERROR_INVALID_KEY:
return "invalid-key";
+ case CONNMAN_SERVICE_ERROR_BLOCKED:
+ return "blocked";
}
return NULL;