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

« back to all changes in this revision

Viewing changes to debian/patches/0004-pmkokc-Flush-PMKSA-cache-entries-and-invalidate-EAP-state-o.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
From d8a790b9228ca91eadc8f26faf87287c330510a1 Mon Sep 17 00:00:00 2001
 
2
From: Jouni Malinen <jouni@qca.qualcomm.com>
 
3
Date: Wed, 7 Sep 2011 17:46:00 +0300
 
4
Subject: [PATCH] Flush PMKSA cache entries and invalidate EAP state on
 
5
 network changes
 
6
 
 
7
If a network configuration block is removed or modified, flush
 
8
all PMKSA cache entries that were created using that network
 
9
configuration. Similarly, invalidate EAP state (fast re-auth).
 
10
 
 
11
The special case for OKC on wpa_supplicant reconfiguration
 
12
(network_ctx pointer change) is now addressed as part of the
 
13
PMKSA cache flushing, so it does not need a separate mechanism
 
14
for clearing the network_ctx values in the PMKSA cache.
 
15
---
 
16
 src/rsn_supp/pmksa_cache.c      |   50 ++++++++++++++++++++++++++------------
 
17
 src/rsn_supp/pmksa_cache.h      |   11 ++++----
 
18
 src/rsn_supp/wpa.c              |   10 ++++++-
 
19
 src/rsn_supp/wpa.h              |    7 +++++
 
20
 wpa_supplicant/ctrl_iface.c     |   17 ++++++++----
 
21
 wpa_supplicant/notify.c         |    2 +
 
22
 wpa_supplicant/wpa_supplicant.c |    1 +
 
23
 7 files changed, 69 insertions(+), 29 deletions(-)
 
24
 
 
25
diff -up wpa_supplicant-0.7.3/src/rsn_supp/pmksa_cache.c.flush-pmksa wpa_supplicant-0.7.3/src/rsn_supp/pmksa_cache.c
 
26
--- wpa_supplicant-0.7.3/src/rsn_supp/pmksa_cache.c.flush-pmksa 2012-06-08 12:13:07.876107152 -0500
 
27
+++ wpa_supplicant-0.7.3/src/rsn_supp/pmksa_cache.c     2012-06-08 12:13:07.879107115 -0500
 
28
@@ -230,6 +230,40 @@ pmksa_cache_add(struct rsn_pmksa_cache *
 
29
 
 
30
 
 
31
 /**
 
32
+ * pmksa_cache_flush - Flush PMKSA cache entries for a specific network
 
33
+ * @pmksa: Pointer to PMKSA cache data from pmksa_cache_init()
 
34
+ * @network_ctx: Network configuration context or %NULL to flush all entries
 
35
+ */
 
36
+void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx)
 
37
+{
 
38
+       struct rsn_pmksa_cache_entry *entry, *prev = NULL, *tmp;
 
39
+       int removed = 0;
 
40
+
 
41
+       entry = pmksa->pmksa;
 
42
+       while (entry) {
 
43
+               if (entry->network_ctx == network_ctx || network_ctx == NULL) {
 
44
+                       wpa_printf(MSG_DEBUG, "RSN: Flush PMKSA cache entry "
 
45
+                                  "for " MACSTR, MAC2STR(entry->aa));
 
46
+                       if (prev)
 
47
+                               prev->next = entry->next;
 
48
+                       else
 
49
+                               pmksa->pmksa = entry->next;
 
50
+                       tmp = entry;
 
51
+                       entry = entry->next;
 
52
+                       wpa_sm_remove_pmkid(pmksa->sm, tmp->aa, tmp->pmkid);
 
53
+                       pmksa_cache_free_entry(pmksa, tmp, 0);
 
54
+                       removed++;
 
55
+               } else {
 
56
+                       prev = entry;
 
57
+                       entry = entry->next;
 
58
+               }
 
59
+       }
 
60
+       if (removed)
 
61
+               pmksa_cache_set_expiration(pmksa);
 
62
+}
 
63
+
 
64
+
 
65
+/**
 
66
  * pmksa_cache_deinit - Free all entries in PMKSA cache
 
67
  * @pmksa: Pointer to PMKSA cache data from pmksa_cache_init()
 
68
  */
 
69
@@ -274,22 +308,6 @@ struct rsn_pmksa_cache_entry * pmksa_cac
 
70
 }
 
71
 
 
72
 
 
73
-/**
 
74
- * pmksa_cache_notify_reconfig - Reconfiguration notification for PMKSA cache
 
75
- * @pmksa: Pointer to PMKSA cache data from pmksa_cache_init()
 
76
- *
 
77
- * Clear references to old data structures when wpa_supplicant is reconfigured.
 
78
- */
 
79
-void pmksa_cache_notify_reconfig(struct rsn_pmksa_cache *pmksa)
 
80
-{
 
81
-       struct rsn_pmksa_cache_entry *entry = pmksa->pmksa;
 
82
-       while (entry) {
 
83
-               entry->network_ctx = NULL;
 
84
-               entry = entry->next;
 
85
-       }
 
86
-}
 
87
-
 
88
-
 
89
 static struct rsn_pmksa_cache_entry *
 
90
 pmksa_cache_clone_entry(struct rsn_pmksa_cache *pmksa,
 
91
                        const struct rsn_pmksa_cache_entry *old_entry,
 
92
diff -up wpa_supplicant-0.7.3/src/rsn_supp/pmksa_cache.h.flush-pmksa wpa_supplicant-0.7.3/src/rsn_supp/pmksa_cache.h
 
93
--- wpa_supplicant-0.7.3/src/rsn_supp/pmksa_cache.h.flush-pmksa 2010-09-07 10:43:39.000000000 -0500
 
94
+++ wpa_supplicant-0.7.3/src/rsn_supp/pmksa_cache.h     2012-06-08 12:13:07.879107115 -0500
 
95
@@ -57,7 +57,6 @@ int pmksa_cache_list(struct rsn_pmksa_ca
 
96
 struct rsn_pmksa_cache_entry *
 
97
 pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
 
98
                const u8 *aa, const u8 *spa, void *network_ctx, int akmp);
 
99
-void pmksa_cache_notify_reconfig(struct rsn_pmksa_cache *pmksa);
 
100
 struct rsn_pmksa_cache_entry * pmksa_cache_get_current(struct wpa_sm *sm);
 
101
 void pmksa_cache_clear_current(struct wpa_sm *sm);
 
102
 int pmksa_cache_set_current(struct wpa_sm *sm, const u8 *pmkid,
 
103
@@ -66,6 +65,7 @@ int pmksa_cache_set_current(struct wpa_s
 
104
 struct rsn_pmksa_cache_entry *
 
105
 pmksa_cache_get_opportunistic(struct rsn_pmksa_cache *pmksa,
 
106
                              void *network_ctx, const u8 *aa);
 
107
+void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa, void *network_ctx);
 
108
 
 
109
 #else /* IEEE8021X_EAPOL and !CONFIG_NO_WPA2 */
 
110
 
 
111
@@ -106,10 +106,6 @@ pmksa_cache_add(struct rsn_pmksa_cache *
 
112
        return NULL;
 
113
 }
 
114
 
 
115
-static inline void pmksa_cache_notify_reconfig(struct rsn_pmksa_cache *pmksa)
 
116
-{
 
117
-}
 
118
-
 
119
 static inline void pmksa_cache_clear_current(struct wpa_sm *sm)
 
120
 {
 
121
 }
 
122
@@ -122,6 +118,11 @@ static inline int pmksa_cache_set_curren
 
123
        return -1;
 
124
 }
 
125
 
 
126
+static inline void pmksa_cache_flush(struct rsn_pmksa_cache *pmksa,
 
127
+                                    void *network_ctx)
 
128
+{
 
129
+}
 
130
+
 
131
 #endif /* IEEE8021X_EAPOL and !CONFIG_NO_WPA2 */
 
132
 
 
133
 #endif /* PMKSA_CACHE_H */
 
134
diff -up wpa_supplicant-0.7.3/src/rsn_supp/wpa.c.flush-pmksa wpa_supplicant-0.7.3/src/rsn_supp/wpa.c
 
135
--- wpa_supplicant-0.7.3/src/rsn_supp/wpa.c.flush-pmksa 2010-09-07 10:43:39.000000000 -0500
 
136
+++ wpa_supplicant-0.7.3/src/rsn_supp/wpa.c     2012-06-08 12:50:17.761229751 -0500
 
137
@@ -2191,8 +2191,6 @@ void wpa_sm_set_config(struct wpa_sm *sm
 
138
                sm->ssid_len = 0;
 
139
                sm->wpa_ptk_rekey = 0;
 
140
        }
 
141
-       if (config == NULL || config->network_ctx != sm->network_ctx)
 
142
-               pmksa_cache_notify_reconfig(sm->pmksa);
 
143
 }
 
144
 
 
145
 
 
146
@@ -2564,3 +2562,11 @@ int wpa_sm_has_ptk(struct wpa_sm *sm)
 
147
                return 0;
 
148
        return sm->ptk_set;
 
149
 }
 
150
+
 
151
+
 
152
+void wpa_sm_pmksa_cache_flush(struct wpa_sm *sm, void *network_ctx)
 
153
+{
 
154
+#ifndef CONFIG_NO_WPA2
 
155
+       pmksa_cache_flush(sm->pmksa, network_ctx);
 
156
+#endif /* CONFIG_NO_WPA2 */
 
157
+}
 
158
diff -up wpa_supplicant-0.7.3/src/rsn_supp/wpa.h.flush-pmksa wpa_supplicant-0.7.3/src/rsn_supp/wpa.h
 
159
--- wpa_supplicant-0.7.3/src/rsn_supp/wpa.h.flush-pmksa 2010-09-07 10:43:39.000000000 -0500
 
160
+++ wpa_supplicant-0.7.3/src/rsn_supp/wpa.h     2012-06-08 12:50:50.525820138 -0500
 
161
@@ -126,6 +126,8 @@ int wpa_sm_pmksa_cache_list(struct wpa_s
 
162
 void wpa_sm_drop_sa(struct wpa_sm *sm);
 
163
 int wpa_sm_has_ptk(struct wpa_sm *sm);
 
164
 
 
165
+void wpa_sm_pmksa_cache_flush(struct wpa_sm *sm, void *network_ctx);
 
166
+
 
167
 #else /* CONFIG_NO_WPA */
 
168
 
 
169
 static inline struct wpa_sm * wpa_sm_init(struct wpa_sm_ctx *ctx)
 
170
@@ -271,6 +273,11 @@ static inline int wpa_sm_has_ptk(struct
 
171
        return 0;
 
172
 }
 
173
 
 
174
+static inline void wpa_sm_pmksa_cache_flush(struct wpa_sm *sm,
 
175
+                                           void *network_ctx)
 
176
+{
 
177
+}
 
178
+
 
179
 #endif /* CONFIG_NO_WPA */
 
180
 
 
181
 #ifdef CONFIG_PEERKEY
 
182
diff -up wpa_supplicant-0.7.3/wpa_supplicant/ctrl_iface.c.flush-pmksa wpa_supplicant-0.7.3/wpa_supplicant/ctrl_iface.c
 
183
--- wpa_supplicant-0.7.3/wpa_supplicant/ctrl_iface.c.flush-pmksa        2012-06-08 12:13:07.872107201 -0500
 
184
+++ wpa_supplicant-0.7.3/wpa_supplicant/ctrl_iface.c    2012-06-08 12:13:07.882107076 -0500
 
185
@@ -1018,8 +1018,8 @@ static int wpa_supplicant_ctrl_iface_rem
 
186
                        wpas_notify_network_removed(wpa_s, remove_ssid);
 
187
                        wpa_config_remove_network(wpa_s->conf, id);
 
188
                }
 
189
+               eapol_sm_invalidate_cached_session(wpa_s->eapol);
 
190
                if (wpa_s->current_ssid) {
 
191
-                       eapol_sm_invalidate_cached_session(wpa_s->eapol);
 
192
                        wpa_sm_set_config(wpa_s->wpa, NULL);
 
193
                        eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
 
194
                        wpa_supplicant_disassociate(wpa_s,
 
195
@@ -1039,12 +1039,15 @@ static int wpa_supplicant_ctrl_iface_rem
 
196
                return -1;
 
197
        }
 
198
 
 
199
-       if (ssid == wpa_s->current_ssid) {
 
200
+       if (ssid == wpa_s->current_ssid || wpa_s->current_ssid == NULL) {
 
201
                /*
 
202
-                * Invalidate the EAP session cache if the current network is
 
203
-                * removed.
 
204
+                * Invalidate the EAP session cache if the current or
 
205
+                * previously used network is removed.
 
206
                 */
 
207
                eapol_sm_invalidate_cached_session(wpa_s->eapol);
 
208
+       }
 
209
+
 
210
+       if (ssid == wpa_s->current_ssid) {
 
211
                wpa_sm_set_config(wpa_s->wpa, NULL);
 
212
                eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
 
213
 
 
214
@@ -1092,10 +1095,12 @@ static int wpa_supplicant_ctrl_iface_set
 
215
                return -1;
 
216
        }
 
217
 
 
218
-       if (wpa_s->current_ssid == ssid) {
 
219
+       wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
 
220
+
 
221
+       if (wpa_s->current_ssid == ssid || wpa_s->current_ssid == NULL) {
 
222
                /*
 
223
                 * Invalidate the EAP session cache if anything in the current
 
224
-                * configuration changes.
 
225
+                * or previously used configuration changes.
 
226
                 */
 
227
                eapol_sm_invalidate_cached_session(wpa_s->eapol);
 
228
        }
 
229
diff -up wpa_supplicant-0.7.3/wpa_supplicant/notify.c.flush-pmksa wpa_supplicant-0.7.3/wpa_supplicant/notify.c
 
230
--- wpa_supplicant-0.7.3/wpa_supplicant/notify.c.flush-pmksa    2012-06-08 12:13:07.000000000 -0500
 
231
+++ wpa_supplicant-0.7.3/wpa_supplicant/notify.c        2012-06-08 12:51:21.230436277 -0500
 
232
@@ -192,6 +192,7 @@ void wpas_notify_network_added(struct wp
 
233
 void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
 
234
                                 struct wpa_ssid *ssid)
 
235
 {
 
236
+       wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
 
237
        wpas_dbus_unregister_network(wpa_s, ssid->id);
 
238
 }
 
239
 
 
240
diff -up wpa_supplicant-0.7.3/wpa_supplicant/wpa_supplicant.c.flush-pmksa wpa_supplicant-0.7.3/wpa_supplicant/wpa_supplicant.c
 
241
--- wpa_supplicant-0.7.3/wpa_supplicant/wpa_supplicant.c.flush-pmksa    2012-06-08 12:13:07.860107352 -0500
 
242
+++ wpa_supplicant-0.7.3/wpa_supplicant/wpa_supplicant.c        2012-06-08 12:13:07.884107051 -0500
 
243
@@ -686,6 +686,7 @@ int wpa_supplicant_reload_configuration(
 
244
        }
 
245
        eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
 
246
        wpa_sm_set_config(wpa_s->wpa, NULL);
 
247
+       wpa_sm_pmksa_cache_flush(wpa_s->wpa, NULL);
 
248
        wpa_sm_set_fast_reauth(wpa_s->wpa, wpa_s->conf->fast_reauth);
 
249
        rsn_preauth_deinit(wpa_s->wpa);
 
250