diff options
-rwxr-xr-x | gsupplicant/gsupplicant.h | 7 | ||||
-rwxr-xr-x | gsupplicant/supplicant.c | 46 | ||||
-rwxr-xr-x | include/network.h | 2 | ||||
-rwxr-xr-x | plugins/wifi.c | 19 | ||||
-rwxr-xr-x | src/network.c | 6 | ||||
-rwxr-xr-x | src/service.c | 60 | ||||
-rwxr-xr-x | src/wispr.c | 2 |
7 files changed, 75 insertions, 67 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index 1a956290..d8d55a41 100755 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -548,14 +548,15 @@ const void *g_supplicant_network_get_transition_mode_ssid(GSupplicantNetwork *ne void g_supplicant_network_set_signal(GSupplicantNetwork *network, int signal); void g_supplicant_network_set_bss_signal(GSupplicantNetwork *network, int signal, int snr); - +GSupplicantNetwork *g_supplicant_interface_get_network(GSupplicantInterface *interface, + const char *group); +#endif +#if defined TIZEN_EXT_INS void g_supplicant_network_set_last_connected_bssid(GSupplicantNetwork *network, const unsigned char *bssid); const unsigned char *g_supplicant_network_get_last_connected_bssid(GSupplicantNetwork *network); void g_supplicant_network_update_assoc_reject(GSupplicantInterface *interface, GSupplicantNetwork *network); GHashTable *g_supplicant_network_get_assoc_reject_table(GSupplicantNetwork *network); -GSupplicantNetwork *g_supplicant_interface_get_network(GSupplicantInterface *interface, - const char *group); GHashTable *g_supplicant_network_clone_assoc_reject_table(GSupplicantNetwork *network); #endif diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index e63831bf..31748573 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -191,7 +191,7 @@ struct _GSupplicantINSSettings { static struct _GSupplicantINSSettings ins_settings; #endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */ -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -2023,6 +2023,7 @@ static bool compare_bssid(unsigned char *bssid_a, unsigned char *bssid_b) return false; } +#if defined TIZEN_EXT_INS static gchar *convert_bssid_to_str(unsigned char *bssid) { GString *bssid_str; @@ -2041,7 +2042,6 @@ static gchar *convert_bssid_to_str(unsigned char *bssid) return g_string_free(bssid_str, FALSE); } -#if defined TIZEN_EXT_INS static void count_assoc_reject(gpointer data, gpointer user_data) { time_t assoc_reject_time = GPOINTER_TO_INT(data); @@ -2183,7 +2183,7 @@ static int calculate_score(bool is_last_connected, uint16_t assoc_reject_cnt, return score; } -#endif +#endif /* defined TIZEN_EXT_INS */ static void update_bssid_list(gpointer key, gpointer value, gpointer user_data) { @@ -2257,11 +2257,12 @@ static void print_bssid_sort(gpointer data, gpointer user_data) if (!bssids || !network) return; - SUPPLICANT_DBG("ssid [%-20s] bssid[" MACSTR "] total[%2d] freq[%2d] " - "last_conn[%2d] assoc_reject[%2d] strength[%2d] rssi[%2d]", - network->ssid, MAC2STR(bssids->bssid), bssids->ins_score, - bssids->score_frequency, bssids->score_last_connected_bssid, - bssids->score_assoc_reject, bssids->score_strength, bssids->strength - 120); + if (!simplified_log) + SUPPLICANT_DBG("ssid [%-20s] bssid[" MACSTR "] total[%2d] freq[%2d] " + "last_conn[%2d] assoc_reject[%2d] strength[%2d] rssi[%2d]", + network->ssid, MAC2STR(bssids->bssid), bssids->ins_score, + bssids->score_frequency, bssids->score_last_connected_bssid, + bssids->score_assoc_reject, bssids->score_strength, bssids->strength - 120); } #endif @@ -2286,6 +2287,7 @@ void *g_supplicant_network_get_bssid_list(GSupplicantNetwork *network) return bssid_data.bssid_list; } +#if defined TIZEN_EXT_INS void g_supplicant_network_set_last_connected_bssid(GSupplicantNetwork *network, const unsigned char *bssid) { if (!bssid) @@ -2351,15 +2353,6 @@ GHashTable *g_supplicant_network_get_assoc_reject_table(GSupplicantNetwork *netw return network->assoc_reject_table; } -GSupplicantNetwork *g_supplicant_interface_get_network(GSupplicantInterface *interface, - const char *group) -{ - if (!interface) - return NULL; - - return g_hash_table_lookup(interface->network_table, group); -} - static void copy_assoc_reject(gpointer key, gpointer value, gpointer user_data) { struct assoc_reject_data *cloned_assoc_data; @@ -2395,8 +2388,17 @@ GHashTable *g_supplicant_network_clone_assoc_reject_table(GSupplicantNetwork *ne return cloned_assoc_reject_table; } +#endif /* defined TIZEN_EXT_INS */ -#endif +GSupplicantNetwork *g_supplicant_interface_get_network(GSupplicantInterface *interface, + const char *group) +{ + if (!interface) + return NULL; + + return g_hash_table_lookup(interface->network_table, group); +} +#endif /* defined TIZEN_EXT */ static void merge_network(GSupplicantNetwork *network) { @@ -3548,7 +3550,7 @@ static void update_network_signal(GSupplicantNetwork *network) SUPPLICANT_DBG("New network signal %d", network->signal); } -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS static gboolean last_connected_timeout(gpointer data) { GSupplicantInterface *interface = data; @@ -3599,7 +3601,7 @@ static void remove_timer_for_last_connected(GSupplicantInterface *interface) } } } -#endif +#endif /* defined TIZEN_EXT_INS */ static void interface_current_bss(GSupplicantInterface *interface, DBusMessageIter *iter) @@ -3695,7 +3697,7 @@ static void interface_current_bss(GSupplicantInterface *interface, case G_SUPPLICANT_STATE_GROUP_HANDSHAKE: case G_SUPPLICANT_STATE_COMPLETED: callback_network_associated(network); -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS add_timer_for_last_connected(interface); #endif break; @@ -3854,7 +3856,7 @@ static void interface_property(const char *key, DBusMessageIter *iter, interface->state = string2state(str); callback_interface_state(interface); } -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS switch (interface->state) { case G_SUPPLICANT_STATE_COMPLETED: add_timer_for_last_connected(interface); diff --git a/include/network.h b/include/network.h index d637579f..46ccc816 100755 --- a/include/network.h +++ b/include/network.h @@ -236,12 +236,14 @@ int connman_network_set_bssid_list(struct connman_network *network, GSList *bssids); void *connman_network_get_bssid_list(struct connman_network *network); unsigned int connman_network_get_max_bssid_count(struct connman_network *network); +#if defined TIZEN_EXT_INS int connman_network_set_last_connected_bssid(struct connman_network *network, const unsigned char *bssid); unsigned char *connman_network_get_last_connected_bssid(struct connman_network *network); void connman_network_set_assoc_reject_table(struct connman_network *network, GHashTable *assoc_reject_table); GHashTable *connman_network_get_assoc_reject_table(struct connman_network *network); +#endif /* defined TIZEN_EXT_INS */ __time_t connman_network_get_roam_scan_time(struct connman_network *network); void connman_network_set_roam_scan_time(struct connman_network *network, __time_t roam_scan_time); diff --git a/plugins/wifi.c b/plugins/wifi.c index 5ffbd4e4..25594c93 100755 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -4875,11 +4875,13 @@ static void interface_state(GSupplicantInterface *interface) #if defined TIZEN_EXT if (!wifi->connected && handle_assoc_status_code(interface, wifi)) { - const char *group = connman_network_get_group(network); - GSupplicantNetwork *supplicant_network; GSList *bssid_list = NULL; guint bssid_length = 0; +#if defined TIZEN_EXT_INS + const char *group = connman_network_get_group(network); + GSupplicantNetwork *supplicant_network; + if (group) { supplicant_network = g_supplicant_interface_get_network(interface, group); @@ -4888,6 +4890,7 @@ static void interface_state(GSupplicantInterface *interface) g_supplicant_network_update_assoc_reject(interface, supplicant_network); } +#endif bssid_list = (GSList *)connman_network_get_bssid_list(network); if (bssid_list) @@ -5543,11 +5546,14 @@ static void network_added(GSupplicantNetwork *supplicant_network) g_supplicant_network_is_hs20AP(supplicant_network)); connman_network_set_bssid_list(network, (GSList *)g_supplicant_network_get_bssid_list(supplicant_network)); +#endif +#if defined TIZEN_EXT_INS connman_network_set_last_connected_bssid(network, g_supplicant_network_get_last_connected_bssid(supplicant_network)); connman_network_set_assoc_reject_table(network, g_supplicant_network_clone_assoc_reject_table(supplicant_network)); #endif + connman_network_set_available(network, true); connman_network_set_string(network, "WiFi.Mode", mode); @@ -5558,7 +5564,7 @@ static void network_added(GSupplicantNetwork *supplicant_network) #endif connman_network_set_group(network, group); -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS g_supplicant_network_set_last_connected_bssid(supplicant_network, connman_network_get_last_connected_bssid(network)); #endif @@ -5746,15 +5752,12 @@ static void network_changed(GSupplicantNetwork *network, const char *property) g_supplicant_network_get_last_connected_bssid(network)); update_needed = true; - } -#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */ -#if defined TIZEN_EXT - else if (g_str_equal(property, "UpdateAssocReject")) { + } else if (g_str_equal(property, "UpdateAssocReject")) { connman_network_set_assoc_reject_table(connman_network, g_supplicant_network_clone_assoc_reject_table(network)); update_needed = true; } -#endif +#endif /* defined TIZEN_EXT && defined TIZEN_EXT_INS */ else update_needed = false; diff --git a/src/network.c b/src/network.c index db0e72ea..34e6ea7d 100755 --- a/src/network.c +++ b/src/network.c @@ -58,7 +58,7 @@ static DBusConnection *connection; #define DHCP_RETRY_TIMEOUT 10 -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -1363,6 +1363,8 @@ static void network_destruct(struct connman_network *network) #if defined TIZEN_EXT g_slist_free_full(network->wifi.vsie_list, g_free); g_slist_free_full(network->wifi.bssid_list, g_free); +#endif +#if defined TIZEN_EXT_INS g_hash_table_destroy(network->wifi.assoc_reject_table); #endif g_free(network->path); @@ -2720,6 +2722,7 @@ unsigned int connman_network_get_max_bssid_count(struct connman_network *network return network->wifi.max_bssid_count; } +#if defined TIZEN_EXT_INS int connman_network_set_last_connected_bssid(struct connman_network *network, const unsigned char *bssid) { @@ -2760,6 +2763,7 @@ GHashTable *connman_network_get_assoc_reject_table(struct connman_network *netwo return network->wifi.assoc_reject_table; } +#endif /* defined TIZEN_EXT_INS */ __time_t connman_network_get_roam_scan_time(struct connman_network *network) { diff --git a/src/service.c b/src/service.c index 1e8cc31b..ac090b51 100755 --- a/src/service.c +++ b/src/service.c @@ -81,7 +81,8 @@ struct saved_profiles { GTimeVal modified; gchar *profile_name; }; - +#endif +#if defined TIZEN_EXT_INS static unsigned char invalid_bssid[WIFI_BSSID_LEN_MAX] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -240,10 +241,10 @@ struct connman_service { char *connector; char *c_sign_key; char *net_access_key; +#if defined TIZEN_EXT_INS unsigned char last_connected_bssid[WIFI_BSSID_LEN_MAX]; bool is_internet_connection; int assoc_reject_count; -#if defined TIZEN_EXT_INS int score_last_user_selection; int score_last_connected; int score_frequency; @@ -828,7 +829,7 @@ static int connman_service_set_eapol_property(struct connman_service *service, } #endif -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS static void save_assoc_reject(gpointer key, gpointer value, gpointer user_data) { struct assoc_reject_data *assoc_rd = value; @@ -877,10 +878,10 @@ static bool update_assoc_reject(struct connman_service *service) if (assoc_reject_table) { assoc_reject_count = 0; g_hash_table_foreach(assoc_reject_table, count_assoc_reject, &assoc_reject_count); -#if defined TIZEN_EXT_INS + DBG("assoc reject count [%d -> %d]", service->assoc_reject_count, assoc_reject_count); -#endif + if (service->assoc_reject_count != assoc_reject_count) { service->assoc_reject_count = assoc_reject_count; return true; @@ -967,9 +968,7 @@ static int service_ext_load(struct connman_service *service) reject_data->reject_time_list = g_slist_append(reject_data->reject_time_list, GINT_TO_POINTER(reject_time)); -#if defined TIZEN_EXT_INS DBG("assoc reject [%s_%ld]", bssid, reject_time); -#endif g_strfreev(bssid_time); } @@ -1025,9 +1024,7 @@ static int service_ext_save(struct connman_service *service) g_key_file_set_string(keyfile, identifier, "LastConnectedBSSID", bssid_str->str); -#if defined TIZEN_EXT_INS DBG("last connected bssid[%s]", bssid_str->str); -#endif g_string_free(bssid_str, TRUE); } @@ -1051,9 +1048,7 @@ next: g_key_file_set_string_list(keyfile, service->identifier, "AssocReject", (const gchar **)reject_list, reject_len); -#if defined TIZEN_EXT_INS DBG("assoc reject table [%d]", reject_len); -#endif g_strfreev(reject_list); g_string_free(reject_str, TRUE); @@ -1067,7 +1062,7 @@ done: g_key_file_free(keyfile); return err; } -#endif +#endif /* defined TIZEN_EXT_INS */ static int service_load(struct connman_service *service) { @@ -1078,7 +1073,7 @@ static int service_load(struct connman_service *service) bool autoconnect; unsigned int ssid_len; int err = 0; -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS bool internet_connection; #endif #if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET @@ -1168,7 +1163,7 @@ static int service_load(struct connman_service *service) g_free(hex_ssid); } -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS /* Last connected BSSID */ if (service->network) { gchar *bssid_str; @@ -1206,7 +1201,7 @@ static int service_load(struct connman_service *service) service->is_internet_connection = internet_connection; g_clear_error(&error); -#endif +#endif /* defined TIZEN_EXT_INS */ /* fall through */ case CONNMAN_SERVICE_TYPE_GADGET: @@ -1483,7 +1478,7 @@ static int service_save(struct connman_service *service) if (service->network) { const unsigned char *ssid; unsigned int ssid_len = 0; -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS GHashTable *assoc_reject_table; #endif @@ -1515,7 +1510,7 @@ static int service_save(struct connman_service *service) g_key_file_set_integer(keyfile, service->identifier, "Frequency", freq); -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS /* Last connected BSSID */ if (memcmp(service->last_connected_bssid, invalid_bssid, WIFI_BSSID_LEN_MAX)) { char *identifier = service->identifier; @@ -1538,9 +1533,7 @@ static int service_save(struct connman_service *service) g_key_file_set_string(keyfile, identifier, "LastConnectedBSSID", bssid_str->str); -#if defined TIZEN_EXT_INS DBG("last connected bssid[%s]", bssid_str->str); -#endif g_string_free(bssid_str, TRUE); } @@ -1566,9 +1559,7 @@ static int service_save(struct connman_service *service) g_key_file_set_string_list(keyfile, service->identifier, "AssocReject", (const gchar **)assoc_reject_list, assoc_reject_len); -#if defined TIZEN_EXT_INS DBG("assoc reject table [%d]", assoc_reject_len); -#endif g_strfreev(assoc_reject_list); g_string_free(assoc_reject_str, TRUE); @@ -1578,10 +1569,10 @@ static int service_save(struct connman_service *service) /* Internet connection */ g_key_file_set_boolean(keyfile, service->identifier, "InternetConnection", service->is_internet_connection); -#if defined TIZEN_EXT_INS + DBG("internet connection [%s]", service->is_internet_connection ? "true" : "false"); -#endif -#endif + +#endif /* defined TIZEN_EXT_INS */ } /* fall through */ @@ -3272,7 +3263,7 @@ static void strength_changed(struct connman_service *service) DBUS_TYPE_BYTE, &service->strength); } -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS static bool update_last_connected_bssid(struct connman_service *service) { const unsigned char *last_connected_bssid; @@ -5119,7 +5110,7 @@ const char *connman_service_get_proxy_url(struct connman_service *service) return service->pac; } -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS void connman_service_set_internet_connection(struct connman_service *service, bool internet_connection) { @@ -5141,7 +5132,9 @@ bool connman_service_get_internet_connection(struct connman_service *service) return service->is_internet_connection; } +#endif +#if defined TIZEN_EXT DBusMessage *connman_service_create_dbus_service_reply(DBusMessage *msg, struct connman_service *service) { @@ -7950,11 +7943,12 @@ static void service_initialize(struct connman_service *service) service->wps = false; service->wps_advertizing = false; -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS memset(service->last_connected_bssid, 0, WIFI_BSSID_LEN_MAX); service->is_internet_connection = false; service->assoc_reject_count = 0; - +#endif +#if defined TIZEN_EXT service->disconnection_requested = false; service->storage_reload = false; /* @@ -9416,7 +9410,7 @@ static int service_indicate_state(struct connman_service *service) single_connected_tech(service); #endif -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS if (service->type == CONNMAN_SERVICE_TYPE_WIFI) connman_service_set_internet_connection(service, true); #endif @@ -10562,16 +10556,18 @@ static int service_register(struct connman_service *service) #if defined TIZEN_EXT int ret; service_load(service); +#if defined TIZEN_EXT_INS ret = service_ext_load(service); if (ret == -ERANGE) service_ext_save(service); +#endif /* defined TIZEN_EXT_INS */ ret = __connman_config_provision_service(service); if (ret < 0 && !simplified_log) DBG("Failed to provision service"); #else if (__connman_config_provision_service(service) < 0) service_load(service); -#endif +#endif /* defined TIZEN_EXT */ g_dbus_register_interface(connection, service->path, CONNMAN_SERVICE_INTERFACE, @@ -11214,7 +11210,7 @@ void __connman_service_update_from_network(struct connman_network *network) bool roaming; const char *name; bool stats_enable; -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS bool need_save = false; #endif @@ -11273,7 +11269,7 @@ roaming: roaming_changed(service); sorting: -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS need_save |= update_last_connected_bssid(service); need_save |= update_assoc_reject(service); if (need_save) { diff --git a/src/wispr.c b/src/wispr.c index 4674ae47..35bebacb 100755 --- a/src/wispr.c +++ b/src/wispr.c @@ -425,7 +425,7 @@ static void wispr_portal_error(struct connman_wispr_portal_context *wp_context) wp_context->wispr_result = CONNMAN_WISPR_RESULT_FAILED; -#if defined TIZEN_EXT +#if defined TIZEN_EXT_INS connman_service_set_internet_connection(wp_context->service, false); #endif } |