summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2019-05-21 22:08:20 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2019-06-11 07:27:31 +0000
commit966f3e9da9a6e943333542b26778357b304c2f1b (patch)
tree0a75a1fbf625136abb0316ba9d9434ebeaa50c43 /plugins
parent79b0d466b91dc6b5e0038d3ce5934912392be4b8 (diff)
downloadconnman-966f3e9da9a6e943333542b26778357b304c2f1b.tar.gz
connman-966f3e9da9a6e943333542b26778357b304c2f1b.tar.bz2
connman-966f3e9da9a6e943333542b26778357b304c2f1b.zip
Improve support of Multiple same SSIDs including band steering.submit/tizen/20190611.082034accepted/tizen/unified/20190611.110358
1. Supports up to 8 BSSIDs per each SSID 2. Attempt to connect only once per each BSSID 3. Sorted by signal strength and try to connect in sorted order 4. Sets the correct frequency for each bssid. Change-Id: I668fff29f2df99b2e5f637a39b5c70da84f8ee1c Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/wifi.c78
1 files changed, 61 insertions, 17 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c
index f1766534..54380cc9 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -72,7 +72,11 @@
#define P2P_LISTEN_INTERVAL 2000
#define ASSOC_STATUS_NO_CLIENT 17
+#if defined TIZEN_EXT
+#define LOAD_SHAPING_MAX_RETRIES 7
+#else
#define LOAD_SHAPING_MAX_RETRIES 3
+#endif
#if defined TIZEN_EXT
#define WIFI_EAP_FAST_PAC_FILE "/var/lib/wifi/wifi.pac" /* path of Pac file for EAP-FAST */
@@ -179,6 +183,7 @@ struct wifi_data {
static gboolean wifi_first_scan = false;
static gboolean found_with_first_scan = false;
static gboolean is_wifi_notifier_registered = false;
+static GHashTable *failed_bssids = NULL;
#endif
@@ -3261,8 +3266,29 @@ static void ssid_init(GSupplicantSSID *ssid, struct connman_network *network)
ssid->pin_wps = connman_network_get_string(network, "WiFi.PinWPS");
#if defined TIZEN_EXT
+ if (set_connman_bssid(CHECK_BSSID, NULL) == 6) {
+ ssid->bssid_for_connect_len = 6;
+ set_connman_bssid(GET_BSSID, (char *)ssid->bssid_for_connect);
+ DBG("BSSID : %02x:%02x:%02x:%02x:%02x:%02x",
+ ssid->bssid_for_connect[0], ssid->bssid_for_connect[1],
+ ssid->bssid_for_connect[2], ssid->bssid_for_connect[3],
+ ssid->bssid_for_connect[4], ssid->bssid_for_connect[5]);
+ } else {
+ ssid->freq = connman_network_get_frequency(network);
+ }
+
GSList *bssid_list = (GSList *)connman_network_get_bssid_list(network);
if (bssid_list && g_slist_length(bssid_list) > 1) {
+
+ /* If there are more than one bssid,
+ * the user-specified bssid is tried only once at the beginning.
+ * After that, the bssids in the list are tried in order.
+ */
+ if (set_connman_bssid(CHECK_BSSID, NULL) == 6) {
+ set_connman_bssid(RESET_BSSID, NULL);
+ goto done;
+ }
+
GSList *list;
char buff[MAC_ADDRESS_LENGTH];
for (list = bssid_list; list; list = list->next) {
@@ -3273,38 +3299,35 @@ static void ssid_init(GSupplicantSSID *ssid, struct connman_network *network)
bssids->bssid[3], bssids->bssid[4], bssids->bssid[5]);
buff[MAC_ADDRESS_LENGTH - 1] = '\0';
- char *last_bssid = connman_network_get_last_bssid(network);
+ gchar *curr_bssids = g_strdup((const gchar *)buff);
- if (strcmp(last_bssid, buff) == 0) {
- DBG("last_bssid match, try next bssid");
+ if (g_hash_table_contains(failed_bssids, curr_bssids)) {
+ DBG("bssid match, try next bssid");
+ g_free(curr_bssids);
continue;
} else {
- connman_network_set_last_bssid(network, buff);
+ g_hash_table_add(failed_bssids, curr_bssids);
ssid->bssid = &(bssids->bssid[0]);
+ ssid->freq = (unsigned int)bssids->frequency;
break;
}
}
+
+ if (!list) {
+ ssid->bssid = connman_network_get_bssid(network);
+ g_hash_table_remove_all(failed_bssids);
+ }
} else
ssid->bssid = connman_network_get_bssid(network);
+done:
ssid->eap_keymgmt = network_eap_keymgmt(
connman_network_get_string(network, "WiFi.KeymgmtType"));
ssid->phase1 = connman_network_get_string(network, "WiFi.Phase1");
if(g_strcmp0(ssid->eap, "fast") == 0)
ssid->pac_file = g_strdup(WIFI_EAP_FAST_PAC_FILE);
-
- if (set_connman_bssid(CHECK_BSSID, NULL) == 6) {
- ssid->bssid_for_connect_len = 6;
- set_connman_bssid(GET_BSSID, (char *)ssid->bssid_for_connect);
- DBG("BSSID : %02x:%02x:%02x:%02x:%02x:%02x",
- ssid->bssid_for_connect[0], ssid->bssid_for_connect[1],
- ssid->bssid_for_connect[2], ssid->bssid_for_connect[3],
- ssid->bssid_for_connect[4], ssid->bssid_for_connect[5]);
- } else {
- ssid->freq = connman_network_get_frequency(network);
- }
#endif
if (connman_setting_get_bool("BackgroundScanning"))
@@ -3955,6 +3978,8 @@ static void interface_state(GSupplicantInterface *interface)
else
wifi->automaxspeed_timeout = g_timeout_add_seconds(30, autosignalpoll_timeout, wifi);
}
+
+ g_hash_table_remove_all(failed_bssids);
#else
/* though it should be already stopped: */
stop_autoscan(device);
@@ -3996,9 +4021,21 @@ static void interface_state(GSupplicantInterface *interface)
#if defined TIZEN_EXT
if (handle_assoc_status_code(interface, wifi)) {
- network_connect(network);
- break;
+ GSList *bssid_list = (GSList *)connman_network_get_bssid_list(network);
+ guint bssid_length = 0;
+
+ if (bssid_list)
+ bssid_length = g_slist_length(bssid_list);
+
+ if (bssid_length > 1 && bssid_length > g_hash_table_size(failed_bssids)) {
+ network_connect(network);
+ break;
+ }
+
+ wifi->load_shaping_retries = 0;
}
+
+ g_hash_table_remove_all(failed_bssids);
#else
if (handle_assoc_status_code(interface, wifi))
break;
@@ -5380,6 +5417,9 @@ static int wifi_init(void)
return err;
}
+#if defined TIZEN_EXT
+ failed_bssids = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
+#endif
return 0;
}
@@ -5392,6 +5432,10 @@ static void wifi_exit(void)
g_supplicant_unregister(&callbacks);
connman_network_driver_unregister(&network_driver);
+
+#if defined TIZEN_EXT
+ g_hash_table_unref(failed_bssids);
+#endif
}
CONNMAN_PLUGIN_DEFINE(wifi, "WiFi interface plugin", VERSION,