summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2022-06-05 21:02:16 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2022-06-05 21:02:16 +0900
commit95c72ebcb9031d2a93f3c4a4adee29ac4528e709 (patch)
treea073de3724678c173d8cb36a67182b7ae8ace31b
parent9d93424503e09e3ee2ef788d37bb2608e0e9d7a0 (diff)
downloadconnman-95c72ebcb9031d2a93f3c4a4adee29ac4528e709.tar.gz
connman-95c72ebcb9031d2a93f3c4a4adee29ac4528e709.tar.bz2
connman-95c72ebcb9031d2a93f3c4a4adee29ac4528e709.zip
Change-Id: I0f61799881c7eee54d28bed9291203bf2a065016 Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
-rwxr-xr-xgsupplicant/gsupplicant.h1
-rwxr-xr-xgsupplicant/supplicant.c36
-rwxr-xr-xplugins/wifi.c6
-rwxr-xr-xsrc/network.c3
4 files changed, 43 insertions, 3 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 05af5de1..5c3218be 100755
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -516,6 +516,7 @@ void g_supplicant_network_update_assoc_reject(GSupplicantInterface *interface,
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
#if defined TIZEN_EXT && defined TIZEN_EXT_EAP_ON_ETHERNET
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 5f118351..7a55b216 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2305,6 +2305,42 @@ GSupplicantNetwork *g_supplicant_interface_get_network(GSupplicantInterface *int
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;
+ struct assoc_reject_data *assoc_data = value;
+ GHashTable *cloned_assoc_reject_table = user_data;
+
+ if (assoc_data && cloned_assoc_reject_table) {
+ cloned_assoc_data = g_try_new0(struct assoc_reject_data, 1);
+ if (!cloned_assoc_data)
+ return;
+
+ cloned_assoc_data->bssid = g_strdup(assoc_data->bssid);
+ cloned_assoc_data->reject_time_list = g_slist_copy(assoc_data->reject_time_list);
+ g_hash_table_insert(cloned_assoc_reject_table,
+ cloned_assoc_data->bssid, cloned_assoc_data);
+ }
+}
+
+GHashTable *g_supplicant_network_clone_assoc_reject_table(GSupplicantNetwork *network)
+{
+ GHashTable *cloned_assoc_reject_table;
+
+ if (!network)
+ return NULL;
+
+ GHashTable *assoc_reject_table = g_supplicant_network_get_assoc_reject_table(network);
+ if (!assoc_reject_table)
+ return NULL;
+
+ cloned_assoc_reject_table = g_hash_table_new_full(g_str_hash, g_str_equal,
+ NULL, remove_assoc_data);
+ g_hash_table_foreach(assoc_reject_table, copy_assoc_reject, cloned_assoc_reject_table);
+
+ return cloned_assoc_reject_table;
+}
#endif
static void merge_network(GSupplicantNetwork *network)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 344d0bb9..92e5a64d 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -4470,7 +4470,7 @@ static void interface_state(GSupplicantInterface *interface)
supplicant_network = g_supplicant_interface_get_network(interface, group);
connman_network_set_assoc_reject_table(network,
- g_supplicant_network_get_assoc_reject_table(supplicant_network));
+ g_supplicant_network_clone_assoc_reject_table(supplicant_network));
g_supplicant_network_update_assoc_reject(interface, supplicant_network);
}
@@ -5058,7 +5058,7 @@ static void network_added(GSupplicantNetwork *supplicant_network)
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_get_assoc_reject_table(supplicant_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);
@@ -5260,7 +5260,7 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
update_needed = true;
} else if (g_str_equal(property, "UpdateAssocReject")) {
connman_network_set_assoc_reject_table(connman_network,
- g_supplicant_network_get_assoc_reject_table(network));
+ g_supplicant_network_clone_assoc_reject_table(network));
update_needed = true;
}
#endif
diff --git a/src/network.c b/src/network.c
index 870749f0..69e6216c 100755
--- a/src/network.c
+++ b/src/network.c
@@ -1339,6 +1339,7 @@ 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);
+ g_hash_table_destroy(network->wifi.assoc_reject_table);
#endif
g_free(network->path);
g_free(network->group);
@@ -2625,6 +2626,8 @@ void connman_network_set_assoc_reject_table(struct connman_network *network,
if (!assoc_reject_table)
return;
+ g_hash_table_destroy(network->wifi.assoc_reject_table);
+
network->wifi.assoc_reject_table = assoc_reject_table;
}