summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiraj Kumar Goit <niraj.g@samsung.com>2016-06-15 20:13:09 +0530
committerNiraj Kumar Goit <niraj.g@samsung.com>2016-06-17 03:33:30 -0700
commit6e3436df89f8293c60ef750a6e442f1203f56d40 (patch)
treee9e19f6567b81ce68400ca0221ee69295db903f7
parent5858fc542fa6bd5766e6caee92e1a437656ce8de (diff)
downloadconnman-6e3436df89f8293c60ef750a6e442f1203f56d40.tar.gz
connman-6e3436df89f8293c60ef750a6e442f1203f56d40.tar.bz2
connman-6e3436df89f8293c60ef750a6e442f1203f56d40.zip
[SPIN] Added the connman disconnect reason property.
Change-Id: I11fd7baa7d00fa3f3a12bdafda7ff7aa6943d020 Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
-rwxr-xr-xgsupplicant/gsupplicant.h1
-rwxr-xr-xgsupplicant/supplicant.c31
-rwxr-xr-xinclude/network.h3
-rwxr-xr-xplugins/wifi.c8
-rwxr-xr-xsrc/dhcp.c7
-rwxr-xr-xsrc/network.c20
-rwxr-xr-xsrc/service.c12
7 files changed, 82 insertions, 0 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 83525e36..8efa202b 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -293,6 +293,7 @@ int g_supplicant_interface_disconnect(GSupplicantInterface *interface,
#if defined TIZEN_EXT
int g_supplicant_interface_remove_network(GSupplicantInterface *interface);
+int g_supplicant_interface_get_disconnect_reason(GSupplicantInterface *interface);
#endif
int g_supplicant_interface_set_apscan(GSupplicantInterface *interface,
unsigned int ap_scan);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 6fb9c7b4..89591fee 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -181,6 +181,9 @@ struct _GSupplicantInterface {
GHashTable *bss_mapping;
void *data;
const char *pending_peer_path;
+#if defined TIZEN_EXT
+ int disconnect_reason;
+#endif
};
struct g_supplicant_bss {
@@ -2280,6 +2283,17 @@ static void interface_property(const char *key, DBusMessageIter *iter,
} else if (g_strcmp0(key, "Networks") == 0) {
supplicant_dbus_array_foreach(iter, interface_network_added,
interface);
+#if defined TIZEN_EXT
+ } else if (g_strcmp0(key, "DisconnectReason") == 0) {
+ int disconnect_reason = 0;
+
+ dbus_message_iter_get_basic(iter, &disconnect_reason);
+ interface->disconnect_reason = disconnect_reason;
+
+ SUPPLICANT_DBG("disconnect reason (%d)",
+ interface->disconnect_reason);
+
+#endif
} else
SUPPLICANT_DBG("key %s type %c",
key, dbus_message_iter_get_arg_type(iter));
@@ -5651,6 +5665,23 @@ int g_supplicant_interface_remove_network(GSupplicantInterface *interface)
return network_remove(data);
}
+
+int g_supplicant_interface_get_disconnect_reason(GSupplicantInterface *interface)
+{
+ int reason_code = 0;
+
+ SUPPLICANT_DBG("");
+
+ if (interface == NULL)
+ return -EINVAL;
+
+ if (system_available == FALSE)
+ return -EFAULT;
+
+ reason_code = interface->disconnect_reason;
+
+ return reason_code;
+}
#endif
static const char *g_supplicant_rule0 = "type=signal,"
diff --git a/include/network.h b/include/network.h
index c3d75acb..4b852b52 100755
--- a/include/network.h
+++ b/include/network.h
@@ -149,6 +149,9 @@ unsigned int connman_network_get_is_hs20AP(struct connman_network *network);
int connman_network_set_keymgmt(struct connman_network *network,
unsigned int keymgmt);
unsigned int connman_network_get_keymgmt(struct connman_network *network);
+int connman_network_set_disconnect_reason(struct connman_network *network,
+ int reason_code);
+int connman_network_get_disconnect_reason(struct connman_network *network);
#endif
int connman_network_set_name(struct connman_network *network,
diff --git a/plugins/wifi.c b/plugins/wifi.c
index f8642ad0..632e138e 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2674,11 +2674,14 @@ 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 */
if (handle_wifi_assoc_retry(network, wifi) == true) {
@@ -2687,6 +2690,11 @@ 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);
+ }
+
/* To avoid unnecessary repeated association in wpa_supplicant,
* "RemoveNetwork" should be made when Wi-Fi is disconnected */
if (wps != true && wifi->network && wifi->disconnecting == false) {
diff --git a/src/dhcp.c b/src/dhcp.c
index 5514c332..644aac6a 100755
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -528,7 +528,14 @@ static int dhcp_initialize(struct connman_dhcp *dhcp)
dhcp_client = g_dhcp_client_new(G_DHCP_IPV4, index, &error);
if (error != G_DHCP_CLIENT_ERROR_NONE)
+#if defined TIZEN_EXT
+ {
+ DBG("failed g_dhcp_client_new(%d), index(%d)", error, index);
+#endif
return -EINVAL;
+#if defined TIZEN_EXT
+ }
+#endif
#if !defined TIZEN_EXT
if (getenv("CONNMAN_DHCP_DEBUG")) {
diff --git a/src/network.c b/src/network.c
index f67dbb68..57a1db39 100755
--- a/src/network.c
+++ b/src/network.c
@@ -100,6 +100,7 @@ struct connman_network {
unsigned int keymgmt;
char *keymgmt_type;
bool rsn_selected;
+ int disconnect_reason;
#endif
} wifi;
@@ -1962,6 +1963,25 @@ unsigned int connman_network_get_keymgmt(struct connman_network *network)
return network->wifi.keymgmt;
}
+
+int connman_network_set_disconnect_reason(struct connman_network *network,
+ int reason_code)
+{
+ if (network == NULL)
+ return 0;
+
+ network->wifi.disconnect_reason = reason_code;
+
+ return 0;
+}
+
+int connman_network_get_disconnect_reason(struct connman_network *network)
+{
+ if (network == NULL)
+ return 0;
+
+ return network->wifi.disconnect_reason;
+}
#endif
int connman_network_set_nameservers(struct connman_network *network,
diff --git a/src/service.c b/src/service.c
index 2325f64e..81409269 100755
--- a/src/service.c
+++ b/src/service.c
@@ -157,6 +157,13 @@ struct connman_service {
*/
int user_pdn_connection_refcount;
bool storage_reload;
+ /*
+ * Description: In case of EAP security type,
+ * user can select the keymgmt type for roaming(802.11r).
+ * - FT, CCKM, OKC, ...
+ */
+ char *keymgmt_type;
+ int disconnect_reason;
#endif
#if defined TIZEN_TV_EXT
enum connman_dnsconfig_method dns_config_method;
@@ -2845,6 +2852,10 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
connman_dbus_dict_append_dict(dict, "Ethernet",
append_ethernet, service);
+
+ connman_dbus_dict_append_basic(dict, "DisconnectReason",
+ DBUS_TYPE_INT32, &service->disconnect_reason);
+
break;
#endif
case CONNMAN_SERVICE_TYPE_ETHERNET:
@@ -6540,6 +6551,7 @@ static int service_indicate_state(struct connman_service *service)
reply_pending(service, ECONNABORTED);
def_service = __connman_service_get_default();
+ service->disconnect_reason = connman_network_get_disconnect_reason(service->network);
if (!__connman_notifier_is_connected() &&
def_service &&