From: Antonio Quartulli <antonio@xxxxxxxxxxxxx> Implement and export the new cfg80211_get_station() API. This utility can be used by other kernel modules to obtain detailed information about a given wireless station. It will be in particular useful to batman-adv which will implement a wireless rate based metric. Signed-off-by: Antonio Quartulli <antonio@xxxxxxxxxxxxx> --- include/net/cfg80211.h | 11 +++++++++++ net/wireless/nl80211.c | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 51d5d94..8c4b6ee 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1067,6 +1067,17 @@ struct station_info { }; /** + * cfg80211_get_station - retrieve information about a given station + * @dev: the device where the station is supposed to be connected to + * @mac_addr: the mac address of the station of interest + * @sinfo: pointer to the structure to fill with the information + * + * Returns 0 on success or a negative error code otherwise. + */ +int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, + struct station_info *sinfo); + +/** * enum monitor_flags - monitor flags * * Monitor interface configuration flags. Note that these must be the bits diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 6e78c62..acba667 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3780,6 +3780,28 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) return genlmsg_reply(msg, info); } +int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, + struct station_info *sinfo) +{ + struct cfg80211_registered_device *rdev; + struct wireless_dev *wdev; + int err; + + wdev = dev->ieee80211_ptr; + if (!wdev) + return -EOPNOTSUPP; + + rdev = wiphy_to_dev(wdev->wiphy); + if (!rdev->ops->get_station) + return -EOPNOTSUPP; + + err = rdev_get_station(rdev, dev, mac_addr, sinfo); + if (err) + return err; + + return 0; +} + int cfg80211_check_station_change(struct wiphy *wiphy, struct station_parameters *params, enum cfg80211_station_type statype) -- 1.8.5.3 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html