mac80211: implement cfg80211_ops to query mesh proxy path table
Implement get_mpp and dump_mpp cfg80211_ops to export the content of the 802.11s mesh proxy path table to userspace. Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:

committed by
Johannes Berg

parent
66be7d2bcd
commit
a2db2ed3fb
@@ -1516,6 +1516,57 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mpp_set_pinfo(struct mesh_path *mpath, u8 *mpp,
|
||||
struct mpath_info *pinfo)
|
||||
{
|
||||
memset(pinfo, 0, sizeof(*pinfo));
|
||||
memcpy(mpp, mpath->mpp, ETH_ALEN);
|
||||
|
||||
pinfo->generation = mpp_paths_generation;
|
||||
}
|
||||
|
||||
static int ieee80211_get_mpp(struct wiphy *wiphy, struct net_device *dev,
|
||||
u8 *dst, u8 *mpp, struct mpath_info *pinfo)
|
||||
|
||||
{
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
struct mesh_path *mpath;
|
||||
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
|
||||
rcu_read_lock();
|
||||
mpath = mpp_path_lookup(sdata, dst);
|
||||
if (!mpath) {
|
||||
rcu_read_unlock();
|
||||
return -ENOENT;
|
||||
}
|
||||
memcpy(dst, mpath->dst, ETH_ALEN);
|
||||
mpp_set_pinfo(mpath, mpp, pinfo);
|
||||
rcu_read_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ieee80211_dump_mpp(struct wiphy *wiphy, struct net_device *dev,
|
||||
int idx, u8 *dst, u8 *mpp,
|
||||
struct mpath_info *pinfo)
|
||||
{
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
struct mesh_path *mpath;
|
||||
|
||||
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
|
||||
|
||||
rcu_read_lock();
|
||||
mpath = mpp_path_lookup_by_idx(sdata, idx);
|
||||
if (!mpath) {
|
||||
rcu_read_unlock();
|
||||
return -ENOENT;
|
||||
}
|
||||
memcpy(dst, mpath->dst, ETH_ALEN);
|
||||
mpp_set_pinfo(mpath, mpp, pinfo);
|
||||
rcu_read_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ieee80211_get_mesh_config(struct wiphy *wiphy,
|
||||
struct net_device *dev,
|
||||
struct mesh_config *conf)
|
||||
@@ -3547,6 +3598,8 @@ const struct cfg80211_ops mac80211_config_ops = {
|
||||
.change_mpath = ieee80211_change_mpath,
|
||||
.get_mpath = ieee80211_get_mpath,
|
||||
.dump_mpath = ieee80211_dump_mpath,
|
||||
.get_mpp = ieee80211_get_mpp,
|
||||
.dump_mpp = ieee80211_dump_mpp,
|
||||
.update_mesh_config = ieee80211_update_mesh_config,
|
||||
.get_mesh_config = ieee80211_get_mesh_config,
|
||||
.join_mesh = ieee80211_join_mesh,
|
||||
|
Reference in New Issue
Block a user