Update ssid frequency only from best bss signal 59/298459/3
authorJaehyun Kim <jeik01.kim@samsung.com>
Thu, 7 Sep 2023 07:37:12 +0000 (16:37 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Thu, 7 Sep 2023 11:56:48 +0000 (20:56 +0900)
Only changes to the best bssid update the frequency of the ssid network info.
If not, the bssid and frequency of the actual connection target may not match.

Change-Id: Ic02dc87526b2526eaf340f00fdbb1cbe0f31c172
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
gsupplicant/supplicant.c

index fce4f7b..c144a4f 100755 (executable)
@@ -2657,6 +2657,7 @@ static void update_network_with_best_bss(GSupplicantNetwork *network,
 
        network->signal = best_bss->signal;
        network->frequency = best_bss->frequency;
+       network->phy_mode = best_bss->phy_mode;
        network->best_bss = best_bss;
 }
 
@@ -3530,6 +3531,8 @@ static void update_signal(gpointer key, gpointer value,
        if (!network->best_bss || (network->best_bss == bss)) {
                if (bss->signal > network->signal) {
                        network->signal = bss->signal;
+                       network->frequency = bss->frequency;
+                       network->phy_mode = bss->phy_mode;
                        network->best_bss = bss;
                }
                return;
@@ -3615,10 +3618,10 @@ static void interface_current_bss(GSupplicantInterface *interface,
        struct g_supplicant_bss *bss;
        const char *path;
 #if defined TIZEN_EXT
-       char bssid_buff1[WIFI_BSSID_STR_LEN] = {0,};
-       char bssid_buff2[WIFI_BSSID_STR_LEN] = {0,};
-       char *bssid_str1 = bssid_buff1;
-       char *bssid_str2 = bssid_buff2;
+       char curr_bssid_buff[WIFI_BSSID_STR_LEN] = {0,};
+       char best_bssid_buff[WIFI_BSSID_STR_LEN] = {0,};
+       char *curr_bssid_str = curr_bssid_buff;
+       char *best_bssid_str = best_bssid_buff;
        gboolean update = FALSE;
 #endif
 
@@ -3640,14 +3643,15 @@ static void interface_current_bss(GSupplicantInterface *interface,
 
        interface->current_network = network;
 #if defined TIZEN_EXT
-       snprintf(bssid_str1, WIFI_BSSID_STR_LEN, MACSTR, MAC2STR(bss->bssid));
-       snprintf(bssid_str2, WIFI_BSSID_STR_LEN, MACSTR, MAC2STR(network->best_bss->bssid));
+       snprintf(curr_bssid_str, WIFI_BSSID_STR_LEN, MACSTR, MAC2STR(bss->bssid));
+       snprintf(best_bssid_str, WIFI_BSSID_STR_LEN, MACSTR, MAC2STR(network->best_bss->bssid));
 
        SUPPLICANT_DBG("current network [%p], Passed bss %s, best bss %s",
-                       interface->current_network, bssid_str1, bssid_str2);
+                       interface->current_network, curr_bssid_str, best_bssid_str);
 
        if (network->frequency != bss->frequency) {
                network->frequency = bss->frequency;
+               network->phy_mode = bss->phy_mode;
                update = TRUE;
        }
 #endif
@@ -4445,7 +4449,8 @@ static void signal_bss_changed(const char *path, DBusMessageIter *iter)
        supplicant_dbus_property_foreach(iter, bss_property, bss);
 
 #if defined TIZEN_EXT
-       if (network->interface->state != G_SUPPLICANT_STATE_COMPLETED) {
+       if (network->interface->state != G_SUPPLICANT_STATE_COMPLETED &&
+                       bss == network->best_bss) {
                network->frequency = bss->frequency;
                network->phy_mode = bss->phy_mode;
        }