summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheoleun Moon <chleun.moon@samsung.com>2020-05-13 19:19:08 +0900
committerCheoleun Moon <chleun.moon@samsung.com>2020-05-13 19:22:33 +0900
commitde49fa1b1c33a9b977db5aa12eab7267e7e70e38 (patch)
tree4cdaa4254acdade31c8a192783daa13ebf273dd9
parenta1b47c4e729fa0fff9d6e2ab78a2a0305d6c8b9d (diff)
downloadconnman-de49fa1b1c33a9b977db5aa12eab7267e7e70e38.tar.gz
connman-de49fa1b1c33a9b977db5aa12eab7267e7e70e38.tar.bz2
connman-de49fa1b1c33a9b977db5aa12eab7267e7e70e38.zip
Handle the case that best_bss is NULLsubmit/tizen/20200513.103127
Change-Id: I4a813bb3327f400df0050a850ec72fa8b99c870b Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
-rwxr-xr-xgsupplicant/supplicant.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index b16625c4..36625d07 100755
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2459,16 +2459,30 @@ static char *create_group(struct g_supplicant_bss *bss)
return g_string_free(str, FALSE);
}
+static void update_network_with_best_bss(GSupplicantNetwork *network,
+ struct g_supplicant_bss *best_bss)
+{
+ network->signal = best_bss->signal;
+ network->frequency = best_bss->frequency;
+ network->best_bss = best_bss;
+}
+
static bool update_best_bss(GSupplicantNetwork *network,
struct g_supplicant_bss *bss, struct g_supplicant_bss *best_bss)
{
int score_new;
int score_best;
+ if (network->best_bss == NULL) {
+ update_network_with_best_bss(network, bss);
+ return true;
+ }
+
score_new = calculate_score(
compare_bssid(bss->bssid, network->last_connected_bssid),
get_assoc_reject_cnt(network->assoc_reject_table, bss->bssid),
bss->frequency, bss->signal);
+
score_best = calculate_score(
compare_bssid(network->best_bss->bssid, network->last_connected_bssid),
get_assoc_reject_cnt(network->assoc_reject_table, network->best_bss->bssid),
@@ -2479,9 +2493,7 @@ static bool update_best_bss(GSupplicantNetwork *network,
MAC2STR(bss->bssid), score_new,
MAC2STR(network->best_bss->bssid), score_best);
- network->signal = bss->signal;
- network->frequency = bss->frequency;
- network->best_bss = bss;
+ update_network_with_best_bss(network, bss);
SUPPLICANT_DBG("Update best BSS for %s", network->name);