wpa_supplicant: sort scan results by link quality to improve supplicant-controlled...
[openwrt.git] / package / wpa_supplicant / patches / 140-quality.patch
1 Index: wpa_supplicant-0.6.3/wpa_supplicant/wpa_supplicant.c
2 ===================================================================
3 --- wpa_supplicant-0.6.3.orig/wpa_supplicant/wpa_supplicant.c 2008-07-24 16:28:58.000000000 +0200
4 +++ wpa_supplicant-0.6.3/wpa_supplicant/wpa_supplicant.c 2008-07-24 16:47:40.000000000 +0200
5 @@ -1182,7 +1182,7 @@
6 {
7 #define SCAN_AP_LIMIT 128
8 struct wpa_scan_result *results;
9 - int num, i;
10 + int num, i, j;
11 struct wpa_scan_results *res;
12
13 results = os_malloc(SCAN_AP_LIMIT * sizeof(struct wpa_scan_result));
14 @@ -1279,6 +1279,21 @@
15 res->res[res->num++] = r;
16 }
17
18 + /* sort scan results by quality */
19 + for(i = 0; i < num - 1; i++) {
20 + for(j = i + 1; j < num; j++) {
21 + struct wpa_scan_result tmp;
22 +
23 + if (results[i].qual > results[j].qual)
24 + continue;
25 +
26 + os_memcpy(&tmp, &results[i], sizeof(tmp));
27 + os_memcpy(&results[i], &results[j], sizeof(tmp));
28 + os_memcpy(&results[j], &tmp, sizeof(tmp));
29 + }
30 + }
31 +
32 +
33 os_free(results);
34 wpa_s->scan_res = res;
35
This page took 0.043199 seconds and 5 git commands to generate.