diff options
Diffstat (limited to 'net/ieee80211/ieee80211_wx.c')
-rw-r--r-- | net/ieee80211/ieee80211_wx.c | 73 |
1 files changed, 35 insertions, 38 deletions
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index 2cd571c525a9..94882f39b072 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c | |||
@@ -29,19 +29,20 @@ | |||
29 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | 29 | Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
30 | 30 | ||
31 | ******************************************************************************/ | 31 | ******************************************************************************/ |
32 | #include <linux/wireless.h> | 32 | |
33 | #include <linux/version.h> | ||
34 | #include <linux/kmod.h> | 33 | #include <linux/kmod.h> |
35 | #include <linux/module.h> | 34 | #include <linux/module.h> |
36 | 35 | ||
37 | #include <net/ieee80211.h> | 36 | #include <net/ieee80211.h> |
37 | #include <linux/wireless.h> | ||
38 | |||
38 | static const char *ieee80211_modes[] = { | 39 | static const char *ieee80211_modes[] = { |
39 | "?", "a", "b", "ab", "g", "ag", "bg", "abg" | 40 | "?", "a", "b", "ab", "g", "ag", "bg", "abg" |
40 | }; | 41 | }; |
41 | 42 | ||
42 | #define MAX_CUSTOM_LEN 64 | 43 | #define MAX_CUSTOM_LEN 64 |
43 | static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | 44 | static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, |
44 | char *start, char *stop, | 45 | char *start, char *stop, |
45 | struct ieee80211_network *network) | 46 | struct ieee80211_network *network) |
46 | { | 47 | { |
47 | char custom[MAX_CUSTOM_LEN]; | 48 | char custom[MAX_CUSTOM_LEN]; |
@@ -65,29 +66,28 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
65 | iwe.u.data.length = sizeof("<hidden>"); | 66 | iwe.u.data.length = sizeof("<hidden>"); |
66 | start = iwe_stream_add_point(start, stop, &iwe, "<hidden>"); | 67 | start = iwe_stream_add_point(start, stop, &iwe, "<hidden>"); |
67 | } else { | 68 | } else { |
68 | iwe.u.data.length = min(network->ssid_len, (u8)32); | 69 | iwe.u.data.length = min(network->ssid_len, (u8) 32); |
69 | start = iwe_stream_add_point(start, stop, &iwe, network->ssid); | 70 | start = iwe_stream_add_point(start, stop, &iwe, network->ssid); |
70 | } | 71 | } |
71 | 72 | ||
72 | /* Add the protocol name */ | 73 | /* Add the protocol name */ |
73 | iwe.cmd = SIOCGIWNAME; | 74 | iwe.cmd = SIOCGIWNAME; |
74 | snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]); | 75 | snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", |
76 | ieee80211_modes[network->mode]); | ||
75 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN); | 77 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN); |
76 | 78 | ||
77 | /* Add mode */ | 79 | /* Add mode */ |
78 | iwe.cmd = SIOCGIWMODE; | 80 | iwe.cmd = SIOCGIWMODE; |
79 | if (network->capability & | 81 | if (network->capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) { |
80 | (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) { | ||
81 | if (network->capability & WLAN_CAPABILITY_ESS) | 82 | if (network->capability & WLAN_CAPABILITY_ESS) |
82 | iwe.u.mode = IW_MODE_MASTER; | 83 | iwe.u.mode = IW_MODE_MASTER; |
83 | else | 84 | else |
84 | iwe.u.mode = IW_MODE_ADHOC; | 85 | iwe.u.mode = IW_MODE_ADHOC; |
85 | 86 | ||
86 | start = iwe_stream_add_event(start, stop, &iwe, | 87 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN); |
87 | IW_EV_UINT_LEN); | ||
88 | } | 88 | } |
89 | 89 | ||
90 | /* Add frequency/channel */ | 90 | /* Add frequency/channel */ |
91 | iwe.cmd = SIOCGIWFREQ; | 91 | iwe.cmd = SIOCGIWFREQ; |
92 | /* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode); | 92 | /* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode); |
93 | iwe.u.freq.e = 3; */ | 93 | iwe.u.freq.e = 3; */ |
@@ -109,7 +109,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
109 | max_rate = 0; | 109 | max_rate = 0; |
110 | p = custom; | 110 | p = custom; |
111 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); | 111 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); |
112 | for (i = 0, j = 0; i < network->rates_len; ) { | 112 | for (i = 0, j = 0; i < network->rates_len;) { |
113 | if (j < network->rates_ex_len && | 113 | if (j < network->rates_ex_len && |
114 | ((network->rates_ex[j] & 0x7F) < | 114 | ((network->rates_ex[j] & 0x7F) < |
115 | (network->rates[i] & 0x7F))) | 115 | (network->rates[i] & 0x7F))) |
@@ -132,8 +132,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
132 | iwe.cmd = SIOCGIWRATE; | 132 | iwe.cmd = SIOCGIWRATE; |
133 | iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; | 133 | iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; |
134 | iwe.u.bitrate.value = max_rate * 500000; | 134 | iwe.u.bitrate.value = max_rate * 500000; |
135 | start = iwe_stream_add_event(start, stop, &iwe, | 135 | start = iwe_stream_add_event(start, stop, &iwe, IW_EV_PARAM_LEN); |
136 | IW_EV_PARAM_LEN); | ||
137 | 136 | ||
138 | iwe.cmd = IWEVCUSTOM; | 137 | iwe.cmd = IWEVCUSTOM; |
139 | iwe.u.data.length = p - custom; | 138 | iwe.u.data.length = p - custom; |
@@ -163,7 +162,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
163 | if (iwe.u.data.length) | 162 | if (iwe.u.data.length) |
164 | start = iwe_stream_add_point(start, stop, &iwe, custom); | 163 | start = iwe_stream_add_point(start, stop, &iwe, custom); |
165 | 164 | ||
166 | if (ieee->wpa_enabled && network->wpa_ie_len){ | 165 | if (ieee->wpa_enabled && network->wpa_ie_len) { |
167 | char buf[MAX_WPA_IE_LEN * 2 + 30]; | 166 | char buf[MAX_WPA_IE_LEN * 2 + 30]; |
168 | 167 | ||
169 | u8 *p = buf; | 168 | u8 *p = buf; |
@@ -178,7 +177,7 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
178 | start = iwe_stream_add_point(start, stop, &iwe, buf); | 177 | start = iwe_stream_add_point(start, stop, &iwe, buf); |
179 | } | 178 | } |
180 | 179 | ||
181 | if (ieee->wpa_enabled && network->rsn_ie_len){ | 180 | if (ieee->wpa_enabled && network->rsn_ie_len) { |
182 | char buf[MAX_WPA_IE_LEN * 2 + 30]; | 181 | char buf[MAX_WPA_IE_LEN * 2 + 30]; |
183 | 182 | ||
184 | u8 *p = buf; | 183 | u8 *p = buf; |
@@ -198,12 +197,12 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, | |||
198 | iwe.cmd = IWEVCUSTOM; | 197 | iwe.cmd = IWEVCUSTOM; |
199 | p = custom; | 198 | p = custom; |
200 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), | 199 | p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), |
201 | " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100)); | 200 | " Last beacon: %lums ago", |
201 | (jiffies - network->last_scanned) / (HZ / 100)); | ||
202 | iwe.u.data.length = p - custom; | 202 | iwe.u.data.length = p - custom; |
203 | if (iwe.u.data.length) | 203 | if (iwe.u.data.length) |
204 | start = iwe_stream_add_point(start, stop, &iwe, custom); | 204 | start = iwe_stream_add_point(start, stop, &iwe, custom); |
205 | 205 | ||
206 | |||
207 | return start; | 206 | return start; |
208 | } | 207 | } |
209 | 208 | ||
@@ -228,18 +227,19 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | |||
228 | time_after(network->last_scanned + ieee->scan_age, jiffies)) | 227 | time_after(network->last_scanned + ieee->scan_age, jiffies)) |
229 | ev = ipw2100_translate_scan(ieee, ev, stop, network); | 228 | ev = ipw2100_translate_scan(ieee, ev, stop, network); |
230 | else | 229 | else |
231 | IEEE80211_DEBUG_SCAN( | 230 | IEEE80211_DEBUG_SCAN("Not showing network '%s (" |
232 | "Not showing network '%s (" | 231 | MAC_FMT ")' due to age (%lums).\n", |
233 | MAC_FMT ")' due to age (%lums).\n", | 232 | escape_essid(network->ssid, |
234 | escape_essid(network->ssid, | 233 | network->ssid_len), |
235 | network->ssid_len), | 234 | MAC_ARG(network->bssid), |
236 | MAC_ARG(network->bssid), | 235 | (jiffies - |
237 | (jiffies - network->last_scanned) / (HZ / 100)); | 236 | network->last_scanned) / (HZ / |
237 | 100)); | ||
238 | } | 238 | } |
239 | 239 | ||
240 | spin_unlock_irqrestore(&ieee->lock, flags); | 240 | spin_unlock_irqrestore(&ieee->lock, flags); |
241 | 241 | ||
242 | wrqu->data.length = ev - extra; | 242 | wrqu->data.length = ev - extra; |
243 | wrqu->data.flags = 0; | 243 | wrqu->data.flags = 0; |
244 | 244 | ||
245 | IEEE80211_DEBUG_WX("exit: %d networks returned.\n", i); | 245 | IEEE80211_DEBUG_WX("exit: %d networks returned.\n", i); |
@@ -291,8 +291,8 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
291 | if (ieee->crypt[i] != NULL) { | 291 | if (ieee->crypt[i] != NULL) { |
292 | if (key_provided) | 292 | if (key_provided) |
293 | break; | 293 | break; |
294 | ieee80211_crypt_delayed_deinit( | 294 | ieee80211_crypt_delayed_deinit(ieee, |
295 | ieee, &ieee->crypt[i]); | 295 | &ieee->crypt[i]); |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
@@ -305,8 +305,6 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
305 | goto done; | 305 | goto done; |
306 | } | 306 | } |
307 | 307 | ||
308 | |||
309 | |||
310 | sec.enabled = 1; | 308 | sec.enabled = 1; |
311 | sec.flags |= SEC_ENABLED; | 309 | sec.flags |= SEC_ENABLED; |
312 | 310 | ||
@@ -340,8 +338,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
340 | new_crypt = NULL; | 338 | new_crypt = NULL; |
341 | 339 | ||
342 | printk(KERN_WARNING "%s: could not initialize WEP: " | 340 | printk(KERN_WARNING "%s: could not initialize WEP: " |
343 | "load module ieee80211_crypt_wep\n", | 341 | "load module ieee80211_crypt_wep\n", dev->name); |
344 | dev->name); | ||
345 | return -EOPNOTSUPP; | 342 | return -EOPNOTSUPP; |
346 | } | 343 | } |
347 | *crypt = new_crypt; | 344 | *crypt = new_crypt; |
@@ -358,7 +355,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
358 | key, escape_essid(sec.keys[key], len), | 355 | key, escape_essid(sec.keys[key], len), |
359 | erq->length, len); | 356 | erq->length, len); |
360 | sec.key_sizes[key] = len; | 357 | sec.key_sizes[key] = len; |
361 | (*crypt)->ops->set_key(sec.keys[key], len, NULL, | 358 | (*crypt)->ops->set_key(sec.keys[key], len, NULL, |
362 | (*crypt)->priv); | 359 | (*crypt)->priv); |
363 | sec.flags |= (1 << key); | 360 | sec.flags |= (1 << key); |
364 | /* This ensures a key will be activated if no key is | 361 | /* This ensures a key will be activated if no key is |
@@ -381,15 +378,15 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
381 | 378 | ||
382 | /* No key data - just set the default TX key index */ | 379 | /* No key data - just set the default TX key index */ |
383 | if (key_provided) { | 380 | if (key_provided) { |
384 | IEEE80211_DEBUG_WX( | 381 | IEEE80211_DEBUG_WX |
385 | "Setting key %d to default Tx key.\n", key); | 382 | ("Setting key %d to default Tx key.\n", key); |
386 | ieee->tx_keyidx = key; | 383 | ieee->tx_keyidx = key; |
387 | sec.active_key = key; | 384 | sec.active_key = key; |
388 | sec.flags |= SEC_ACTIVE_KEY; | 385 | sec.flags |= SEC_ACTIVE_KEY; |
389 | } | 386 | } |
390 | } | 387 | } |
391 | 388 | ||
392 | done: | 389 | done: |
393 | ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED); | 390 | ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED); |
394 | sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; | 391 | sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; |
395 | sec.flags |= SEC_AUTH_MODE; | 392 | sec.flags |= SEC_AUTH_MODE; |
@@ -399,7 +396,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
399 | /* For now we just support WEP, so only set that security level... | 396 | /* For now we just support WEP, so only set that security level... |
400 | * TODO: When WPA is added this is one place that needs to change */ | 397 | * TODO: When WPA is added this is one place that needs to change */ |
401 | sec.flags |= SEC_LEVEL; | 398 | sec.flags |= SEC_LEVEL; |
402 | sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ | 399 | sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ |
403 | 400 | ||
404 | if (ieee->set_security) | 401 | if (ieee->set_security) |
405 | ieee->set_security(dev, &sec); | 402 | ieee->set_security(dev, &sec); |