aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
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 /drivers/net/wireless/libertas
parentddf4ac53fb8a12a027c0486db743ae040f45b56a (diff)
wireless: consolidate on a single escape_essid implementation
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/assoc.c14
-rw-r--r--drivers/net/wireless/libertas/cmd.c3
-rw-r--r--drivers/net/wireless/libertas/debugfs.c3
-rw-r--r--drivers/net/wireless/libertas/decl.h4
-rw-r--r--drivers/net/wireless/libertas/main.c27
-rw-r--r--drivers/net/wireless/libertas/scan.c11
-rw-r--r--drivers/net/wireless/libertas/wext.c3
7 files changed, 21 insertions, 44 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 8b88e9544418..3492e89d1dd5 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -1,6 +1,8 @@
1/* Copyright (C) 2006, Red Hat, Inc. */ 1/* Copyright (C) 2006, Red Hat, Inc. */
2 2
3#include <linux/types.h>
3#include <linux/etherdevice.h> 4#include <linux/etherdevice.h>
5#include <net/lib80211.h>
4 6
5#include "assoc.h" 7#include "assoc.h"
6#include "decl.h" 8#include "decl.h"
@@ -157,11 +159,11 @@ static int lbs_adhoc_join(struct lbs_private *priv,
157 lbs_deb_enter(LBS_DEB_ASSOC); 159 lbs_deb_enter(LBS_DEB_ASSOC);
158 160
159 lbs_deb_join("current SSID '%s', ssid length %u\n", 161 lbs_deb_join("current SSID '%s', ssid length %u\n",
160 escape_essid(priv->curbssparams.ssid, 162 escape_ssid(priv->curbssparams.ssid,
161 priv->curbssparams.ssid_len), 163 priv->curbssparams.ssid_len),
162 priv->curbssparams.ssid_len); 164 priv->curbssparams.ssid_len);
163 lbs_deb_join("requested ssid '%s', ssid length %u\n", 165 lbs_deb_join("requested ssid '%s', ssid length %u\n",
164 escape_essid(bss->ssid, bss->ssid_len), 166 escape_ssid(bss->ssid, bss->ssid_len),
165 bss->ssid_len); 167 bss->ssid_len);
166 168
167 /* check if the requested SSID is already joined */ 169 /* check if the requested SSID is already joined */
@@ -325,7 +327,7 @@ static int lbs_adhoc_start(struct lbs_private *priv,
325 memcpy(cmd.ssid, assoc_req->ssid, assoc_req->ssid_len); 327 memcpy(cmd.ssid, assoc_req->ssid, assoc_req->ssid_len);
326 328
327 lbs_deb_join("ADHOC_START: SSID '%s', ssid length %u\n", 329 lbs_deb_join("ADHOC_START: SSID '%s', ssid length %u\n",
328 escape_essid(assoc_req->ssid, assoc_req->ssid_len), 330 escape_ssid(assoc_req->ssid, assoc_req->ssid_len),
329 assoc_req->ssid_len); 331 assoc_req->ssid_len);
330 332
331 cmd.bsstype = CMD_BSS_TYPE_IBSS; 333 cmd.bsstype = CMD_BSS_TYPE_IBSS;
@@ -704,7 +706,7 @@ static int assoc_helper_essid(struct lbs_private *priv,
704 channel = assoc_req->channel; 706 channel = assoc_req->channel;
705 707
706 lbs_deb_assoc("SSID '%s' requested\n", 708 lbs_deb_assoc("SSID '%s' requested\n",
707 escape_essid(assoc_req->ssid, assoc_req->ssid_len)); 709 escape_ssid(assoc_req->ssid, assoc_req->ssid_len));
708 if (assoc_req->mode == IW_MODE_INFRA) { 710 if (assoc_req->mode == IW_MODE_INFRA) {
709 lbs_send_specific_ssid_scan(priv, assoc_req->ssid, 711 lbs_send_specific_ssid_scan(priv, assoc_req->ssid,
710 assoc_req->ssid_len); 712 assoc_req->ssid_len);
@@ -1228,7 +1230,7 @@ void lbs_association_worker(struct work_struct *work)
1228 " secinfo: %s%s%s\n" 1230 " secinfo: %s%s%s\n"
1229 " auth_mode: %d\n", 1231 " auth_mode: %d\n",
1230 assoc_req->flags, 1232 assoc_req->flags,
1231 escape_essid(assoc_req->ssid, assoc_req->ssid_len), 1233 escape_ssid(assoc_req->ssid, assoc_req->ssid_len),
1232 assoc_req->channel, assoc_req->band, assoc_req->mode, 1234 assoc_req->channel, assoc_req->band, assoc_req->mode,
1233 assoc_req->bssid, 1235 assoc_req->bssid,
1234 assoc_req->secinfo.WPAenabled ? " WPA" : "", 1236 assoc_req->secinfo.WPAenabled ? " WPA" : "",
@@ -1814,7 +1816,7 @@ static int lbs_adhoc_post(struct lbs_private *priv, struct cmd_header *resp)
1814 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); 1816 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
1815 1817
1816 lbs_deb_join("ADHOC_RESP: Joined/started '%s', BSSID %pM, channel %d\n", 1818 lbs_deb_join("ADHOC_RESP: Joined/started '%s', BSSID %pM, channel %d\n",
1817 escape_essid(bss->ssid, bss->ssid_len), 1819 escape_ssid(bss->ssid, bss->ssid_len),
1818 priv->curbssparams.bssid, 1820 priv->curbssparams.bssid,
1819 priv->curbssparams.channel); 1821 priv->curbssparams.channel);
1820 1822
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index d45b07cf6a62..52feab69ee49 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include <net/iw_handler.h> 6#include <net/iw_handler.h>
7#include <net/lib80211.h>
7#include <net/ieee80211.h> 8#include <net/ieee80211.h>
8#include <linux/kfifo.h> 9#include <linux/kfifo.h>
9#include "host.h" 10#include "host.h"
@@ -1092,7 +1093,7 @@ int lbs_mesh_config(struct lbs_private *priv, uint16_t action, uint16_t chan)
1092 } 1093 }
1093 lbs_deb_cmd("mesh config action %d type %x channel %d SSID %s\n", 1094 lbs_deb_cmd("mesh config action %d type %x channel %d SSID %s\n",
1094 action, priv->mesh_tlv, chan, 1095 action, priv->mesh_tlv, chan,
1095 escape_essid(priv->mesh_ssid, priv->mesh_ssid_len)); 1096 escape_ssid(priv->mesh_ssid, priv->mesh_ssid_len));
1096 1097
1097 return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv); 1098 return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv);
1098} 1099}
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 5f6bee493f23..84933203be74 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -5,6 +5,7 @@
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <linux/string.h> 6#include <linux/string.h>
7#include <net/iw_handler.h> 7#include <net/iw_handler.h>
8#include <net/lib80211.h>
8 9
9#include "dev.h" 10#include "dev.h"
10#include "decl.h" 11#include "decl.h"
@@ -85,7 +86,7 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf,
85 spectrum_mgmt ? 'S' : ' '); 86 spectrum_mgmt ? 'S' : ' ');
86 pos += snprintf(buf+pos, len-pos, " %04d |", SCAN_RSSI(iter_bss->rssi)); 87 pos += snprintf(buf+pos, len-pos, " %04d |", SCAN_RSSI(iter_bss->rssi));
87 pos += snprintf(buf+pos, len-pos, " %s\n", 88 pos += snprintf(buf+pos, len-pos, " %s\n",
88 escape_essid(iter_bss->ssid, iter_bss->ssid_len)); 89 escape_ssid(iter_bss->ssid, iter_bss->ssid_len));
89 90
90 numscansdone++; 91 numscansdone++;
91 } 92 }
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 1a8888cceadc..0b84bdca0726 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -74,8 +74,4 @@ void lbs_host_to_card_done(struct lbs_private *priv);
74 74
75int lbs_update_channel(struct lbs_private *priv); 75int lbs_update_channel(struct lbs_private *priv);
76 76
77#ifndef CONFIG_IEEE80211
78const char *escape_essid(const char *essid, u8 essid_len);
79#endif
80
81#endif 77#endif
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 34a47f692bd6..e9d23f68174f 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -1646,33 +1646,6 @@ out:
1646 return ret; 1646 return ret;
1647} 1647}
1648 1648
1649#ifndef CONFIG_IEEE80211
1650const char *escape_essid(const char *essid, u8 essid_len)
1651{
1652 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
1653 const char *s = essid;
1654 char *d = escaped;
1655
1656 if (ieee80211_is_empty_essid(essid, essid_len)) {
1657 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
1658 return escaped;
1659 }
1660
1661 essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE);
1662 while (essid_len--) {
1663 if (*s == '\0') {
1664 *d++ = '\\';
1665 *d++ = '0';
1666 s++;
1667 } else {
1668 *d++ = *s++;
1669 }
1670 }
1671 *d = '\0';
1672 return escaped;
1673}
1674#endif
1675
1676module_init(lbs_init_module); 1649module_init(lbs_init_module);
1677module_exit(lbs_exit_module); 1650module_exit(lbs_exit_module);
1678 1651
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 351b3f6e5664..7881890a4e98 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -4,9 +4,12 @@
4 * IOCTL handlers as well as command preperation and response routines 4 * IOCTL handlers as well as command preperation and response routines
5 * for sending scan commands to the firmware. 5 * for sending scan commands to the firmware.
6 */ 6 */
7#include <linux/types.h>
7#include <linux/etherdevice.h> 8#include <linux/etherdevice.h>
8#include <asm/unaligned.h> 9#include <asm/unaligned.h>
9 10
11#include <net/lib80211.h>
12
10#include "host.h" 13#include "host.h"
11#include "decl.h" 14#include "decl.h"
12#include "dev.h" 15#include "dev.h"
@@ -452,7 +455,7 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan)
452 list_for_each_entry(iter, &priv->network_list, list) 455 list_for_each_entry(iter, &priv->network_list, list)
453 lbs_deb_scan("%02d: BSSID %pM, RSSI %d, SSID '%s'\n", 456 lbs_deb_scan("%02d: BSSID %pM, RSSI %d, SSID '%s'\n",
454 i++, iter->bssid, iter->rssi, 457 i++, iter->bssid, iter->rssi,
455 escape_essid(iter->ssid, iter->ssid_len)); 458 escape_ssid(iter->ssid, iter->ssid_len));
456 mutex_unlock(&priv->lock); 459 mutex_unlock(&priv->lock);
457#endif 460#endif
458 461
@@ -599,7 +602,7 @@ static int lbs_process_bss(struct bss_descriptor *bss,
599 bss->ssid_len = min_t(int, 32, elem->len); 602 bss->ssid_len = min_t(int, 32, elem->len);
600 memcpy(bss->ssid, elem->data, bss->ssid_len); 603 memcpy(bss->ssid, elem->data, bss->ssid_len);
601 lbs_deb_scan("got SSID IE: '%s', len %u\n", 604 lbs_deb_scan("got SSID IE: '%s', len %u\n",
602 escape_essid(bss->ssid, bss->ssid_len), 605 escape_ssid(bss->ssid, bss->ssid_len),
603 bss->ssid_len); 606 bss->ssid_len);
604 break; 607 break;
605 608
@@ -742,7 +745,7 @@ int lbs_send_specific_ssid_scan(struct lbs_private *priv, uint8_t *ssid,
742 int ret = 0; 745 int ret = 0;
743 746
744 lbs_deb_enter_args(LBS_DEB_SCAN, "SSID '%s'\n", 747 lbs_deb_enter_args(LBS_DEB_SCAN, "SSID '%s'\n",
745 escape_essid(ssid, ssid_len)); 748 escape_ssid(ssid, ssid_len));
746 749
747 if (!ssid_len) 750 if (!ssid_len)
748 goto out; 751 goto out;
@@ -966,7 +969,7 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info,
966 priv->scan_ssid_len = req->essid_len; 969 priv->scan_ssid_len = req->essid_len;
967 memcpy(priv->scan_ssid, req->essid, priv->scan_ssid_len); 970 memcpy(priv->scan_ssid, req->essid, priv->scan_ssid_len);
968 lbs_deb_wext("set_scan, essid '%s'\n", 971 lbs_deb_wext("set_scan, essid '%s'\n",
969 escape_essid(priv->scan_ssid, priv->scan_ssid_len)); 972 escape_ssid(priv->scan_ssid, priv->scan_ssid_len));
970 } else { 973 } else {
971 priv->scan_ssid_len = 0; 974 priv->scan_ssid_len = 0;
972 } 975 }
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 04f0bf2ef0a8..247579951858 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -8,6 +8,7 @@
8#include <linux/wireless.h> 8#include <linux/wireless.h>
9#include <linux/bitops.h> 9#include <linux/bitops.h>
10 10
11#include <net/lib80211.h>
11#include <net/ieee80211.h> 12#include <net/ieee80211.h>
12#include <net/iw_handler.h> 13#include <net/iw_handler.h>
13 14
@@ -2005,7 +2006,7 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,
2005 lbs_deb_wext("requested any SSID\n"); 2006 lbs_deb_wext("requested any SSID\n");
2006 } else { 2007 } else {
2007 lbs_deb_wext("requested SSID '%s'\n", 2008 lbs_deb_wext("requested SSID '%s'\n",
2008 escape_essid(ssid, ssid_len)); 2009 escape_ssid(ssid, ssid_len));
2009 } 2010 }
2010 2011
2011out: 2012out: