diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-08-28 17:01:52 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:48:40 -0400 |
commit | 50339a67e2d4386d8919195989371579cab8649d (patch) | |
tree | 398fffe801706572f58ac0b7c8078112e1c3b97b /net/mac80211 | |
parent | 2a8a9a88fc1b18f5c45244d0ef8a5352f6cf761f (diff) |
[MAC80211]: fix key debugfs
This fixes two issues with the key debugfs:
1) key index obviously isn't unique
2) various missing break statements led to bogus output
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/debugfs_key.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index 7d56dc9e7326..077f907271cf 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -77,14 +77,17 @@ static ssize_t key_tx_spec_read(struct file *file, char __user *userbuf, | |||
77 | switch (key->alg) { | 77 | switch (key->alg) { |
78 | case ALG_WEP: | 78 | case ALG_WEP: |
79 | len = scnprintf(buf, sizeof(buf), "\n"); | 79 | len = scnprintf(buf, sizeof(buf), "\n"); |
80 | break; | ||
80 | case ALG_TKIP: | 81 | case ALG_TKIP: |
81 | len = scnprintf(buf, sizeof(buf), "%08x %04x\n", | 82 | len = scnprintf(buf, sizeof(buf), "%08x %04x\n", |
82 | key->u.tkip.iv32, | 83 | key->u.tkip.iv32, |
83 | key->u.tkip.iv16); | 84 | key->u.tkip.iv16); |
85 | break; | ||
84 | case ALG_CCMP: | 86 | case ALG_CCMP: |
85 | tpn = key->u.ccmp.tx_pn; | 87 | tpn = key->u.ccmp.tx_pn; |
86 | len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n", | 88 | len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n", |
87 | tpn[0], tpn[1], tpn[2], tpn[3], tpn[4], tpn[5]); | 89 | tpn[0], tpn[1], tpn[2], tpn[3], tpn[4], tpn[5]); |
90 | break; | ||
88 | default: | 91 | default: |
89 | return 0; | 92 | return 0; |
90 | } | 93 | } |
@@ -103,6 +106,7 @@ static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf, | |||
103 | switch (key->alg) { | 106 | switch (key->alg) { |
104 | case ALG_WEP: | 107 | case ALG_WEP: |
105 | len = scnprintf(buf, sizeof(buf), "\n"); | 108 | len = scnprintf(buf, sizeof(buf), "\n"); |
109 | break; | ||
106 | case ALG_TKIP: | 110 | case ALG_TKIP: |
107 | for (i = 0; i < NUM_RX_DATA_QUEUES; i++) | 111 | for (i = 0; i < NUM_RX_DATA_QUEUES; i++) |
108 | p += scnprintf(p, sizeof(buf)+buf-p, | 112 | p += scnprintf(p, sizeof(buf)+buf-p, |
@@ -110,6 +114,7 @@ static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf, | |||
110 | key->u.tkip.iv32_rx[i], | 114 | key->u.tkip.iv32_rx[i], |
111 | key->u.tkip.iv16_rx[i]); | 115 | key->u.tkip.iv16_rx[i]); |
112 | len = p - buf; | 116 | len = p - buf; |
117 | break; | ||
113 | case ALG_CCMP: | 118 | case ALG_CCMP: |
114 | for (i = 0; i < NUM_RX_DATA_QUEUES; i++) { | 119 | for (i = 0; i < NUM_RX_DATA_QUEUES; i++) { |
115 | rpn = key->u.ccmp.rx_pn[i]; | 120 | rpn = key->u.ccmp.rx_pn[i]; |
@@ -119,6 +124,7 @@ static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf, | |||
119 | rpn[3], rpn[4], rpn[5]); | 124 | rpn[3], rpn[4], rpn[5]); |
120 | } | 125 | } |
121 | len = p - buf; | 126 | len = p - buf; |
127 | break; | ||
122 | default: | 128 | default: |
123 | return 0; | 129 | return 0; |
124 | } | 130 | } |
@@ -164,12 +170,14 @@ KEY_OPS(key); | |||
164 | void ieee80211_debugfs_key_add(struct ieee80211_local *local, | 170 | void ieee80211_debugfs_key_add(struct ieee80211_local *local, |
165 | struct ieee80211_key *key) | 171 | struct ieee80211_key *key) |
166 | { | 172 | { |
173 | static int keycount; | ||
167 | char buf[20]; | 174 | char buf[20]; |
168 | 175 | ||
169 | if (!local->debugfs.keys) | 176 | if (!local->debugfs.keys) |
170 | return; | 177 | return; |
171 | 178 | ||
172 | sprintf(buf, "%d", key->keyidx); | 179 | sprintf(buf, "%d", keycount); |
180 | keycount++; | ||
173 | key->debugfs.dir = debugfs_create_dir(buf, | 181 | key->debugfs.dir = debugfs_create_dir(buf, |
174 | local->debugfs.keys); | 182 | local->debugfs.keys); |
175 | 183 | ||
@@ -239,7 +247,7 @@ void ieee80211_debugfs_key_sta_link(struct ieee80211_key *key, | |||
239 | if (!key->debugfs.dir) | 247 | if (!key->debugfs.dir) |
240 | return; | 248 | return; |
241 | 249 | ||
242 | sprintf(buf, "../sta/" MAC_FMT, MAC_ARG(sta->addr)); | 250 | sprintf(buf, "../../stations/" MAC_FMT, MAC_ARG(sta->addr)); |
243 | key->debugfs.stalink = | 251 | key->debugfs.stalink = |
244 | debugfs_create_symlink("station", key->debugfs.dir, buf); | 252 | debugfs_create_symlink("station", key->debugfs.dir, buf); |
245 | } | 253 | } |