~ubuntu-branches/ubuntu/precise/wpasupplicant/precise-proposed

« back to all changes in this revision

Viewing changes to debian/patches/0002-sme-optimize-recovery-from-common-load-balancing-mechanisms.patch

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2013-06-12 15:57:50 UTC
  • Revision ID: package-import@ubuntu.com-20130612155750-go9lgylcef8n3f2f
Tags: 0.7.3-6ubuntu2.2
* Multiple patches to reduce the number of disconnections for WPA Enterprise
  roaming and Opportunistic Key Caching. (LP: #1187524)
* In debian/patches:
  0001-sme-fix-retry-after-auth-assoc-timeout-failure.patch,
  0002-sme-optimize-recovery-from-common-load-balancing-mechanisms.patch,
  0003-sme-blacklist-bss-on-first-failure-if-only-a-*.patch,
  0004-sme-extend-load-balancing-optimization-in-bss-blacklisting.patch,
  0005-sme-optimize-recovery-from-association-command-failures.patch,
  0006-sme-add-timers-for-authentication-and-association.patch,
  0007-sme-nl80211-set-cipher-suites.patch:
  Cherry-pick patches fixing SME (Session Management Entity) for the nl80211
  driver, which works as a basis for the OKC patches.
* In debian/patches:
  0001-pmkokc-Set-portValid-TRUE-on-association-for-driver-based-4.patch,
  0002-pmkokc-Clear-WPA-and-EAPOL-state-machine-config-pointer-on-.patch,
  0003-pmkokc-Clear-driver-PMKSA-cache-entry-on-PMKSA-cache-expira.patch,
  0004-pmkokc-Flush-PMKSA-cache-entries-and-invalidate-EAP-state-o.patch,
  0005-pmkokc-Fix-proactive_key_caching-configuration-to-WPA-code.patch,
  0006-pmkokc-RSN-Add-a-debug-message-when-considing-addition-of-O.patch,
  0007-pmkokc-Clear-OKC-based-PMKSA-caching-entries-if-PMK-is-chan.patch,
  0008-pmkokc-Move-wpa_sm_remove_pmkid-call-to-PMKSA-cache-entry-f.patch,
  0009-pmkokc-Use-PMKSA-cache-entries-with-only-a-single-network-c.patch,
  0010-pmkokc-PMKSA-Do-not-evict-active-cache-entry-when-adding-ne.patch,
  0011-pmkokc-PMKSA-Set-cur_pmksa-pointer-during-initial-associati.patch,
  0012-pmkokc-PMKSA-make-deauthentication-due-to-cache-entry-remov.patch,
  0013-pmkokc-PMKSA-update-current-cache-entry-due-to-association-.patch:
  Cherry-pick patches to properly do OKC (Opportunistic Key Caching) which
  helps maintaining connectivity on networks secured with WPA Enterprise,
  especially on nl80211-based drivers -- these patches require SME, and add
  or fix key caching and handling of the cache entries.
* debian/patches/force-enable-okc.patch: force Opportunistic Key Caching to
  be enabled.
* debian/patches/less-aggressive-roaming.patch: use less aggressive roaming
  settings to avoid switching to another AP unnecessarily, when the actual
  signal level difference is small.
* debian/patches/wpa_supplicant-dbus-null-error.patch: Don't send NULL to
  dbus_message_new_error().
* debian/patches/0001-nl80211-Fix-UNSPEC-signal-quality-reporting.patch: fix
  marking qual as invalid rather than signal level.
* debian/patches/wpa_supplicant-squelch-driver-disconnect-spam.patch: recover
  cleanly from streams of disconnect messages (like on iwl3945).
* debian/patches/wpa_supplicant-assoc-timeout.patch: increase association
  timeouts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
commit f47d639d495b32f0348c09a0fd0ff5b5791720d4
 
2
Author: Jouni Malinen <jouni.malinen@atheros.com>
 
3
Date:   Thu Nov 25 22:51:56 2010 +0200
 
4
 
 
5
    SME: Optimize recovery from common load balancing mechanisms
 
6
    
 
7
    When authentication or association fails when trying to connect to
 
8
    a BSS in an ESS that has multiple BSSes based on previous scans,
 
9
    limit the first recovery scan to only the known channels that has
 
10
    been seen previously. This speeds up recovery in some of the most
 
11
    commonly used load balancing mechanisms in enterprise WLAN
 
12
    networks.
 
13
 
 
14
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
 
15
index 2769c2f..68c8ce0 100644
 
16
--- a/wpa_supplicant/scan.c
 
17
+++ b/wpa_supplicant/scan.c
 
18
@@ -448,6 +448,14 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 
19
        }
 
20
 #endif /* CONFIG_WPS */
 
21
 
 
22
+       if (params.freqs == NULL && wpa_s->next_scan_freqs) {
 
23
+               wpa_printf(MSG_DEBUG, "Optimize scan based on previously "
 
24
+                          "generated frequency list");
 
25
+               params.freqs = wpa_s->next_scan_freqs;
 
26
+       } else
 
27
+               os_free(wpa_s->next_scan_freqs);
 
28
+       wpa_s->next_scan_freqs = NULL;
 
29
+
 
30
        params.filter_ssids = wpa_supplicant_build_filter_ssids(
 
31
                wpa_s->conf, &params.num_filter_ssids);
 
32
 
 
33
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
 
34
index 55788de..604b0a5 100644
 
35
--- a/wpa_supplicant/sme.c
 
36
+++ b/wpa_supplicant/sme.c
 
37
@@ -33,9 +33,30 @@
 
38
 #include "scan.h"
 
39
 #include "sme.h"
 
40
 
 
41
-static int sme_another_bss_in_ess(struct wpa_supplicant *wpa_s)
 
42
+static void add_freq(int *freqs, int *num_freqs, int freq)
 
43
+{
 
44
+       int i;
 
45
+
 
46
+       for (i = 0; i < *num_freqs; i++) {
 
47
+               if (freqs[i] == freq)
 
48
+                       return;
 
49
+       }
 
50
+
 
51
+       freqs[*num_freqs] = freq;
 
52
+       (*num_freqs)++;
 
53
+}
 
54
+
 
55
+
 
56
+static int * sme_another_bss_in_ess(struct wpa_supplicant *wpa_s)
 
57
 {
 
58
        struct wpa_bss *bss, *cbss;
 
59
+       const int max_freqs = 10;
 
60
+       int *freqs;
 
61
+       int num_freqs = 0;
 
62
+
 
63
+       freqs = os_zalloc(sizeof(int) * (max_freqs + 1));
 
64
+       if (freqs == NULL)
 
65
+               return NULL;
 
66
 
 
67
        cbss = wpa_s->current_bss;
 
68
 
 
69
@@ -44,11 +65,19 @@ static int sme_another_bss_in_ess(struct wpa_supplicant *wpa_s)
 
70
                        continue;
 
71
                if (bss->ssid_len == cbss->ssid_len &&
 
72
                    os_memcmp(bss->ssid, cbss->ssid, bss->ssid_len) == 0 &&
 
73
-                   wpa_blacklist_get(wpa_s, bss->bssid) == NULL)
 
74
-                       return 1;
 
75
+                   wpa_blacklist_get(wpa_s, bss->bssid) == NULL) {
 
76
+                       add_freq(freqs, &num_freqs, bss->freq);
 
77
+                       if (num_freqs == max_freqs)
 
78
+                               break;
 
79
+               }
 
80
        }
 
81
 
 
82
-       return 0;
 
83
+       if (num_freqs == 0) {
 
84
+               os_free(freqs);
 
85
+               freqs = NULL;
 
86
+       }
 
87
+
 
88
+       return freqs;
 
89
 }
 
90
 
 
91
 
 
92
@@ -57,6 +86,7 @@ static void sme_connection_failed(struct wpa_supplicant *wpa_s,
 
93
 {
 
94
        int timeout;
 
95
        int count;
 
96
+       int *freqs = NULL;
 
97
 
 
98
        /*
 
99
         * Add the failed BSSID into the blacklist and speed up next scan
 
100
@@ -74,10 +104,18 @@ static void sme_connection_failed(struct wpa_supplicant *wpa_s,
 
101
                 * next. Otherwise, we may as well try this one once more
 
102
                 * before allowing other, likely worse, ESSes to be considered.
 
103
                 */
 
104
-               if (sme_another_bss_in_ess(wpa_s)) {
 
105
+               freqs = sme_another_bss_in_ess(wpa_s);
 
106
+               if (freqs) {
 
107
                        wpa_printf(MSG_DEBUG, "SME: Another BSS in this ESS "
 
108
                                   "has been seen; try it next");
 
109
                        wpa_blacklist_add(wpa_s, bssid);
 
110
+                       /*
 
111
+                        * On the next scan, go through only the known channels
 
112
+                        * used in this ESS based on previous scans to speed up
 
113
+                        * common load balancing use case.
 
114
+                        */
 
115
+                       os_free(wpa_s->next_scan_freqs);
 
116
+                       wpa_s->next_scan_freqs = freqs;
 
117
                }
 
118
        }
 
119
 
 
120
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
 
121
index 0a603af..e990911 100644
 
122
--- a/wpa_supplicant/wpa_supplicant.c
 
123
+++ b/wpa_supplicant/wpa_supplicant.c
 
124
@@ -433,6 +433,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
 
125
 #ifdef CONFIG_AP
 
126
        wpa_supplicant_ap_deinit(wpa_s);
 
127
 #endif /* CONFIG_AP */
 
128
+
 
129
+       os_free(wpa_s->next_scan_freqs);
 
130
+       wpa_s->next_scan_freqs = NULL;
 
131
 }
 
132
 
 
133
 
 
134
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
 
135
index 853968c..4c6fa4f 100644
 
136
--- a/wpa_supplicant/wpa_supplicant_i.h
 
137
+++ b/wpa_supplicant/wpa_supplicant_i.h
 
138
@@ -404,6 +404,7 @@ struct wpa_supplicant {
 
139
        int scan_req; /* manual scan request; this forces a scan even if there
 
140
                       * are no enabled networks in the configuration */
 
141
        int scan_runs; /* number of scan runs since WPS was started */
 
142
+       int *next_scan_freqs;
 
143
 
 
144
        struct wpa_client_mlme mlme;
 
145
        unsigned int drv_flags;