aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-27 06:35:57 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-27 13:53:31 -0400
commit87490f6db38999fee7f6d3dbecc5b94730c7e010 (patch)
treed32a07b51aaa9349f779af63901eec8fa267ac8c /net
parentbf533e0bfd77d9671adabdf134b1ac7f24bb0670 (diff)
mac80211: split out concurrent vif checks
Split the concurrent virtual interface checks into a new function that can be used to check for any given new interface type. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/iface.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index ea50732ec52..cba3d806d72 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -94,20 +94,14 @@ static inline int identical_mac_addr_allowed(int type1, int type2)
94 type2 == NL80211_IFTYPE_AP_VLAN)); 94 type2 == NL80211_IFTYPE_AP_VLAN));
95} 95}
96 96
97static int ieee80211_open(struct net_device *dev) 97static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata,
98 enum nl80211_iftype iftype)
98{ 99{
99 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
100 struct ieee80211_sub_if_data *nsdata;
101 struct ieee80211_local *local = sdata->local; 100 struct ieee80211_local *local = sdata->local;
102 struct sta_info *sta; 101 struct ieee80211_sub_if_data *nsdata;
103 u32 changed = 0; 102 struct net_device *dev = sdata->dev;
104 int res;
105 u32 hw_reconf_flags = 0;
106 103
107 /* fail early if user set an invalid address */ 104 ASSERT_RTNL();
108 if (!is_zero_ether_addr(dev->dev_addr) &&
109 !is_valid_ether_addr(dev->dev_addr))
110 return -EADDRNOTAVAIL;
111 105
112 /* we hold the RTNL here so can safely walk the list */ 106 /* we hold the RTNL here so can safely walk the list */
113 list_for_each_entry(nsdata, &local->interfaces, list) { 107 list_for_each_entry(nsdata, &local->interfaces, list) {
@@ -124,7 +118,7 @@ static int ieee80211_open(struct net_device *dev)
124 * belonging to the same hardware. Then, however, we're 118 * belonging to the same hardware. Then, however, we're
125 * faced with having to adopt two different TSF timers... 119 * faced with having to adopt two different TSF timers...
126 */ 120 */
127 if (sdata->vif.type == NL80211_IFTYPE_ADHOC && 121 if (iftype == NL80211_IFTYPE_ADHOC &&
128 nsdata->vif.type == NL80211_IFTYPE_ADHOC) 122 nsdata->vif.type == NL80211_IFTYPE_ADHOC)
129 return -EBUSY; 123 return -EBUSY;
130 124
@@ -138,19 +132,40 @@ static int ieee80211_open(struct net_device *dev)
138 /* 132 /*
139 * check whether it may have the same address 133 * check whether it may have the same address
140 */ 134 */
141 if (!identical_mac_addr_allowed(sdata->vif.type, 135 if (!identical_mac_addr_allowed(iftype,
142 nsdata->vif.type)) 136 nsdata->vif.type))
143 return -ENOTUNIQ; 137 return -ENOTUNIQ;
144 138
145 /* 139 /*
146 * can only add VLANs to enabled APs 140 * can only add VLANs to enabled APs
147 */ 141 */
148 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && 142 if (iftype == NL80211_IFTYPE_AP_VLAN &&
149 nsdata->vif.type == NL80211_IFTYPE_AP) 143 nsdata->vif.type == NL80211_IFTYPE_AP)
150 sdata->bss = &nsdata->u.ap; 144 sdata->bss = &nsdata->u.ap;
151 } 145 }
152 } 146 }
153 147
148 return 0;
149}
150
151static int ieee80211_open(struct net_device *dev)
152{
153 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
154 struct ieee80211_local *local = sdata->local;
155 struct sta_info *sta;
156 u32 changed = 0;
157 int res;
158 u32 hw_reconf_flags = 0;
159
160 /* fail early if user set an invalid address */
161 if (!is_zero_ether_addr(dev->dev_addr) &&
162 !is_valid_ether_addr(dev->dev_addr))
163 return -EADDRNOTAVAIL;
164
165 res = ieee80211_check_concurrent_iface(sdata, sdata->vif.type);
166 if (res)
167 return res;
168
154 switch (sdata->vif.type) { 169 switch (sdata->vif.type) {
155 case NL80211_IFTYPE_WDS: 170 case NL80211_IFTYPE_WDS:
156 if (!is_valid_ether_addr(sdata->u.wds.remote_addr)) 171 if (!is_valid_ether_addr(sdata->u.wds.remote_addr))