aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2009-02-10 13:47:14 +0200
committerJouni Malinen <j@w1.fi>2009-02-10 13:47:14 +0200
commite1b525c3560614cc56c85b7d060f540900c4da34 (patch)
treeec8c070f30916264ea3d771bf1b3bced0a4abeaf
parent073ab58ff5ec83d68099049012a248a84e1eb16a (diff)
downloadexternal_wpa_supplicant_8_ti-e1b525c3560614cc56c85b7d060f540900c4da34.zip
external_wpa_supplicant_8_ti-e1b525c3560614cc56c85b7d060f540900c4da34.tar.gz
external_wpa_supplicant_8_ti-e1b525c3560614cc56c85b7d060f540900c4da34.tar.bz2
Use signal quality if level is not available for comparing max rates
Some drivers (for example ipw2100) do not report signal level but only signal quality. wpa_supplicant already uses the signal quality if no level is reported and all other comparision parameters are equal to sort the scan results. However, if two APs have different max rates and the signal level does not differ much wpa_supplicant chooses the AP with the higher max rate. In case of ipw2100 no signal level is reported and thus wpa_supplicant always takes the AP with higher max rate even if its signal quality is really low. For example if AP1 (max rate 11Mb/s, 80% signal quality) and AP2 (max rate 54 Mb/s, 20% signal quality) are found by a scan wpa_supplicant would choose AP2. Hence, if no signal level is reported depend on the signal quality if max rate should be compared. A quality difference of 10% is considered acceptable in favor of the higher max rate. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
-rw-r--r--src/drivers/scan_helpers.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/drivers/scan_helpers.c b/src/drivers/scan_helpers.c
index 72e360f..6338770 100644
--- a/src/drivers/scan_helpers.c
+++ b/src/drivers/scan_helpers.c
@@ -156,10 +156,13 @@ static int wpa_scan_result_compar(const void *a, const void *b)
return -1;
/* best/max rate preferred if signal level close enough XXX */
- maxrate_a = wpa_scan_get_max_rate(wa);
- maxrate_b = wpa_scan_get_max_rate(wb);
- if (maxrate_a != maxrate_b && abs(wb->level - wa->level) < 5)
- return maxrate_b - maxrate_a;
+ if ((wa->level && wb->level && abs(wb->level - wa->level) < 5) ||
+ (wa->qual && wb->qual && abs(wb->qual - wa->qual) < 10)) {
+ maxrate_a = wpa_scan_get_max_rate(wa);
+ maxrate_b = wpa_scan_get_max_rate(wb);
+ if (maxrate_a != maxrate_b)
+ return maxrate_b - maxrate_a;
+ }
/* use freq for channel preference */