Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2003-2005 Devicescape Software, Inc. |
| 3 | * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> |
| 4 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/kobject.h> |
| 12 | #include "ieee80211_i.h" |
Johannes Berg | 2c8dccc | 2008-04-08 15:14:40 -0400 | [diff] [blame] | 13 | #include "key.h" |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 14 | #include "debugfs.h" |
| 15 | #include "debugfs_key.h" |
| 16 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 17 | #define KEY_READ(name, prop, buflen, format_string) \ |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 18 | static ssize_t key_##name##_read(struct file *file, \ |
| 19 | char __user *userbuf, \ |
| 20 | size_t count, loff_t *ppos) \ |
| 21 | { \ |
| 22 | char buf[buflen]; \ |
| 23 | struct ieee80211_key *key = file->private_data; \ |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 24 | int res = scnprintf(buf, buflen, format_string, key->prop); \ |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 25 | return simple_read_from_buffer(userbuf, count, ppos, buf, res); \ |
| 26 | } |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 27 | #define KEY_READ_D(name) KEY_READ(name, name, 20, "%d\n") |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 28 | #define KEY_READ_X(name) KEY_READ(name, name, 20, "0x%x\n") |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 29 | |
| 30 | #define KEY_OPS(name) \ |
| 31 | static const struct file_operations key_ ##name## _ops = { \ |
| 32 | .read = key_##name##_read, \ |
| 33 | .open = mac80211_open_file_generic, \ |
| 34 | } |
| 35 | |
| 36 | #define KEY_FILE(name, format) \ |
| 37 | KEY_READ_##format(name) \ |
| 38 | KEY_OPS(name) |
| 39 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 40 | #define KEY_CONF_READ(name, buflen, format_string) \ |
| 41 | KEY_READ(conf_##name, conf.name, buflen, format_string) |
| 42 | #define KEY_CONF_READ_D(name) KEY_CONF_READ(name, 20, "%d\n") |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 43 | |
| 44 | #define KEY_CONF_OPS(name) \ |
| 45 | static const struct file_operations key_ ##name## _ops = { \ |
| 46 | .read = key_conf_##name##_read, \ |
| 47 | .open = mac80211_open_file_generic, \ |
| 48 | } |
| 49 | |
| 50 | #define KEY_CONF_FILE(name, format) \ |
| 51 | KEY_CONF_READ_##format(name) \ |
| 52 | KEY_CONF_OPS(name) |
| 53 | |
| 54 | KEY_CONF_FILE(keylen, D); |
| 55 | KEY_CONF_FILE(keyidx, D); |
| 56 | KEY_CONF_FILE(hw_key_idx, D); |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 57 | KEY_FILE(flags, X); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 58 | KEY_FILE(tx_rx_count, D); |
Johannes Berg | 47846c9 | 2009-11-25 17:46:19 +0100 | [diff] [blame] | 59 | KEY_READ(ifindex, sdata->name, IFNAMSIZ + 2, "%s\n"); |
Johannes Berg | e7a64f1 | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 60 | KEY_OPS(ifindex); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 61 | |
| 62 | static ssize_t key_algorithm_read(struct file *file, |
| 63 | char __user *userbuf, |
| 64 | size_t count, loff_t *ppos) |
| 65 | { |
| 66 | char *alg; |
| 67 | struct ieee80211_key *key = file->private_data; |
| 68 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 69 | switch (key->conf.alg) { |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 70 | case ALG_WEP: |
| 71 | alg = "WEP\n"; |
| 72 | break; |
| 73 | case ALG_TKIP: |
| 74 | alg = "TKIP\n"; |
| 75 | break; |
| 76 | case ALG_CCMP: |
| 77 | alg = "CCMP\n"; |
| 78 | break; |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 79 | case ALG_AES_CMAC: |
| 80 | alg = "AES-128-CMAC\n"; |
| 81 | break; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 82 | default: |
| 83 | return 0; |
| 84 | } |
| 85 | return simple_read_from_buffer(userbuf, count, ppos, alg, strlen(alg)); |
| 86 | } |
| 87 | KEY_OPS(algorithm); |
| 88 | |
| 89 | static ssize_t key_tx_spec_read(struct file *file, char __user *userbuf, |
| 90 | size_t count, loff_t *ppos) |
| 91 | { |
| 92 | const u8 *tpn; |
| 93 | char buf[20]; |
| 94 | int len; |
| 95 | struct ieee80211_key *key = file->private_data; |
| 96 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 97 | switch (key->conf.alg) { |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 98 | case ALG_WEP: |
| 99 | len = scnprintf(buf, sizeof(buf), "\n"); |
Johannes Berg | 50339a6 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 100 | break; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 101 | case ALG_TKIP: |
| 102 | len = scnprintf(buf, sizeof(buf), "%08x %04x\n", |
Harvey Harrison | b0f76b3 | 2008-05-14 16:26:19 -0700 | [diff] [blame] | 103 | key->u.tkip.tx.iv32, |
| 104 | key->u.tkip.tx.iv16); |
Johannes Berg | 50339a6 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 105 | break; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 106 | case ALG_CCMP: |
| 107 | tpn = key->u.ccmp.tx_pn; |
| 108 | len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n", |
| 109 | tpn[0], tpn[1], tpn[2], tpn[3], tpn[4], tpn[5]); |
Johannes Berg | 50339a6 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 110 | break; |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 111 | case ALG_AES_CMAC: |
| 112 | tpn = key->u.aes_cmac.tx_pn; |
| 113 | len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n", |
| 114 | tpn[0], tpn[1], tpn[2], tpn[3], tpn[4], |
| 115 | tpn[5]); |
| 116 | break; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 117 | default: |
| 118 | return 0; |
| 119 | } |
| 120 | return simple_read_from_buffer(userbuf, count, ppos, buf, len); |
| 121 | } |
| 122 | KEY_OPS(tx_spec); |
| 123 | |
| 124 | static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf, |
| 125 | size_t count, loff_t *ppos) |
| 126 | { |
| 127 | struct ieee80211_key *key = file->private_data; |
| 128 | char buf[14*NUM_RX_DATA_QUEUES+1], *p = buf; |
| 129 | int i, len; |
| 130 | const u8 *rpn; |
| 131 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 132 | switch (key->conf.alg) { |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 133 | case ALG_WEP: |
| 134 | len = scnprintf(buf, sizeof(buf), "\n"); |
Johannes Berg | 50339a6 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 135 | break; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 136 | case ALG_TKIP: |
| 137 | for (i = 0; i < NUM_RX_DATA_QUEUES; i++) |
| 138 | p += scnprintf(p, sizeof(buf)+buf-p, |
| 139 | "%08x %04x\n", |
Harvey Harrison | b0f76b3 | 2008-05-14 16:26:19 -0700 | [diff] [blame] | 140 | key->u.tkip.rx[i].iv32, |
| 141 | key->u.tkip.rx[i].iv16); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 142 | len = p - buf; |
Johannes Berg | 50339a6 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 143 | break; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 144 | case ALG_CCMP: |
| 145 | for (i = 0; i < NUM_RX_DATA_QUEUES; i++) { |
| 146 | rpn = key->u.ccmp.rx_pn[i]; |
| 147 | p += scnprintf(p, sizeof(buf)+buf-p, |
| 148 | "%02x%02x%02x%02x%02x%02x\n", |
| 149 | rpn[0], rpn[1], rpn[2], |
| 150 | rpn[3], rpn[4], rpn[5]); |
| 151 | } |
| 152 | len = p - buf; |
Johannes Berg | 50339a6 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 153 | break; |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 154 | case ALG_AES_CMAC: |
| 155 | rpn = key->u.aes_cmac.rx_pn; |
| 156 | p += scnprintf(p, sizeof(buf)+buf-p, |
| 157 | "%02x%02x%02x%02x%02x%02x\n", |
| 158 | rpn[0], rpn[1], rpn[2], |
| 159 | rpn[3], rpn[4], rpn[5]); |
| 160 | len = p - buf; |
| 161 | break; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 162 | default: |
| 163 | return 0; |
| 164 | } |
| 165 | return simple_read_from_buffer(userbuf, count, ppos, buf, len); |
| 166 | } |
| 167 | KEY_OPS(rx_spec); |
| 168 | |
| 169 | static ssize_t key_replays_read(struct file *file, char __user *userbuf, |
| 170 | size_t count, loff_t *ppos) |
| 171 | { |
| 172 | struct ieee80211_key *key = file->private_data; |
| 173 | char buf[20]; |
| 174 | int len; |
| 175 | |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 176 | switch (key->conf.alg) { |
| 177 | case ALG_CCMP: |
| 178 | len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays); |
| 179 | break; |
| 180 | case ALG_AES_CMAC: |
| 181 | len = scnprintf(buf, sizeof(buf), "%u\n", |
| 182 | key->u.aes_cmac.replays); |
| 183 | break; |
| 184 | default: |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 185 | return 0; |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 186 | } |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 187 | return simple_read_from_buffer(userbuf, count, ppos, buf, len); |
| 188 | } |
| 189 | KEY_OPS(replays); |
| 190 | |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 191 | static ssize_t key_icverrors_read(struct file *file, char __user *userbuf, |
| 192 | size_t count, loff_t *ppos) |
| 193 | { |
| 194 | struct ieee80211_key *key = file->private_data; |
| 195 | char buf[20]; |
| 196 | int len; |
| 197 | |
| 198 | switch (key->conf.alg) { |
| 199 | case ALG_AES_CMAC: |
| 200 | len = scnprintf(buf, sizeof(buf), "%u\n", |
| 201 | key->u.aes_cmac.icverrors); |
| 202 | break; |
| 203 | default: |
| 204 | return 0; |
| 205 | } |
| 206 | return simple_read_from_buffer(userbuf, count, ppos, buf, len); |
| 207 | } |
| 208 | KEY_OPS(icverrors); |
| 209 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 210 | static ssize_t key_key_read(struct file *file, char __user *userbuf, |
| 211 | size_t count, loff_t *ppos) |
| 212 | { |
| 213 | struct ieee80211_key *key = file->private_data; |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 214 | int i, res, bufsize = 2 * key->conf.keylen + 2; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 215 | char *buf = kmalloc(bufsize, GFP_KERNEL); |
| 216 | char *p = buf; |
| 217 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 218 | for (i = 0; i < key->conf.keylen; i++) |
| 219 | p += scnprintf(p, bufsize + buf - p, "%02x", key->conf.key[i]); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 220 | p += scnprintf(p, bufsize+buf-p, "\n"); |
| 221 | res = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); |
| 222 | kfree(buf); |
| 223 | return res; |
| 224 | } |
| 225 | KEY_OPS(key); |
| 226 | |
| 227 | #define DEBUGFS_ADD(name) \ |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 228 | debugfs_create_file(#name, 0400, key->debugfs.dir, \ |
| 229 | key, &key_##name##_ops); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 230 | |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 231 | void ieee80211_debugfs_key_add(struct ieee80211_key *key) |
| 232 | { |
Johannes Berg | 50339a6 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 233 | static int keycount; |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 234 | char buf[50]; |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 235 | struct sta_info *sta; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 236 | |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 237 | if (!key->local->debugfs.keys) |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 238 | return; |
| 239 | |
Johannes Berg | 50339a6 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 240 | sprintf(buf, "%d", keycount); |
Johannes Berg | d9c58f3 | 2008-04-08 16:46:36 -0400 | [diff] [blame] | 241 | key->debugfs.cnt = keycount; |
Johannes Berg | 50339a6 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 242 | keycount++; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 243 | key->debugfs.dir = debugfs_create_dir(buf, |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 244 | key->local->debugfs.keys); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 245 | |
| 246 | if (!key->debugfs.dir) |
| 247 | return; |
| 248 | |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 249 | rcu_read_lock(); |
| 250 | sta = rcu_dereference(key->sta); |
| 251 | if (sta) |
Johannes Berg | 0c68ae26 | 2008-10-27 15:56:10 -0700 | [diff] [blame] | 252 | sprintf(buf, "../../stations/%pM", sta->sta.addr); |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 253 | rcu_read_unlock(); |
| 254 | |
| 255 | /* using sta as a boolean is fine outside RCU lock */ |
| 256 | if (sta) |
| 257 | key->debugfs.stalink = |
| 258 | debugfs_create_symlink("station", key->debugfs.dir, buf); |
| 259 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 260 | DEBUGFS_ADD(keylen); |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 261 | DEBUGFS_ADD(flags); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 262 | DEBUGFS_ADD(keyidx); |
| 263 | DEBUGFS_ADD(hw_key_idx); |
| 264 | DEBUGFS_ADD(tx_rx_count); |
| 265 | DEBUGFS_ADD(algorithm); |
| 266 | DEBUGFS_ADD(tx_spec); |
| 267 | DEBUGFS_ADD(rx_spec); |
| 268 | DEBUGFS_ADD(replays); |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 269 | DEBUGFS_ADD(icverrors); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 270 | DEBUGFS_ADD(key); |
Johannes Berg | e7a64f1 | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 271 | DEBUGFS_ADD(ifindex); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 272 | }; |
| 273 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 274 | void ieee80211_debugfs_key_remove(struct ieee80211_key *key) |
| 275 | { |
| 276 | if (!key) |
| 277 | return; |
| 278 | |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 279 | debugfs_remove_recursive(key->debugfs.dir); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 280 | key->debugfs.dir = NULL; |
| 281 | } |
| 282 | void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) |
| 283 | { |
| 284 | char buf[50]; |
Johannes Berg | 78520ca | 2008-05-03 01:04:47 +0200 | [diff] [blame] | 285 | struct ieee80211_key *key; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 286 | |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 287 | if (!sdata->debugfs.dir) |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 288 | return; |
| 289 | |
Johannes Berg | 78520ca | 2008-05-03 01:04:47 +0200 | [diff] [blame] | 290 | /* this is running under the key lock */ |
| 291 | |
| 292 | key = sdata->default_key; |
| 293 | if (key) { |
| 294 | sprintf(buf, "../keys/%d", key->debugfs.cnt); |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 295 | sdata->debugfs.default_key = |
Johannes Berg | 78520ca | 2008-05-03 01:04:47 +0200 | [diff] [blame] | 296 | debugfs_create_symlink("default_key", |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 297 | sdata->debugfs.dir, buf); |
Johannes Berg | 78520ca | 2008-05-03 01:04:47 +0200 | [diff] [blame] | 298 | } else |
| 299 | ieee80211_debugfs_key_remove_default(sdata); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 300 | } |
Johannes Berg | 78520ca | 2008-05-03 01:04:47 +0200 | [diff] [blame] | 301 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 302 | void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata) |
| 303 | { |
| 304 | if (!sdata) |
| 305 | return; |
| 306 | |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 307 | debugfs_remove(sdata->debugfs.default_key); |
| 308 | sdata->debugfs.default_key = NULL; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 309 | } |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 310 | |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 311 | void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) |
| 312 | { |
| 313 | char buf[50]; |
| 314 | struct ieee80211_key *key; |
| 315 | |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 316 | if (!sdata->debugfs.dir) |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 317 | return; |
| 318 | |
| 319 | /* this is running under the key lock */ |
| 320 | |
| 321 | key = sdata->default_mgmt_key; |
| 322 | if (key) { |
| 323 | sprintf(buf, "../keys/%d", key->debugfs.cnt); |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 324 | sdata->debugfs.default_mgmt_key = |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 325 | debugfs_create_symlink("default_mgmt_key", |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 326 | sdata->debugfs.dir, buf); |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 327 | } else |
| 328 | ieee80211_debugfs_key_remove_mgmt_default(sdata); |
| 329 | } |
| 330 | |
| 331 | void ieee80211_debugfs_key_remove_mgmt_default(struct ieee80211_sub_if_data *sdata) |
| 332 | { |
| 333 | if (!sdata) |
| 334 | return; |
| 335 | |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 336 | debugfs_remove(sdata->debugfs.default_mgmt_key); |
| 337 | sdata->debugfs.default_mgmt_key = NULL; |
Jouni Malinen | 3cfcf6ac | 2009-01-08 13:32:02 +0200 | [diff] [blame] | 338 | } |
| 339 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 340 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, |
| 341 | struct sta_info *sta) |
| 342 | { |
| 343 | debugfs_remove(key->debugfs.stalink); |
| 344 | key->debugfs.stalink = NULL; |
| 345 | } |