aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c64
1 files changed, 4 insertions, 60 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e2574885db4a..855126a3039d 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -82,7 +82,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
82 enum nl80211_iftype type, u32 *flags, 82 enum nl80211_iftype type, u32 *flags,
83 struct vif_params *params) 83 struct vif_params *params)
84{ 84{
85 struct ieee80211_local *local = wiphy_priv(wiphy);
86 struct net_device *dev; 85 struct net_device *dev;
87 struct ieee80211_sub_if_data *sdata; 86 struct ieee80211_sub_if_data *sdata;
88 int ret; 87 int ret;
@@ -95,15 +94,15 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
95 if (!nl80211_type_check(type)) 94 if (!nl80211_type_check(type))
96 return -EINVAL; 95 return -EINVAL;
97 96
98 if (dev == local->mdev)
99 return -EOPNOTSUPP;
100
101 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 97 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
102 98
103 ret = ieee80211_if_change_type(sdata, type); 99 ret = ieee80211_if_change_type(sdata, type);
104 if (ret) 100 if (ret)
105 return ret; 101 return ret;
106 102
103 if (netif_running(sdata->dev))
104 return -EBUSY;
105
107 if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) 106 if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
108 ieee80211_sdata_set_mesh_id(sdata, 107 ieee80211_sdata_set_mesh_id(sdata,
109 params->mesh_id_len, 108 params->mesh_id_len,
@@ -120,16 +119,12 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
120 u8 key_idx, u8 *mac_addr, 119 u8 key_idx, u8 *mac_addr,
121 struct key_params *params) 120 struct key_params *params)
122{ 121{
123 struct ieee80211_local *local = wiphy_priv(wiphy);
124 struct ieee80211_sub_if_data *sdata; 122 struct ieee80211_sub_if_data *sdata;
125 struct sta_info *sta = NULL; 123 struct sta_info *sta = NULL;
126 enum ieee80211_key_alg alg; 124 enum ieee80211_key_alg alg;
127 struct ieee80211_key *key; 125 struct ieee80211_key *key;
128 int err; 126 int err;
129 127
130 if (dev == local->mdev)
131 return -EOPNOTSUPP;
132
133 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 128 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
134 129
135 switch (params->cipher) { 130 switch (params->cipher) {
@@ -174,14 +169,10 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
174static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, 169static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
175 u8 key_idx, u8 *mac_addr) 170 u8 key_idx, u8 *mac_addr)
176{ 171{
177 struct ieee80211_local *local = wiphy_priv(wiphy);
178 struct ieee80211_sub_if_data *sdata; 172 struct ieee80211_sub_if_data *sdata;
179 struct sta_info *sta; 173 struct sta_info *sta;
180 int ret; 174 int ret;
181 175
182 if (dev == local->mdev)
183 return -EOPNOTSUPP;
184
185 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 176 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
186 177
187 rcu_read_lock(); 178 rcu_read_lock();
@@ -222,7 +213,6 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
222 void (*callback)(void *cookie, 213 void (*callback)(void *cookie,
223 struct key_params *params)) 214 struct key_params *params))
224{ 215{
225 struct ieee80211_local *local = wiphy_priv(wiphy);
226 struct ieee80211_sub_if_data *sdata; 216 struct ieee80211_sub_if_data *sdata;
227 struct sta_info *sta = NULL; 217 struct sta_info *sta = NULL;
228 u8 seq[6] = {0}; 218 u8 seq[6] = {0};
@@ -232,9 +222,6 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
232 u16 iv16; 222 u16 iv16;
233 int err = -ENOENT; 223 int err = -ENOENT;
234 224
235 if (dev == local->mdev)
236 return -EOPNOTSUPP;
237
238 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 225 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
239 226
240 rcu_read_lock(); 227 rcu_read_lock();
@@ -310,12 +297,8 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
310 struct net_device *dev, 297 struct net_device *dev,
311 u8 key_idx) 298 u8 key_idx)
312{ 299{
313 struct ieee80211_local *local = wiphy_priv(wiphy);
314 struct ieee80211_sub_if_data *sdata; 300 struct ieee80211_sub_if_data *sdata;
315 301
316 if (dev == local->mdev)
317 return -EOPNOTSUPP;
318
319 rcu_read_lock(); 302 rcu_read_lock();
320 303
321 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 304 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -496,13 +479,9 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
496static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, 479static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
497 struct beacon_parameters *params) 480 struct beacon_parameters *params)
498{ 481{
499 struct ieee80211_local *local = wiphy_priv(wiphy);
500 struct ieee80211_sub_if_data *sdata; 482 struct ieee80211_sub_if_data *sdata;
501 struct beacon_data *old; 483 struct beacon_data *old;
502 484
503 if (dev == local->mdev)
504 return -EOPNOTSUPP;
505
506 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 485 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
507 486
508 if (sdata->vif.type != NL80211_IFTYPE_AP) 487 if (sdata->vif.type != NL80211_IFTYPE_AP)
@@ -519,13 +498,9 @@ static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
519static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, 498static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
520 struct beacon_parameters *params) 499 struct beacon_parameters *params)
521{ 500{
522 struct ieee80211_local *local = wiphy_priv(wiphy);
523 struct ieee80211_sub_if_data *sdata; 501 struct ieee80211_sub_if_data *sdata;
524 struct beacon_data *old; 502 struct beacon_data *old;
525 503
526 if (dev == local->mdev)
527 return -EOPNOTSUPP;
528
529 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 504 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
530 505
531 if (sdata->vif.type != NL80211_IFTYPE_AP) 506 if (sdata->vif.type != NL80211_IFTYPE_AP)
@@ -541,13 +516,9 @@ static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
541 516
542static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) 517static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
543{ 518{
544 struct ieee80211_local *local = wiphy_priv(wiphy);
545 struct ieee80211_sub_if_data *sdata; 519 struct ieee80211_sub_if_data *sdata;
546 struct beacon_data *old; 520 struct beacon_data *old;
547 521
548 if (dev == local->mdev)
549 return -EOPNOTSUPP;
550
551 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 522 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
552 523
553 if (sdata->vif.type != NL80211_IFTYPE_AP) 524 if (sdata->vif.type != NL80211_IFTYPE_AP)
@@ -695,9 +666,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
695 struct ieee80211_sub_if_data *sdata; 666 struct ieee80211_sub_if_data *sdata;
696 int err; 667 int err;
697 668
698 if (dev == local->mdev || params->vlan == local->mdev)
699 return -EOPNOTSUPP;
700
701 /* Prevent a race with changing the rate control algorithm */ 669 /* Prevent a race with changing the rate control algorithm */
702 if (!netif_running(dev)) 670 if (!netif_running(dev))
703 return -ENETDOWN; 671 return -ENETDOWN;
@@ -725,7 +693,7 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
725 693
726 sta_apply_parameters(local, sta, params); 694 sta_apply_parameters(local, sta, params);
727 695
728 rate_control_rate_init(sta, local); 696 rate_control_rate_init(sta);
729 697
730 rcu_read_lock(); 698 rcu_read_lock();
731 699
@@ -752,9 +720,6 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
752 struct ieee80211_sub_if_data *sdata; 720 struct ieee80211_sub_if_data *sdata;
753 struct sta_info *sta; 721 struct sta_info *sta;
754 722
755 if (dev == local->mdev)
756 return -EOPNOTSUPP;
757
758 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 723 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
759 724
760 if (mac) { 725 if (mac) {
@@ -786,9 +751,6 @@ static int ieee80211_change_station(struct wiphy *wiphy,
786 struct sta_info *sta; 751 struct sta_info *sta;
787 struct ieee80211_sub_if_data *vlansdata; 752 struct ieee80211_sub_if_data *vlansdata;
788 753
789 if (dev == local->mdev || params->vlan == local->mdev)
790 return -EOPNOTSUPP;
791
792 rcu_read_lock(); 754 rcu_read_lock();
793 755
794 /* XXX: get sta belonging to dev */ 756 /* XXX: get sta belonging to dev */
@@ -828,9 +790,6 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
828 struct sta_info *sta; 790 struct sta_info *sta;
829 int err; 791 int err;
830 792
831 if (dev == local->mdev)
832 return -EOPNOTSUPP;
833
834 if (!netif_running(dev)) 793 if (!netif_running(dev))
835 return -ENETDOWN; 794 return -ENETDOWN;
836 795
@@ -884,9 +843,6 @@ static int ieee80211_change_mpath(struct wiphy *wiphy,
884 struct mesh_path *mpath; 843 struct mesh_path *mpath;
885 struct sta_info *sta; 844 struct sta_info *sta;
886 845
887 if (dev == local->mdev)
888 return -EOPNOTSUPP;
889
890 if (!netif_running(dev)) 846 if (!netif_running(dev))
891 return -ENETDOWN; 847 return -ENETDOWN;
892 848
@@ -958,13 +914,9 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
958 u8 *dst, u8 *next_hop, struct mpath_info *pinfo) 914 u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
959 915
960{ 916{
961 struct ieee80211_local *local = wiphy_priv(wiphy);
962 struct ieee80211_sub_if_data *sdata; 917 struct ieee80211_sub_if_data *sdata;
963 struct mesh_path *mpath; 918 struct mesh_path *mpath;
964 919
965 if (dev == local->mdev)
966 return -EOPNOTSUPP;
967
968 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 920 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
969 921
970 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) 922 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
@@ -986,13 +938,9 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
986 int idx, u8 *dst, u8 *next_hop, 938 int idx, u8 *dst, u8 *next_hop,
987 struct mpath_info *pinfo) 939 struct mpath_info *pinfo)
988{ 940{
989 struct ieee80211_local *local = wiphy_priv(wiphy);
990 struct ieee80211_sub_if_data *sdata; 941 struct ieee80211_sub_if_data *sdata;
991 struct mesh_path *mpath; 942 struct mesh_path *mpath;
992 943
993 if (dev == local->mdev)
994 return -EOPNOTSUPP;
995
996 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 944 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
997 945
998 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) 946 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
@@ -1015,13 +963,9 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
1015 struct net_device *dev, 963 struct net_device *dev,
1016 struct bss_parameters *params) 964 struct bss_parameters *params)
1017{ 965{
1018 struct ieee80211_local *local = wiphy_priv(wiphy);
1019 struct ieee80211_sub_if_data *sdata; 966 struct ieee80211_sub_if_data *sdata;
1020 u32 changed = 0; 967 u32 changed = 0;
1021 968
1022 if (dev == local->mdev)
1023 return -EOPNOTSUPP;
1024
1025 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 969 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1026 970
1027 if (sdata->vif.type != NL80211_IFTYPE_AP) 971 if (sdata->vif.type != NL80211_IFTYPE_AP)