aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorHenning Rogge <hrogge@gmail.com>2014-09-12 02:58:50 -0400
committerJohannes Berg <johannes.berg@intel.com>2014-10-09 05:19:07 -0400
commita2db2ed3fb7d35ff2405d08fc012a5db8ddb36e0 (patch)
tree34e459b20358a165edb5798787966f0d978f169d /net/mac80211/cfg.c
parent66be7d2bcd826344894be09dc385f9f805136b84 (diff)
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>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index fb6a1502b6df..3a04f2edd3c3 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1516,6 +1516,57 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
1516 return 0; 1516 return 0;
1517} 1517}
1518 1518
1519static void mpp_set_pinfo(struct mesh_path *mpath, u8 *mpp,
1520 struct mpath_info *pinfo)
1521{
1522 memset(pinfo, 0, sizeof(*pinfo));
1523 memcpy(mpp, mpath->mpp, ETH_ALEN);
1524
1525 pinfo->generation = mpp_paths_generation;
1526}
1527
1528static int ieee80211_get_mpp(struct wiphy *wiphy, struct net_device *dev,
1529 u8 *dst, u8 *mpp, struct mpath_info *pinfo)
1530
1531{
1532 struct ieee80211_sub_if_data *sdata;
1533 struct mesh_path *mpath;
1534
1535 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1536
1537 rcu_read_lock();
1538 mpath = mpp_path_lookup(sdata, dst);
1539 if (!mpath) {
1540 rcu_read_unlock();
1541 return -ENOENT;
1542 }
1543 memcpy(dst, mpath->dst, ETH_ALEN);
1544 mpp_set_pinfo(mpath, mpp, pinfo);
1545 rcu_read_unlock();
1546 return 0;
1547}
1548
1549static int ieee80211_dump_mpp(struct wiphy *wiphy, struct net_device *dev,
1550 int idx, u8 *dst, u8 *mpp,
1551 struct mpath_info *pinfo)
1552{
1553 struct ieee80211_sub_if_data *sdata;
1554 struct mesh_path *mpath;
1555
1556 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1557
1558 rcu_read_lock();
1559 mpath = mpp_path_lookup_by_idx(sdata, idx);
1560 if (!mpath) {
1561 rcu_read_unlock();
1562 return -ENOENT;
1563 }
1564 memcpy(dst, mpath->dst, ETH_ALEN);
1565 mpp_set_pinfo(mpath, mpp, pinfo);
1566 rcu_read_unlock();
1567 return 0;
1568}
1569
1519static int ieee80211_get_mesh_config(struct wiphy *wiphy, 1570static int ieee80211_get_mesh_config(struct wiphy *wiphy,
1520 struct net_device *dev, 1571 struct net_device *dev,
1521 struct mesh_config *conf) 1572 struct mesh_config *conf)
@@ -3547,6 +3598,8 @@ const struct cfg80211_ops mac80211_config_ops = {
3547 .change_mpath = ieee80211_change_mpath, 3598 .change_mpath = ieee80211_change_mpath,
3548 .get_mpath = ieee80211_get_mpath, 3599 .get_mpath = ieee80211_get_mpath,
3549 .dump_mpath = ieee80211_dump_mpath, 3600 .dump_mpath = ieee80211_dump_mpath,
3601 .get_mpp = ieee80211_get_mpp,
3602 .dump_mpp = ieee80211_dump_mpp,
3550 .update_mesh_config = ieee80211_update_mesh_config, 3603 .update_mesh_config = ieee80211_update_mesh_config,
3551 .get_mesh_config = ieee80211_get_mesh_config, 3604 .get_mesh_config = ieee80211_get_mesh_config,
3552 .join_mesh = ieee80211_join_mesh, 3605 .join_mesh = ieee80211_join_mesh,