diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-10-07 07:10:30 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-07 14:41:27 -0400 |
commit | 43b19952de54b0fccfcdc5968891ebe550367fe8 (patch) | |
tree | 2657f6820dfbaaaab1aa3dc4af48ecbeef363a89 /net/wireless | |
parent | 7b99a7c2dab7efe7c265b66fedbf3444958ebfe3 (diff) |
nl80211: use new genl helpers for WDS
Bill Jordan's patch to allow setting the WDS
peer crossed with my patch removing all the
boilerplate code in nl80211, and consequently
he didn't make use of it yet. Fix that.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/nl80211.c | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 524f55402838..4fed1663aba3 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -876,48 +876,25 @@ static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) | |||
876 | 876 | ||
877 | static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info) | 877 | static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info) |
878 | { | 878 | { |
879 | struct cfg80211_registered_device *rdev; | 879 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
880 | struct wireless_dev *wdev; | 880 | struct net_device *dev = info->user_ptr[1]; |
881 | struct net_device *dev; | 881 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
882 | u8 *bssid; | 882 | u8 *bssid; |
883 | int err; | ||
884 | 883 | ||
885 | if (!info->attrs[NL80211_ATTR_MAC]) | 884 | if (!info->attrs[NL80211_ATTR_MAC]) |
886 | return -EINVAL; | 885 | return -EINVAL; |
887 | 886 | ||
888 | rtnl_lock(); | 887 | if (netif_running(dev)) |
889 | 888 | return -EBUSY; | |
890 | err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); | ||
891 | if (err) | ||
892 | goto unlock_rtnl; | ||
893 | |||
894 | wdev = dev->ieee80211_ptr; | ||
895 | |||
896 | if (netif_running(dev)) { | ||
897 | err = -EBUSY; | ||
898 | goto out; | ||
899 | } | ||
900 | 889 | ||
901 | if (!rdev->ops->set_wds_peer) { | 890 | if (!rdev->ops->set_wds_peer) |
902 | err = -EOPNOTSUPP; | 891 | return -EOPNOTSUPP; |
903 | goto out; | ||
904 | } | ||
905 | 892 | ||
906 | if (wdev->iftype != NL80211_IFTYPE_WDS) { | 893 | if (wdev->iftype != NL80211_IFTYPE_WDS) |
907 | err = -EOPNOTSUPP; | 894 | return -EOPNOTSUPP; |
908 | goto out; | ||
909 | } | ||
910 | 895 | ||
911 | bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); | 896 | bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); |
912 | err = rdev->ops->set_wds_peer(wdev->wiphy, dev, bssid); | 897 | return rdev->ops->set_wds_peer(wdev->wiphy, dev, bssid); |
913 | |||
914 | out: | ||
915 | cfg80211_unlock_rdev(rdev); | ||
916 | dev_put(dev); | ||
917 | unlock_rtnl: | ||
918 | rtnl_unlock(); | ||
919 | |||
920 | return err; | ||
921 | } | 898 | } |
922 | 899 | ||
923 | 900 | ||
@@ -4860,6 +4837,8 @@ static struct genl_ops nl80211_ops[] = { | |||
4860 | .doit = nl80211_set_wds_peer, | 4837 | .doit = nl80211_set_wds_peer, |
4861 | .policy = nl80211_policy, | 4838 | .policy = nl80211_policy, |
4862 | .flags = GENL_ADMIN_PERM, | 4839 | .flags = GENL_ADMIN_PERM, |
4840 | .internal_flags = NL80211_FLAG_NEED_NETDEV | | ||
4841 | NL80211_FLAG_NEED_RTNL, | ||
4863 | }, | 4842 | }, |
4864 | }; | 4843 | }; |
4865 | 4844 | ||