aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wext.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r--net/mac80211/wext.c63
1 files changed, 24 insertions, 39 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c
index 896704cf94e1..eb63fc148019 100644
--- a/net/mac80211/wext.c
+++ b/net/mac80211/wext.c
@@ -149,17 +149,14 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
149 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 149 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
150 150
151 if (sdata->vif.type == NL80211_IFTYPE_ADHOC) 151 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
152 sdata->u.ibss.flags &= ~IEEE80211_IBSS_AUTO_CHANNEL_SEL; 152 return cfg80211_ibss_wext_siwfreq(dev, info, freq, extra);
153 else if (sdata->vif.type == NL80211_IFTYPE_STATION) 153 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
154 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; 154 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
155 155
156 /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ 156 /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
157 if (freq->e == 0) { 157 if (freq->e == 0) {
158 if (freq->m < 0) { 158 if (freq->m < 0) {
159 if (sdata->vif.type == NL80211_IFTYPE_ADHOC) 159 if (sdata->vif.type == NL80211_IFTYPE_STATION)
160 sdata->u.ibss.flags |=
161 IEEE80211_IBSS_AUTO_CHANNEL_SEL;
162 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
163 sdata->u.mgd.flags |= 160 sdata->u.mgd.flags |=
164 IEEE80211_STA_AUTO_CHANNEL_SEL; 161 IEEE80211_STA_AUTO_CHANNEL_SEL;
165 return 0; 162 return 0;
@@ -183,6 +180,10 @@ static int ieee80211_ioctl_giwfreq(struct net_device *dev,
183 struct iw_freq *freq, char *extra) 180 struct iw_freq *freq, char *extra)
184{ 181{
185 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 182 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
183 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
184
185 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
186 return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
186 187
187 freq->m = local->hw.conf.channel->center_freq; 188 freq->m = local->hw.conf.channel->center_freq;
188 freq->e = 6; 189 freq->e = 6;
@@ -195,15 +196,17 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
195 struct iw_request_info *info, 196 struct iw_request_info *info,
196 struct iw_point *data, char *ssid) 197 struct iw_point *data, char *ssid)
197{ 198{
198 struct ieee80211_sub_if_data *sdata; 199 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
199 size_t len = data->length; 200 size_t len = data->length;
200 int ret; 201 int ret;
201 202
203 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
204 return cfg80211_ibss_wext_siwessid(dev, info, data, ssid);
205
202 /* iwconfig uses nul termination in SSID.. */ 206 /* iwconfig uses nul termination in SSID.. */
203 if (len > 0 && ssid[len - 1] == '\0') 207 if (len > 0 && ssid[len - 1] == '\0')
204 len--; 208 len--;
205 209
206 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
207 if (sdata->vif.type == NL80211_IFTYPE_STATION) { 210 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
208 if (data->flags) 211 if (data->flags)
209 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; 212 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
@@ -217,8 +220,7 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
217 sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; 220 sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME;
218 ieee80211_sta_req_auth(sdata); 221 ieee80211_sta_req_auth(sdata);
219 return 0; 222 return 0;
220 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) 223 }
221 return ieee80211_ibss_set_ssid(sdata, ssid, len);
222 224
223 return -EOPNOTSUPP; 225 return -EOPNOTSUPP;
224} 226}
@@ -229,9 +231,13 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev,
229 struct iw_point *data, char *ssid) 231 struct iw_point *data, char *ssid)
230{ 232{
231 size_t len; 233 size_t len;
232
233 struct ieee80211_sub_if_data *sdata; 234 struct ieee80211_sub_if_data *sdata;
235
234 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 236 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
237
238 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
239 return cfg80211_ibss_wext_giwessid(dev, info, data, ssid);
240
235 if (sdata->vif.type == NL80211_IFTYPE_STATION) { 241 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
236 int res = ieee80211_sta_get_ssid(sdata, ssid, &len); 242 int res = ieee80211_sta_get_ssid(sdata, ssid, &len);
237 if (res == 0) { 243 if (res == 0) {
@@ -240,14 +246,6 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev,
240 } else 246 } else
241 data->flags = 0; 247 data->flags = 0;
242 return res; 248 return res;
243 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
244 int res = ieee80211_ibss_get_ssid(sdata, ssid, &len);
245 if (res == 0) {
246 data->length = len;
247 data->flags = 1;
248 } else
249 data->flags = 0;
250 return res;
251 } 249 }
252 250
253 return -EOPNOTSUPP; 251 return -EOPNOTSUPP;
@@ -258,9 +256,11 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
258 struct iw_request_info *info, 256 struct iw_request_info *info,
259 struct sockaddr *ap_addr, char *extra) 257 struct sockaddr *ap_addr, char *extra)
260{ 258{
261 struct ieee80211_sub_if_data *sdata; 259 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
260
261 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
262 return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
262 263
263 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
264 if (sdata->vif.type == NL80211_IFTYPE_STATION) { 264 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
265 int ret; 265 int ret;
266 266
@@ -277,16 +277,6 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
277 sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; 277 sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME;
278 ieee80211_sta_req_auth(sdata); 278 ieee80211_sta_req_auth(sdata);
279 return 0; 279 return 0;
280 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
281 if (is_zero_ether_addr((u8 *) &ap_addr->sa_data))
282 sdata->u.ibss.flags |= IEEE80211_IBSS_AUTO_BSSID_SEL |
283 IEEE80211_IBSS_AUTO_CHANNEL_SEL;
284 else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
285 sdata->u.ibss.flags |= IEEE80211_IBSS_AUTO_BSSID_SEL;
286 else
287 sdata->u.ibss.flags &= ~IEEE80211_IBSS_AUTO_BSSID_SEL;
288
289 return ieee80211_ibss_set_bssid(sdata, (u8 *) &ap_addr->sa_data);
290 } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { 280 } else if (sdata->vif.type == NL80211_IFTYPE_WDS) {
291 /* 281 /*
292 * If it is necessary to update the WDS peer address 282 * If it is necessary to update the WDS peer address
@@ -312,9 +302,11 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
312 struct iw_request_info *info, 302 struct iw_request_info *info,
313 struct sockaddr *ap_addr, char *extra) 303 struct sockaddr *ap_addr, char *extra)
314{ 304{
315 struct ieee80211_sub_if_data *sdata; 305 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
306
307 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
308 return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
316 309
317 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
318 if (sdata->vif.type == NL80211_IFTYPE_STATION) { 310 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
319 if (sdata->u.mgd.state == IEEE80211_STA_MLME_ASSOCIATED) { 311 if (sdata->u.mgd.state == IEEE80211_STA_MLME_ASSOCIATED) {
320 ap_addr->sa_family = ARPHRD_ETHER; 312 ap_addr->sa_family = ARPHRD_ETHER;
@@ -322,13 +314,6 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
322 } else 314 } else
323 memset(&ap_addr->sa_data, 0, ETH_ALEN); 315 memset(&ap_addr->sa_data, 0, ETH_ALEN);
324 return 0; 316 return 0;
325 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
326 if (sdata->u.ibss.state == IEEE80211_IBSS_MLME_JOINED) {
327 ap_addr->sa_family = ARPHRD_ETHER;
328 memcpy(&ap_addr->sa_data, sdata->u.ibss.bssid, ETH_ALEN);
329 } else
330 memset(&ap_addr->sa_data, 0, ETH_ALEN);
331 return 0;
332 } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { 317 } else if (sdata->vif.type == NL80211_IFTYPE_WDS) {
333 ap_addr->sa_family = ARPHRD_ETHER; 318 ap_addr->sa_family = ARPHRD_ETHER;
334 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); 319 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);