#include <linux/kobject.h>
#include "ieee80211_i.h"
-#include "ieee80211_key.h"
+#include "key.h"
#include "debugfs.h"
#include "debugfs_key.h"
KEY_CONF_FILE(hw_key_idx, D);
KEY_FILE(flags, X);
KEY_FILE(tx_rx_count, D);
+KEY_READ(ifindex, sdata->dev->ifindex, 20, "%d\n");
+KEY_OPS(ifindex);
static ssize_t key_algorithm_read(struct file *file,
char __user *userbuf,
key->debugfs.name = debugfs_create_file(#name, 0400,\
key->debugfs.dir, key, &key_##name##_ops);
-void ieee80211_debugfs_key_add(struct ieee80211_local *local,
- struct ieee80211_key *key)
-{
+void ieee80211_debugfs_key_add(struct ieee80211_key *key)
+ {
static int keycount;
- char buf[20];
+ char buf[50];
+ DECLARE_MAC_BUF(mac);
+ struct sta_info *sta;
- if (!local->debugfs.keys)
+ if (!key->local->debugfs.keys)
return;
sprintf(buf, "%d", keycount);
+ key->debugfs.cnt = keycount;
keycount++;
key->debugfs.dir = debugfs_create_dir(buf,
- local->debugfs.keys);
+ key->local->debugfs.keys);
if (!key->debugfs.dir)
return;
+ rcu_read_lock();
+ sta = rcu_dereference(key->sta);
+ if (sta)
+ sprintf(buf, "../../stations/%s", print_mac(mac, sta->addr));
+ rcu_read_unlock();
+
+ /* using sta as a boolean is fine outside RCU lock */
+ if (sta)
+ key->debugfs.stalink =
+ debugfs_create_symlink("station", key->debugfs.dir, buf);
+
DEBUGFS_ADD(keylen);
DEBUGFS_ADD(flags);
DEBUGFS_ADD(keyidx);
DEBUGFS_ADD(rx_spec);
DEBUGFS_ADD(replays);
DEBUGFS_ADD(key);
+ DEBUGFS_ADD(ifindex);
};
#define DEBUGFS_DEL(name) \
DEBUGFS_DEL(rx_spec);
DEBUGFS_DEL(replays);
DEBUGFS_DEL(key);
+ DEBUGFS_DEL(ifindex);
debugfs_remove(key->debugfs.stalink);
key->debugfs.stalink = NULL;
void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata)
{
char buf[50];
+ struct ieee80211_key *key;
if (!sdata->debugfsdir)
return;
- sprintf(buf, "../keys/%d", sdata->default_key->conf.keyidx);
- sdata->debugfs.default_key =
- debugfs_create_symlink("default_key", sdata->debugfsdir, buf);
+ /* this is running under the key lock */
+
+ key = sdata->default_key;
+ if (key) {
+ sprintf(buf, "../keys/%d", key->debugfs.cnt);
+ sdata->debugfs.default_key =
+ debugfs_create_symlink("default_key",
+ sdata->debugfsdir, buf);
+ } else
+ ieee80211_debugfs_key_remove_default(sdata);
}
+
void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata)
{
if (!sdata)
debugfs_remove(sdata->debugfs.default_key);
sdata->debugfs.default_key = NULL;
}
-void ieee80211_debugfs_key_sta_link(struct ieee80211_key *key,
- struct sta_info *sta)
-{
- char buf[50];
-
- if (!key->debugfs.dir)
- return;
-
- sprintf(buf, "../../stations/" MAC_FMT, MAC_ARG(sta->addr));
- key->debugfs.stalink =
- debugfs_create_symlink("station", key->debugfs.dir, buf);
-}
void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key,
struct sta_info *sta)