[package] wpa_supplicant: refresh patches
[openwrt.git] / package / wpa_supplicant / patches / 140-quality.patch
1 --- a/wpa_supplicant/wpa_supplicant.c
2 +++ b/wpa_supplicant/wpa_supplicant.c
3 @@ -1206,7 +1206,7 @@ static int wpa_supplicant_get_scan_resul
4 {
5 #define SCAN_AP_LIMIT 128
6 struct wpa_scan_result *results;
7 - int num, i;
8 + int num, i, j;
9 struct wpa_scan_results *res;
10
11 results = os_malloc(SCAN_AP_LIMIT * sizeof(struct wpa_scan_result));
12 @@ -1303,6 +1303,21 @@ static int wpa_supplicant_get_scan_resul
13 res->res[res->num++] = r;
14 }
15
16 + /* sort scan results by quality */
17 + for(i = 0; i < num - 1; i++) {
18 + for(j = i + 1; j < num; j++) {
19 + struct wpa_scan_result tmp;
20 +
21 + if (results[i].qual > results[j].qual)
22 + continue;
23 +
24 + os_memcpy(&tmp, &results[i], sizeof(tmp));
25 + os_memcpy(&results[i], &results[j], sizeof(tmp));
26 + os_memcpy(&results[j], &tmp, sizeof(tmp));
27 + }
28 + }
29 +
30 +
31 os_free(results);
32 wpa_s->scan_res = res;
33
This page took 0.043722 seconds and 5 git commands to generate.