aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_module.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ieee80211/ieee80211_module.c')
-rw-r--r--net/ieee80211/ieee80211_module.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c
index 553acb2e93d5..03a47343ddc7 100644
--- a/net/ieee80211/ieee80211_module.c
+++ b/net/ieee80211/ieee80211_module.c
@@ -54,7 +54,8 @@
54#include <net/ieee80211.h> 54#include <net/ieee80211.h>
55 55
56MODULE_DESCRIPTION("802.11 data/management/control stack"); 56MODULE_DESCRIPTION("802.11 data/management/control stack");
57MODULE_AUTHOR("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>"); 57MODULE_AUTHOR
58 ("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>");
58MODULE_LICENSE("GPL"); 59MODULE_LICENSE("GPL");
59 60
60#define DRV_NAME "ieee80211" 61#define DRV_NAME "ieee80211"
@@ -64,9 +65,9 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
64 if (ieee->networks) 65 if (ieee->networks)
65 return 0; 66 return 0;
66 67
67 ieee->networks = kmalloc( 68 ieee->networks =
68 MAX_NETWORK_COUNT * sizeof(struct ieee80211_network), 69 kmalloc(MAX_NETWORK_COUNT * sizeof(struct ieee80211_network),
69 GFP_KERNEL); 70 GFP_KERNEL);
70 if (!ieee->networks) { 71 if (!ieee->networks) {
71 printk(KERN_WARNING "%s: Out of memory allocating beacons\n", 72 printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
72 ieee->dev->name); 73 ieee->dev->name);
@@ -94,10 +95,10 @@ static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
94 INIT_LIST_HEAD(&ieee->network_free_list); 95 INIT_LIST_HEAD(&ieee->network_free_list);
95 INIT_LIST_HEAD(&ieee->network_list); 96 INIT_LIST_HEAD(&ieee->network_list);
96 for (i = 0; i < MAX_NETWORK_COUNT; i++) 97 for (i = 0; i < MAX_NETWORK_COUNT; i++)
97 list_add_tail(&ieee->networks[i].list, &ieee->network_free_list); 98 list_add_tail(&ieee->networks[i].list,
99 &ieee->network_free_list);
98} 100}
99 101
100
101struct net_device *alloc_ieee80211(int sizeof_priv) 102struct net_device *alloc_ieee80211(int sizeof_priv)
102{ 103{
103 struct ieee80211_device *ieee; 104 struct ieee80211_device *ieee;
@@ -118,8 +119,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
118 119
119 err = ieee80211_networks_allocate(ieee); 120 err = ieee80211_networks_allocate(ieee);
120 if (err) { 121 if (err) {
121 IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", 122 IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", err);
122 err);
123 goto failed; 123 goto failed;
124 } 124 }
125 ieee80211_networks_initialize(ieee); 125 ieee80211_networks_initialize(ieee);
@@ -132,7 +132,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
132 /* Default to enabling full open WEP with host based encrypt/decrypt */ 132 /* Default to enabling full open WEP with host based encrypt/decrypt */
133 ieee->host_encrypt = 1; 133 ieee->host_encrypt = 1;
134 ieee->host_decrypt = 1; 134 ieee->host_decrypt = 1;
135 ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ 135 ieee->ieee802_1x = 1; /* Default to supporting 802.1x */
136 136
137 INIT_LIST_HEAD(&ieee->crypt_deinit_list); 137 INIT_LIST_HEAD(&ieee->crypt_deinit_list);
138 init_timer(&ieee->crypt_deinit_timer); 138 init_timer(&ieee->crypt_deinit_timer);
@@ -141,21 +141,20 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
141 141
142 spin_lock_init(&ieee->lock); 142 spin_lock_init(&ieee->lock);
143 143
144 ieee->wpa_enabled = 0; 144 ieee->wpa_enabled = 0;
145 ieee->tkip_countermeasures = 0; 145 ieee->tkip_countermeasures = 0;
146 ieee->drop_unencrypted = 0; 146 ieee->drop_unencrypted = 0;
147 ieee->privacy_invoked = 0; 147 ieee->privacy_invoked = 0;
148 ieee->ieee802_1x = 1; 148 ieee->ieee802_1x = 1;
149 149
150 return dev; 150 return dev;
151 151
152 failed: 152 failed:
153 if (dev) 153 if (dev)
154 free_netdev(dev); 154 free_netdev(dev);
155 return NULL; 155 return NULL;
156} 156}
157 157
158
159void free_ieee80211(struct net_device *dev) 158void free_ieee80211(struct net_device *dev)
160{ 159{
161 struct ieee80211_device *ieee = netdev_priv(dev); 160 struct ieee80211_device *ieee = netdev_priv(dev);
@@ -193,7 +192,7 @@ static int show_debug_level(char *page, char **start, off_t offset,
193 return snprintf(page, count, "0x%08X\n", ieee80211_debug_level); 192 return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
194} 193}
195 194
196static int store_debug_level(struct file *file, const char __user *buffer, 195static int store_debug_level(struct file *file, const char __user * buffer,
197 unsigned long count, void *data) 196 unsigned long count, void *data)
198{ 197{
199 char buf[] = "0x00000000"; 198 char buf[] = "0x00000000";
@@ -264,13 +263,12 @@ static void __exit ieee80211_exit(void)
264module_param(debug, int, 0444); 263module_param(debug, int, 0444);
265MODULE_PARM_DESC(debug, "debug output mask"); 264MODULE_PARM_DESC(debug, "debug output mask");
266 265
267
268module_exit(ieee80211_exit); 266module_exit(ieee80211_exit);
269module_init(ieee80211_init); 267module_init(ieee80211_init);
270#endif 268#endif
271 269
272 270const char *escape_essid(const char *essid, u8 essid_len)
273const char *escape_essid(const char *essid, u8 essid_len) { 271{
274 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; 272 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
275 const char *s = essid; 273 const char *s = essid;
276 char *d = escaped; 274 char *d = escaped;
@@ -280,7 +278,7 @@ const char *escape_essid(const char *essid, u8 essid_len) {
280 return escaped; 278 return escaped;
281 } 279 }
282 280
283 essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); 281 essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE);
284 while (essid_len--) { 282 while (essid_len--) {
285 if (*s == '\0') { 283 if (*s == '\0') {
286 *d++ = '\\'; 284 *d++ = '\\';