diff options
| author | John W. Linville <linville@tuxdriver.com> | 2008-09-24 18:13:14 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:46 -0400 |
| commit | 7e272fcff6f0a32a3d46e600ea5895f6058f4e2d (patch) | |
| tree | 39857028913862af4d71170d1f16ee360ba49115 /net/wireless | |
| parent | ddf4ac53fb8a12a027c0486db743ae040f45b56a (diff) | |
wireless: consolidate on a single escape_essid implementation
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
| -rw-r--r-- | net/wireless/Kconfig | 10 | ||||
| -rw-r--r-- | net/wireless/Makefile | 1 | ||||
| -rw-r--r-- | net/wireless/lib80211.c | 58 |
3 files changed, 69 insertions, 0 deletions
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig index 646c7121dbc0..ae7f2262dfb5 100644 --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig | |||
| @@ -72,3 +72,13 @@ config WIRELESS_EXT_SYSFS | |||
| 72 | 72 | ||
| 73 | Say Y if you have programs using it, like old versions of | 73 | Say Y if you have programs using it, like old versions of |
| 74 | hal. | 74 | hal. |
| 75 | |||
| 76 | config LIB80211 | ||
| 77 | tristate "Common routines for IEEE802.11 drivers" | ||
| 78 | default n | ||
| 79 | help | ||
| 80 | This options enables a library of common routines used | ||
| 81 | by IEEE802.11 wireless LAN drivers. | ||
| 82 | |||
| 83 | Drivers should select this themselves if needed. Say Y if | ||
| 84 | you want this built into your kernel. | ||
diff --git a/net/wireless/Makefile b/net/wireless/Makefile index b9f943c45f3b..d2d848d445f2 100644 --- a/net/wireless/Makefile +++ b/net/wireless/Makefile | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | obj-$(CONFIG_WIRELESS_EXT) += wext.o | 1 | obj-$(CONFIG_WIRELESS_EXT) += wext.o |
| 2 | obj-$(CONFIG_CFG80211) += cfg80211.o | 2 | obj-$(CONFIG_CFG80211) += cfg80211.o |
| 3 | obj-$(CONFIG_LIB80211) += lib80211.o | ||
| 3 | 4 | ||
| 4 | cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o | 5 | cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o |
| 5 | cfg80211-$(CONFIG_NL80211) += nl80211.o | 6 | cfg80211-$(CONFIG_NL80211) += nl80211.o |
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 | |||
| 17 | MODULE_DESCRIPTION(DRV_DESCRIPTION); | ||
| 18 | MODULE_AUTHOR("John W. Linville <linville@tuxdriver.com>"); | ||
| 19 | MODULE_LICENSE("GPL"); | ||
| 20 | |||
| 21 | const 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 | } | ||
| 45 | EXPORT_SYMBOL(escape_ssid); | ||
| 46 | |||
| 47 | static int __init ieee80211_init(void) | ||
| 48 | { | ||
| 49 | printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION "\n"); | ||
| 50 | return 0; | ||
| 51 | } | ||
| 52 | |||
| 53 | static void __exit ieee80211_exit(void) | ||
| 54 | { | ||
| 55 | } | ||
| 56 | |||
| 57 | module_init(ieee80211_init); | ||
| 58 | module_exit(ieee80211_exit); | ||
