diff options
author | David Spinadel <david.spinadel@intel.com> | 2013-07-31 11:04:15 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-08-12 08:11:37 -0400 |
commit | fc73f11f5fa230f8c687d51b0fddb00433092ce0 (patch) | |
tree | f1c2e5c855a97dd4039b3df2a0b8cde96744898f /net/wireless/nl80211.c | |
parent | af61a165187bb94b1dc7628ef815c23d0eacf40b (diff) |
cfg80211: add wdev to testmode cmd
To allow drivers to implement per-interface testmode operations
more easily, pass a wdev pointer if any identification for one
was given from userspace. Clean up the code a bit while at it.
Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c2a40a2e56bd..334697de5cc0 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -6591,19 +6591,30 @@ static struct genl_multicast_group nl80211_testmode_mcgrp = { | |||
6591 | static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) | 6591 | static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) |
6592 | { | 6592 | { |
6593 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 6593 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
6594 | struct wireless_dev *wdev = | ||
6595 | __cfg80211_wdev_from_attrs(genl_info_net(info), info->attrs); | ||
6594 | int err; | 6596 | int err; |
6595 | 6597 | ||
6598 | if (!rdev->ops->testmode_cmd) | ||
6599 | return -EOPNOTSUPP; | ||
6600 | |||
6601 | if (IS_ERR(wdev)) { | ||
6602 | err = PTR_ERR(wdev); | ||
6603 | if (err != -EINVAL) | ||
6604 | return err; | ||
6605 | wdev = NULL; | ||
6606 | } else if (wdev->wiphy != &rdev->wiphy) { | ||
6607 | return -EINVAL; | ||
6608 | } | ||
6609 | |||
6596 | if (!info->attrs[NL80211_ATTR_TESTDATA]) | 6610 | if (!info->attrs[NL80211_ATTR_TESTDATA]) |
6597 | return -EINVAL; | 6611 | return -EINVAL; |
6598 | 6612 | ||
6599 | err = -EOPNOTSUPP; | 6613 | rdev->testmode_info = info; |
6600 | if (rdev->ops->testmode_cmd) { | 6614 | err = rdev_testmode_cmd(rdev, wdev, |
6601 | rdev->testmode_info = info; | ||
6602 | err = rdev_testmode_cmd(rdev, | ||
6603 | nla_data(info->attrs[NL80211_ATTR_TESTDATA]), | 6615 | nla_data(info->attrs[NL80211_ATTR_TESTDATA]), |
6604 | nla_len(info->attrs[NL80211_ATTR_TESTDATA])); | 6616 | nla_len(info->attrs[NL80211_ATTR_TESTDATA])); |
6605 | rdev->testmode_info = NULL; | 6617 | rdev->testmode_info = NULL; |
6606 | } | ||
6607 | 6618 | ||
6608 | return err; | 6619 | return err; |
6609 | } | 6620 | } |