summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gsupplicant/supplicant.c14
-rwxr-xr-xinclude/network.h10
-rw-r--r--plugins/wifi.c42
-rwxr-xr-xsrc/network.c28
-rw-r--r--src/service.c36
5 files changed, 99 insertions, 31 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 67d4d60..1c0e641 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -50,6 +50,7 @@
#define WLAN_EID_SUPP_RATES 1
#define WLAN_EID_EXT_SUPP_RATES 50
#define COUNTRY_CODE_LENGTH 2
+#define WIFI_BSSID_LEN_MAX 6
#endif
#define BSS_UNKNOWN_STRENGTH -90
@@ -364,7 +365,7 @@ struct interface_scan_data {
#if defined TIZEN_EXT
struct g_connman_bssids {
- char bssid[18];
+ unsigned char bssid[WIFI_BSSID_LEN_MAX];
uint16_t strength;
uint16_t frequency;
};
@@ -1723,18 +1724,13 @@ static void update_bssid_list(gpointer key, gpointer value, gpointer user_data)
{
struct g_supplicant_bss *bss = value;
struct g_connman_bssids *bssids = NULL;
- char buff[18];
GSList **list = (GSList **)user_data;
bssids = (struct g_connman_bssids *)g_try_malloc0(sizeof(struct g_connman_bssids));
if (bssids) {
- g_snprintf(buff, 18, "%02x:%02x:%02x:%02x:%02x:%02x",
- bss->bssid[0], bss->bssid[1], bss->bssid[2], bss->bssid[3],
- bss->bssid[4], bss->bssid[5]);
+ memcpy(bssids->bssid, bss->bssid, WIFI_BSSID_LEN_MAX);
- memcpy(bssids->bssid, buff, 18);
- bssids->bssid[17] = '\0';
bssids->strength = bss->signal;
bssids->strength += 120;
@@ -2816,7 +2812,11 @@ static void interface_bss_removed(DBusMessageIter *iter, void *user_data)
g_hash_table_remove(interface->network_table, network->group);
} else {
if (is_current_network_bss && network->best_bss)
+#if defined TIZEN_EXT
+ callback_network_changed(network, "CheckMultiBssidConnect");
+#else
callback_network_changed(network, "");
+#endif
}
}
diff --git a/include/network.h b/include/network.h
index 6d067c5..c4c7305 100755
--- a/include/network.h
+++ b/include/network.h
@@ -32,6 +32,12 @@
extern "C" {
#endif
+#if defined TIZEN_EXT
+#define WIFI_ENCYPTION_MODE_LEN_MAX 6
+#define WIFI_BSSID_LEN_MAX 6
+#define MAC_ADDRESS_LENGTH 18
+#endif
+
/**
* SECTION:network
* @title: Network premitives
@@ -64,7 +70,7 @@ enum connman_network_error {
#if defined TIZEN_EXT
struct connman_bssids {
- char bssid[18];
+ unsigned char bssid[WIFI_BSSID_LEN_MAX];
uint16_t strength;
uint16_t frequency;
};
@@ -206,6 +212,8 @@ ieee80211_modes_e connman_network_get_phy_mode(struct connman_network *network);
int connman_network_set_connection_mode(struct connman_network *network,
connection_mode_e mode);
connection_mode_e connman_network_get_connection_mode(struct connman_network *network);
+int connman_network_set_last_bssid(struct connman_network *network, const char *bssid);
+char *connman_network_get_last_bssid(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 cd543be..dfcff59 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -3261,7 +3261,32 @@ static void ssid_init(GSupplicantSSID *ssid, struct connman_network *network)
ssid->pin_wps = connman_network_get_string(network, "WiFi.PinWPS");
#if defined TIZEN_EXT
- ssid->bssid = connman_network_get_bssid(network);
+ GSList *bssid_list = (GSList *)connman_network_get_bssid_list(network);
+ if (bssid_list && g_slist_length(bssid_list) > 1) {
+ GSList *list;
+ char buff[MAC_ADDRESS_LENGTH];
+ for (list = bssid_list; list; list = list->next) {
+ struct connman_bssids * bssids = (struct connman_bssids *)list->data;
+
+ g_snprintf(buff, MAC_ADDRESS_LENGTH, "%02x:%02x:%02x:%02x:%02x:%02x",
+ bssids->bssid[0], bssids->bssid[1], bssids->bssid[2],
+ bssids->bssid[3], bssids->bssid[4], bssids->bssid[5]);
+ buff[MAC_ADDRESS_LENGTH - 1] = '\0';
+
+ char *last_bssid = connman_network_get_last_bssid(network);
+
+ if (strcmp(last_bssid, buff) == 0) {
+ DBG("last_bssid match, try next bssid");
+ continue;
+ } else {
+ connman_network_set_last_bssid(network, buff);
+
+ ssid->bssid = &(bssids->bssid[0]);
+ break;
+ }
+ }
+ } else
+ ssid->bssid = connman_network_get_bssid(network);
ssid->eap_keymgmt = network_eap_keymgmt(
connman_network_get_string(network, "WiFi.KeymgmtType"));
@@ -3740,7 +3765,11 @@ static bool handle_assoc_status_code(GSupplicantInterface *interface,
struct wifi_data *wifi)
{
if (wifi->state == G_SUPPLICANT_STATE_ASSOCIATING &&
+#if defined TIZEN_EXT
+ wifi->assoc_code > 0 &&
+#else
wifi->assoc_code == ASSOC_STATUS_NO_CLIENT &&
+#endif
wifi->load_shaping_retries < LOAD_SHAPING_MAX_RETRIES) {
wifi->load_shaping_retries ++;
return TRUE;
@@ -3962,8 +3991,15 @@ static void interface_state(GSupplicantInterface *interface)
if (is_idle(wifi))
break;
+#if defined TIZEN_EXT
+ if (handle_assoc_status_code(interface, wifi)) {
+ network_connect(network);
+ break;
+ }
+#else
if (handle_assoc_status_code(interface, wifi))
break;
+#endif
/* If previous state was 4way-handshake, then
* it's either: psk was incorrect and thus we retry
@@ -4593,6 +4629,10 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
bssid_list = (GSList *)g_supplicant_network_get_bssid_list(network);
connman_network_set_bssid_list(connman_network, bssid_list);
connman_network_set_phy_mode(connman_network, phy_mode);
+
+ if (g_str_equal(property, "CheckMultiBssidConnect") &&
+ connman_network_get_associating(connman_network))
+ network_connect(connman_network);
#endif
}
diff --git a/src/network.c b/src/network.c
index b710368..9933b72 100755
--- a/src/network.c
+++ b/src/network.c
@@ -41,11 +41,6 @@
*/
#define RS_REFRESH_TIMEOUT 3
-#if defined TIZEN_EXT
-#define WIFI_ENCYPTION_MODE_LEN_MAX 6
-#define WIFI_BSSID_LEN_MAX 6
-#endif
-
/*
* As per RFC 4861, a host should transmit up to MAX_RTR_SOLICITATIONS(3)
* Router Solicitation messages, each separated by at least
@@ -107,6 +102,7 @@ struct connman_network {
#if defined TIZEN_EXT
char encryption_mode[WIFI_ENCYPTION_MODE_LEN_MAX];
unsigned char bssid[WIFI_BSSID_LEN_MAX];
+ char last_bssid[MAC_ADDRESS_LENGTH];
unsigned int maxrate;
int maxspeed;
bool isHS20AP;
@@ -1584,6 +1580,11 @@ int connman_network_set_connected(struct connman_network *network,
network, network->connected, connected, network->connecting,
network->associating);
+#if defined TIZEN_EXT
+ /* reset last connect request bssid */
+ connman_network_set_last_bssid(network, NULL);
+#endif
+
if ((network->connecting || network->associating) &&
!connected) {
connman_network_set_error(network,
@@ -1975,6 +1976,23 @@ unsigned char *connman_network_get_bssid(struct connman_network *network)
return (unsigned char *)network->wifi.bssid;
}
+int connman_network_set_last_bssid(struct connman_network *network,
+ const char *bssid)
+{
+ if (bssid == NULL) {
+ memset(network->wifi.last_bssid, '\0', sizeof(network->wifi.last_bssid));
+ return -EINVAL;
+ }
+ strncpy(network->wifi.last_bssid, bssid, MAC_ADDRESS_LENGTH - 1);
+
+ return 0;
+}
+
+char *connman_network_get_last_bssid(struct connman_network *network)
+{
+ return (char *)network->wifi.last_bssid;
+}
+
int connman_network_set_maxspeed(struct connman_network *network,
int maxspeed)
{
diff --git a/src/service.c b/src/service.c
index 777db8f..2fd1e50 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3342,29 +3342,31 @@ static void append_wifi_ext_info(DBusMessageIter *dict,
static void append_bssid_info(DBusMessageIter *iter, void *user_data)
{
- GSList *bssid_list = NULL;
+ GSList *bssid_list = NULL;
struct connman_network *network = user_data;
- struct connman_bssids *bssids;
- char bssid_buf[18] = {0,};
- char *bssid_str = bssid_buf;
+ struct connman_bssids *bssids;
+ char bssid_buf[MAC_ADDRESS_LENGTH] = {0,};
+ char *bssid_str = bssid_buf;
- bssid_list = (GSList *)connman_network_get_bssid_list(network);
- if(bssid_list) {
- GSList *list;
- for (list = bssid_list; list; list = list->next) {
- bssids = (struct connman_bssids *)list->data;
- memcpy(bssid_str, bssids->bssid, 18);
+ bssid_list = (GSList *)connman_network_get_bssid_list(network);
+ if(bssid_list) {
+ GSList *list;
+ for (list = bssid_list; list; list = list->next) {
+ bssids = (struct connman_bssids *)list->data;
+ g_snprintf(bssid_buf, MAC_ADDRESS_LENGTH, "%02x:%02x:%02x:%02x:%02x:%02x",
+ bssids->bssid[0], bssids->bssid[1], bssids->bssid[2],
+ bssids->bssid[3], bssids->bssid[4], bssids->bssid[5]);
connman_dbus_dict_append_basic(iter, "BSSID",
- DBUS_TYPE_STRING, &bssid_str);
+ DBUS_TYPE_STRING, &bssid_str);
- connman_dbus_dict_append_basic(iter, "Strength",
- DBUS_TYPE_UINT16, &bssids->strength);
+ connman_dbus_dict_append_basic(iter, "Strength",
+ DBUS_TYPE_UINT16, &bssids->strength);
- connman_dbus_dict_append_basic(iter, "Frequency",
- DBUS_TYPE_UINT16, &bssids->frequency);
- }
- }
+ connman_dbus_dict_append_basic(iter, "Frequency",
+ DBUS_TYPE_UINT16, &bssids->frequency);
+ }
+ }
}
#endif