aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-09-16 08:18:59 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-24 16:18:00 -0400
commit133b822638ff01eb1e32e1917b197c40ed095ddd (patch)
tree8b96f00426728f3c05ba05f387240f0279512a75 /net/mac80211/cfg.c
parent9e5e6c327defcef19dabad64335ee68bb55b2355 (diff)
mac80211: make master iface not wireless
There's no need to register the master netdev with cfg80211, in fact, this is quite dangerous and lead to having to add checks for the master interface all over the config handlers. This patch removes the "ieee80211_ptr" from the master iface in favour of having a small netdev_priv() associated with the master interface that stores the ieee80211_local pointer. Because of this, a lot of code in the configuration handlers can go away. To make this patch easier to verify I have also removed a number of wiphy_priv() calls in favour of getting the sdata first and then the local pointer from that. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e2574885db4a..a8501f14b167 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,9 +94,6 @@ 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);
@@ -120,16 +116,12 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
120 u8 key_idx, u8 *mac_addr, 116 u8 key_idx, u8 *mac_addr,
121 struct key_params *params) 117 struct key_params *params)
122{ 118{
123 struct ieee80211_local *local = wiphy_priv(wiphy);
124 struct ieee80211_sub_if_data *sdata; 119 struct ieee80211_sub_if_data *sdata;
125 struct sta_info *sta = NULL; 120 struct sta_info *sta = NULL;
126 enum ieee80211_key_alg alg; 121 enum ieee80211_key_alg alg;
127 struct ieee80211_key *key; 122 struct ieee80211_key *key;
128 int err; 123 int err;
129 124
130 if (dev == local->mdev)
131 return -EOPNOTSUPP;
132
133 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 125 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
134 126
135 switch (params->cipher) { 127 switch (params->cipher) {
@@ -174,14 +166,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, 166static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
175 u8 key_idx, u8 *mac_addr) 167 u8 key_idx, u8 *mac_addr)
176{ 168{
177 struct ieee80211_local *local = wiphy_priv(wiphy);
178 struct ieee80211_sub_if_data *sdata; 169 struct ieee80211_sub_if_data *sdata;
179 struct sta_info *sta; 170 struct sta_info *sta;
180 int ret; 171 int ret;
181 172
182 if (dev == local->mdev)
183 return -EOPNOTSUPP;
184
185 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 173 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
186 174
187 rcu_read_lock(); 175 rcu_read_lock();
@@ -222,7 +210,6 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
222 void (*callback)(void *cookie, 210 void (*callback)(void *cookie,
223 struct key_params *params)) 211 struct key_params *params))
224{ 212{
225 struct ieee80211_local *local = wiphy_priv(wiphy);
226 struct ieee80211_sub_if_data *sdata; 213 struct ieee80211_sub_if_data *sdata;
227 struct sta_info *sta = NULL; 214 struct sta_info *sta = NULL;
228 u8 seq[6] = {0}; 215 u8 seq[6] = {0};
@@ -232,9 +219,6 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
232 u16 iv16; 219 u16 iv16;
233 int err = -ENOENT; 220 int err = -ENOENT;
234 221
235 if (dev == local->mdev)
236 return -EOPNOTSUPP;
237
238 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 222 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
239 223
240 rcu_read_lock(); 224 rcu_read_lock();
@@ -310,12 +294,8 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
310 struct net_device *dev, 294 struct net_device *dev,
311 u8 key_idx) 295 u8 key_idx)
312{ 296{
313 struct ieee80211_local *local = wiphy_priv(wiphy);
314 struct ieee80211_sub_if_data *sdata; 297 struct ieee80211_sub_if_data *sdata;
315 298
316 if (dev == local->mdev)
317 return -EOPNOTSUPP;
318
319 rcu_read_lock(); 299 rcu_read_lock();
320 300
321 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 301 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -496,13 +476,9 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
496static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, 476static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
497 struct beacon_parameters *params) 477 struct beacon_parameters *params)
498{ 478{
499 struct ieee80211_local *local = wiphy_priv(wiphy);
500 struct ieee80211_sub_if_data *sdata; 479 struct ieee80211_sub_if_data *sdata;
501 struct beacon_data *old; 480 struct beacon_data *old;
502 481
503 if (dev == local->mdev)
504 return -EOPNOTSUPP;
505
506 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 482 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
507 483
508 if (sdata->vif.type != NL80211_IFTYPE_AP) 484 if (sdata->vif.type != NL80211_IFTYPE_AP)
@@ -519,13 +495,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, 495static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
520 struct beacon_parameters *params) 496 struct beacon_parameters *params)
521{ 497{
522 struct ieee80211_local *local = wiphy_priv(wiphy);
523 struct ieee80211_sub_if_data *sdata; 498 struct ieee80211_sub_if_data *sdata;
524 struct beacon_data *old; 499 struct beacon_data *old;
525 500
526 if (dev == local->mdev)
527 return -EOPNOTSUPP;
528
529 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 501 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
530 502
531 if (sdata->vif.type != NL80211_IFTYPE_AP) 503 if (sdata->vif.type != NL80211_IFTYPE_AP)
@@ -541,13 +513,9 @@ static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
541 513
542static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) 514static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
543{ 515{
544 struct ieee80211_local *local = wiphy_priv(wiphy);
545 struct ieee80211_sub_if_data *sdata; 516 struct ieee80211_sub_if_data *sdata;
546 struct beacon_data *old; 517 struct beacon_data *old;
547 518
548 if (dev == local->mdev)
549 return -EOPNOTSUPP;
550
551 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 519 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
552 520
553 if (sdata->vif.type != NL80211_IFTYPE_AP) 521 if (sdata->vif.type != NL80211_IFTYPE_AP)
@@ -695,9 +663,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
695 struct ieee80211_sub_if_data *sdata; 663 struct ieee80211_sub_if_data *sdata;
696 int err; 664 int err;
697 665
698 if (dev == local->mdev || params->vlan == local->mdev)
699 return -EOPNOTSUPP;
700
701 /* Prevent a race with changing the rate control algorithm */ 666 /* Prevent a race with changing the rate control algorithm */
702 if (!netif_running(dev)) 667 if (!netif_running(dev))
703 return -ENETDOWN; 668 return -ENETDOWN;
@@ -752,9 +717,6 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
752 struct ieee80211_sub_if_data *sdata; 717 struct ieee80211_sub_if_data *sdata;
753 struct sta_info *sta; 718 struct sta_info *sta;
754 719
755 if (dev == local->mdev)
756 return -EOPNOTSUPP;
757
758 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 720 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
759 721
760 if (mac) { 722 if (mac) {
@@ -786,9 +748,6 @@ static int ieee80211_change_station(struct wiphy *wiphy,
786 struct sta_info *sta; 748 struct sta_info *sta;
787 struct ieee80211_sub_if_data *vlansdata; 749 struct ieee80211_sub_if_data *vlansdata;
788 750
789 if (dev == local->mdev || params->vlan == local->mdev)
790 return -EOPNOTSUPP;
791
792 rcu_read_lock(); 751 rcu_read_lock();
793 752
794 /* XXX: get sta belonging to dev */ 753 /* XXX: get sta belonging to dev */
@@ -828,9 +787,6 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
828 struct sta_info *sta; 787 struct sta_info *sta;
829 int err; 788 int err;
830 789
831 if (dev == local->mdev)
832 return -EOPNOTSUPP;
833
834 if (!netif_running(dev)) 790 if (!netif_running(dev))
835 return -ENETDOWN; 791 return -ENETDOWN;
836 792
@@ -884,9 +840,6 @@ static int ieee80211_change_mpath(struct wiphy *wiphy,
884 struct mesh_path *mpath; 840 struct mesh_path *mpath;
885 struct sta_info *sta; 841 struct sta_info *sta;
886 842
887 if (dev == local->mdev)
888 return -EOPNOTSUPP;
889
890 if (!netif_running(dev)) 843 if (!netif_running(dev))
891 return -ENETDOWN; 844 return -ENETDOWN;
892 845
@@ -958,13 +911,9 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
958 u8 *dst, u8 *next_hop, struct mpath_info *pinfo) 911 u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
959 912
960{ 913{
961 struct ieee80211_local *local = wiphy_priv(wiphy);
962 struct ieee80211_sub_if_data *sdata; 914 struct ieee80211_sub_if_data *sdata;
963 struct mesh_path *mpath; 915 struct mesh_path *mpath;
964 916
965 if (dev == local->mdev)
966 return -EOPNOTSUPP;
967
968 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 917 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
969 918
970 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) 919 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
@@ -986,13 +935,9 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
986 int idx, u8 *dst, u8 *next_hop, 935 int idx, u8 *dst, u8 *next_hop,
987 struct mpath_info *pinfo) 936 struct mpath_info *pinfo)
988{ 937{
989 struct ieee80211_local *local = wiphy_priv(wiphy);
990 struct ieee80211_sub_if_data *sdata; 938 struct ieee80211_sub_if_data *sdata;
991 struct mesh_path *mpath; 939 struct mesh_path *mpath;
992 940
993 if (dev == local->mdev)
994 return -EOPNOTSUPP;
995
996 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 941 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
997 942
998 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT) 943 if (sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
@@ -1015,13 +960,9 @@ static int ieee80211_change_bss(struct wiphy *wiphy,
1015 struct net_device *dev, 960 struct net_device *dev,
1016 struct bss_parameters *params) 961 struct bss_parameters *params)
1017{ 962{
1018 struct ieee80211_local *local = wiphy_priv(wiphy);
1019 struct ieee80211_sub_if_data *sdata; 963 struct ieee80211_sub_if_data *sdata;
1020 u32 changed = 0; 964 u32 changed = 0;
1021 965
1022 if (dev == local->mdev)
1023 return -EOPNOTSUPP;
1024
1025 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 966 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1026 967
1027 if (sdata->vif.type != NL80211_IFTYPE_AP) 968 if (sdata->vif.type != NL80211_IFTYPE_AP)