diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /net/mac80211/debugfs_key.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'net/mac80211/debugfs_key.c')
-rw-r--r-- | net/mac80211/debugfs_key.c | 50 |
1 files changed, 14 insertions, 36 deletions
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index c3a3082b72e..38e6101190d 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -30,7 +30,7 @@ static ssize_t key_##name##_read(struct file *file, \ | |||
30 | #define KEY_OPS(name) \ | 30 | #define KEY_OPS(name) \ |
31 | static const struct file_operations key_ ##name## _ops = { \ | 31 | static const struct file_operations key_ ##name## _ops = { \ |
32 | .read = key_##name##_read, \ | 32 | .read = key_##name##_read, \ |
33 | .open = simple_open, \ | 33 | .open = mac80211_open_file_generic, \ |
34 | .llseek = generic_file_llseek, \ | 34 | .llseek = generic_file_llseek, \ |
35 | } | 35 | } |
36 | 36 | ||
@@ -45,7 +45,7 @@ static const struct file_operations key_ ##name## _ops = { \ | |||
45 | #define KEY_CONF_OPS(name) \ | 45 | #define KEY_CONF_OPS(name) \ |
46 | static const struct file_operations key_ ##name## _ops = { \ | 46 | static const struct file_operations key_ ##name## _ops = { \ |
47 | .read = key_conf_##name##_read, \ | 47 | .read = key_conf_##name##_read, \ |
48 | .open = simple_open, \ | 48 | .open = mac80211_open_file_generic, \ |
49 | .llseek = generic_file_llseek, \ | 49 | .llseek = generic_file_llseek, \ |
50 | } | 50 | } |
51 | 51 | ||
@@ -116,7 +116,7 @@ static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf, | |||
116 | size_t count, loff_t *ppos) | 116 | size_t count, loff_t *ppos) |
117 | { | 117 | { |
118 | struct ieee80211_key *key = file->private_data; | 118 | struct ieee80211_key *key = file->private_data; |
119 | char buf[14*IEEE80211_NUM_TIDS+1], *p = buf; | 119 | char buf[14*NUM_RX_DATA_QUEUES+1], *p = buf; |
120 | int i, len; | 120 | int i, len; |
121 | const u8 *rpn; | 121 | const u8 *rpn; |
122 | 122 | ||
@@ -126,7 +126,7 @@ static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf, | |||
126 | len = scnprintf(buf, sizeof(buf), "\n"); | 126 | len = scnprintf(buf, sizeof(buf), "\n"); |
127 | break; | 127 | break; |
128 | case WLAN_CIPHER_SUITE_TKIP: | 128 | case WLAN_CIPHER_SUITE_TKIP: |
129 | for (i = 0; i < IEEE80211_NUM_TIDS; i++) | 129 | for (i = 0; i < NUM_RX_DATA_QUEUES; i++) |
130 | p += scnprintf(p, sizeof(buf)+buf-p, | 130 | p += scnprintf(p, sizeof(buf)+buf-p, |
131 | "%08x %04x\n", | 131 | "%08x %04x\n", |
132 | key->u.tkip.rx[i].iv32, | 132 | key->u.tkip.rx[i].iv32, |
@@ -134,7 +134,7 @@ static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf, | |||
134 | len = p - buf; | 134 | len = p - buf; |
135 | break; | 135 | break; |
136 | case WLAN_CIPHER_SUITE_CCMP: | 136 | case WLAN_CIPHER_SUITE_CCMP: |
137 | for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) { | 137 | for (i = 0; i < NUM_RX_DATA_QUEUES + 1; i++) { |
138 | rpn = key->u.ccmp.rx_pn[i]; | 138 | rpn = key->u.ccmp.rx_pn[i]; |
139 | p += scnprintf(p, sizeof(buf)+buf-p, | 139 | p += scnprintf(p, sizeof(buf)+buf-p, |
140 | "%02x%02x%02x%02x%02x%02x\n", | 140 | "%02x%02x%02x%02x%02x%02x\n", |
@@ -199,22 +199,6 @@ static ssize_t key_icverrors_read(struct file *file, char __user *userbuf, | |||
199 | } | 199 | } |
200 | KEY_OPS(icverrors); | 200 | KEY_OPS(icverrors); |
201 | 201 | ||
202 | static ssize_t key_mic_failures_read(struct file *file, char __user *userbuf, | ||
203 | size_t count, loff_t *ppos) | ||
204 | { | ||
205 | struct ieee80211_key *key = file->private_data; | ||
206 | char buf[20]; | ||
207 | int len; | ||
208 | |||
209 | if (key->conf.cipher != WLAN_CIPHER_SUITE_TKIP) | ||
210 | return -EINVAL; | ||
211 | |||
212 | len = scnprintf(buf, sizeof(buf), "%u\n", key->u.tkip.mic_failures); | ||
213 | |||
214 | return simple_read_from_buffer(userbuf, count, ppos, buf, len); | ||
215 | } | ||
216 | KEY_OPS(mic_failures); | ||
217 | |||
218 | static ssize_t key_key_read(struct file *file, char __user *userbuf, | 202 | static ssize_t key_key_read(struct file *file, char __user *userbuf, |
219 | size_t count, loff_t *ppos) | 203 | size_t count, loff_t *ppos) |
220 | { | 204 | { |
@@ -241,9 +225,9 @@ KEY_OPS(key); | |||
241 | key, &key_##name##_ops); | 225 | key, &key_##name##_ops); |
242 | 226 | ||
243 | void ieee80211_debugfs_key_add(struct ieee80211_key *key) | 227 | void ieee80211_debugfs_key_add(struct ieee80211_key *key) |
244 | { | 228 | { |
245 | static int keycount; | 229 | static int keycount; |
246 | char buf[100]; | 230 | char buf[50]; |
247 | struct sta_info *sta; | 231 | struct sta_info *sta; |
248 | 232 | ||
249 | if (!key->local->debugfs.keys) | 233 | if (!key->local->debugfs.keys) |
@@ -260,8 +244,7 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key) | |||
260 | 244 | ||
261 | sta = key->sta; | 245 | sta = key->sta; |
262 | if (sta) { | 246 | if (sta) { |
263 | sprintf(buf, "../../netdev:%s/stations/%pM", | 247 | sprintf(buf, "../../stations/%pM", sta->sta.addr); |
264 | sta->sdata->name, sta->sta.addr); | ||
265 | key->debugfs.stalink = | 248 | key->debugfs.stalink = |
266 | debugfs_create_symlink("station", key->debugfs.dir, buf); | 249 | debugfs_create_symlink("station", key->debugfs.dir, buf); |
267 | } | 250 | } |
@@ -276,7 +259,6 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key) | |||
276 | DEBUGFS_ADD(rx_spec); | 259 | DEBUGFS_ADD(rx_spec); |
277 | DEBUGFS_ADD(replays); | 260 | DEBUGFS_ADD(replays); |
278 | DEBUGFS_ADD(icverrors); | 261 | DEBUGFS_ADD(icverrors); |
279 | DEBUGFS_ADD(mic_failures); | ||
280 | DEBUGFS_ADD(key); | 262 | DEBUGFS_ADD(key); |
281 | DEBUGFS_ADD(ifindex); | 263 | DEBUGFS_ADD(ifindex); |
282 | }; | 264 | }; |
@@ -300,11 +282,6 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata) | |||
300 | 282 | ||
301 | lockdep_assert_held(&sdata->local->key_mtx); | 283 | lockdep_assert_held(&sdata->local->key_mtx); |
302 | 284 | ||
303 | if (sdata->debugfs.default_unicast_key) { | ||
304 | debugfs_remove(sdata->debugfs.default_unicast_key); | ||
305 | sdata->debugfs.default_unicast_key = NULL; | ||
306 | } | ||
307 | |||
308 | if (sdata->default_unicast_key) { | 285 | if (sdata->default_unicast_key) { |
309 | key = key_mtx_dereference(sdata->local, | 286 | key = key_mtx_dereference(sdata->local, |
310 | sdata->default_unicast_key); | 287 | sdata->default_unicast_key); |
@@ -312,11 +289,9 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata) | |||
312 | sdata->debugfs.default_unicast_key = | 289 | sdata->debugfs.default_unicast_key = |
313 | debugfs_create_symlink("default_unicast_key", | 290 | debugfs_create_symlink("default_unicast_key", |
314 | sdata->debugfs.dir, buf); | 291 | sdata->debugfs.dir, buf); |
315 | } | 292 | } else { |
316 | 293 | debugfs_remove(sdata->debugfs.default_unicast_key); | |
317 | if (sdata->debugfs.default_multicast_key) { | 294 | sdata->debugfs.default_unicast_key = NULL; |
318 | debugfs_remove(sdata->debugfs.default_multicast_key); | ||
319 | sdata->debugfs.default_multicast_key = NULL; | ||
320 | } | 295 | } |
321 | 296 | ||
322 | if (sdata->default_multicast_key) { | 297 | if (sdata->default_multicast_key) { |
@@ -326,6 +301,9 @@ void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata) | |||
326 | sdata->debugfs.default_multicast_key = | 301 | sdata->debugfs.default_multicast_key = |
327 | debugfs_create_symlink("default_multicast_key", | 302 | debugfs_create_symlink("default_multicast_key", |
328 | sdata->debugfs.dir, buf); | 303 | sdata->debugfs.dir, buf); |
304 | } else { | ||
305 | debugfs_remove(sdata->debugfs.default_multicast_key); | ||
306 | sdata->debugfs.default_multicast_key = NULL; | ||
329 | } | 307 | } |
330 | } | 308 | } |
331 | 309 | ||