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),
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);