]> err.no Git - linux-2.6/blobdiff - net/ieee80211/ieee80211_module.c
[IPV6]: Don't redo xfrm_lookup for cached dst entries
[linux-2.6] / net / ieee80211 / ieee80211_module.c
index 90bc50b97ea78f9c0b6863724efaec8bd935055f..03a47343ddc75a386370e9e07861299faf9e71ae 100644 (file)
@@ -40,7 +40,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
-#include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/skbuff.h>
 #include <linux/slab.h>
@@ -55,7 +54,8 @@
 #include <net/ieee80211.h>
 
 MODULE_DESCRIPTION("802.11 data/management/control stack");
-MODULE_AUTHOR("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>");
+MODULE_AUTHOR
+    ("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>");
 MODULE_LICENSE("GPL");
 
 #define DRV_NAME "ieee80211"
@@ -65,9 +65,9 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee)
        if (ieee->networks)
                return 0;
 
-       ieee->networks = kmalloc(
-               MAX_NETWORK_COUNT * sizeof(struct ieee80211_network),
-               GFP_KERNEL);
+       ieee->networks =
+           kmalloc(MAX_NETWORK_COUNT * sizeof(struct ieee80211_network),
+                   GFP_KERNEL);
        if (!ieee->networks) {
                printk(KERN_WARNING "%s: Out of memory allocating beacons\n",
                       ieee->dev->name);
@@ -95,10 +95,10 @@ static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
        INIT_LIST_HEAD(&ieee->network_free_list);
        INIT_LIST_HEAD(&ieee->network_list);
        for (i = 0; i < MAX_NETWORK_COUNT; i++)
-               list_add_tail(&ieee->networks[i].list, &ieee->network_free_list);
+               list_add_tail(&ieee->networks[i].list,
+                             &ieee->network_free_list);
 }
 
-
 struct net_device *alloc_ieee80211(int sizeof_priv)
 {
        struct ieee80211_device *ieee;
@@ -119,8 +119,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
 
        err = ieee80211_networks_allocate(ieee);
        if (err) {
-               IEEE80211_ERROR("Unable to allocate beacon storage: %d\n",
-                               err);
+               IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", err);
                goto failed;
        }
        ieee80211_networks_initialize(ieee);
@@ -133,7 +132,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
        /* Default to enabling full open WEP with host based encrypt/decrypt */
        ieee->host_encrypt = 1;
        ieee->host_decrypt = 1;
-       ieee->ieee802_1x = 1; /* Default to supporting 802.1x */
+       ieee->ieee802_1x = 1;   /* Default to supporting 802.1x */
 
        INIT_LIST_HEAD(&ieee->crypt_deinit_list);
        init_timer(&ieee->crypt_deinit_timer);
@@ -142,21 +141,20 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
 
        spin_lock_init(&ieee->lock);
 
-       ieee->wpa_enabled = 0;
-       ieee->tkip_countermeasures = 0;
-       ieee->drop_unencrypted = 0;
-       ieee->privacy_invoked = 0;
-       ieee->ieee802_1x = 1;
+       ieee->wpa_enabled = 0;
+       ieee->tkip_countermeasures = 0;
+       ieee->drop_unencrypted = 0;
+       ieee->privacy_invoked = 0;
+       ieee->ieee802_1x = 1;
 
        return dev;
 
- failed:
     failed:
        if (dev)
                free_netdev(dev);
        return NULL;
 }
 
-
 void free_ieee80211(struct net_device *dev)
 {
        struct ieee80211_device *ieee = netdev_priv(dev);
@@ -194,7 +192,7 @@ static int show_debug_level(char *page, char **start, off_t offset,
        return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
 }
 
-static int store_debug_level(struct file *file, const char __user *buffer,
+static int store_debug_level(struct file *file, const char __user * buffer,
                             unsigned long count, void *data)
 {
        char buf[] = "0x00000000";
@@ -265,10 +263,35 @@ static void __exit ieee80211_exit(void)
 module_param(debug, int, 0444);
 MODULE_PARM_DESC(debug, "debug output mask");
 
-
 module_exit(ieee80211_exit);
 module_init(ieee80211_init);
 #endif
 
+const char *escape_essid(const char *essid, u8 essid_len)
+{
+       static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
+       const char *s = essid;
+       char *d = escaped;
+
+       if (ieee80211_is_empty_essid(essid, essid_len)) {
+               memcpy(escaped, "<hidden>", sizeof("<hidden>"));
+               return escaped;
+       }
+
+       essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE);
+       while (essid_len--) {
+               if (*s == '\0') {
+                       *d++ = '\\';
+                       *d++ = '0';
+                       s++;
+               } else {
+                       *d++ = *s++;
+               }
+       }
+       *d = '\0';
+       return escaped;
+}
+
 EXPORT_SYMBOL(alloc_ieee80211);
 EXPORT_SYMBOL(free_ieee80211);
+EXPORT_SYMBOL(escape_essid);