aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/lib80211.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2008-09-24 18:13:14 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:46 -0400
commit7e272fcff6f0a32a3d46e600ea5895f6058f4e2d (patch)
tree39857028913862af4d71170d1f16ee360ba49115 /net/wireless/lib80211.c
parentddf4ac53fb8a12a027c0486db743ae040f45b56a (diff)
wireless: consolidate on a single escape_essid implementation
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/lib80211.c')
-rw-r--r--net/wireless/lib80211.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/net/wireless/lib80211.c b/net/wireless/lib80211.c
new file mode 100644
index 000000000000..b22d271fb675
--- /dev/null
+++ b/net/wireless/lib80211.c
@@ -0,0 +1,58 @@
1/*
2 * lib80211 -- common bits for IEEE802.11 drivers
3 *
4 * Copyright(c) 2008 John W. Linville <linville@tuxdriver.com>
5 *
6 */
7
8#include <linux/module.h>
9#include <linux/ieee80211.h>
10
11#include <net/lib80211.h>
12
13#define DRV_NAME "lib80211"
14
15#define DRV_DESCRIPTION "common routines for IEEE802.11 drivers"
16
17MODULE_DESCRIPTION(DRV_DESCRIPTION);
18MODULE_AUTHOR("John W. Linville <linville@tuxdriver.com>");
19MODULE_LICENSE("GPL");
20
21const char *escape_ssid(const char *ssid, u8 ssid_len)
22{
23 static char escaped[IEEE80211_MAX_SSID_LEN * 2 + 1];
24 const char *s = ssid;
25 char *d = escaped;
26
27 if (is_empty_ssid(ssid, ssid_len)) {
28 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
29 return escaped;
30 }
31
32 ssid_len = min_t(u8, ssid_len, IEEE80211_MAX_SSID_LEN);
33 while (ssid_len--) {
34 if (*s == '\0') {
35 *d++ = '\\';
36 *d++ = '0';
37 s++;
38 } else {
39 *d++ = *s++;
40 }
41 }
42 *d = '\0';
43 return escaped;
44}
45EXPORT_SYMBOL(escape_ssid);
46
47static int __init ieee80211_init(void)
48{
49 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION "\n");
50 return 0;
51}
52
53static void __exit ieee80211_exit(void)
54{
55}
56
57module_init(ieee80211_init);
58module_exit(ieee80211_exit);