aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/Kconfig1
-rw-r--r--drivers/net/wireless/ipw2100.c10
-rw-r--r--drivers/net/wireless/ipw2200.c118
-rw-r--r--drivers/net/wireless/ipw2200.h1
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c52
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c48
-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
-rw-r--r--include/net/ieee80211.h20
-rw-r--r--include/net/lib80211.h31
-rw-r--r--net/ieee80211/Kconfig1
-rw-r--r--net/ieee80211/ieee80211_module.c26
-rw-r--r--net/ieee80211/ieee80211_rx.c31
-rw-r--r--net/ieee80211/ieee80211_wx.c6
-rw-r--r--net/wireless/Kconfig10
-rw-r--r--net/wireless/Makefile1
-rw-r--r--net/wireless/lib80211.c58
23 files changed, 219 insertions, 262 deletions
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 45bdf0b339bb..42afaedbb219 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -271,6 +271,7 @@ config LIBERTAS
271 tristate "Marvell 8xxx Libertas WLAN driver support" 271 tristate "Marvell 8xxx Libertas WLAN driver support"
272 depends on WLAN_80211 272 depends on WLAN_80211
273 select WIRELESS_EXT 273 select WIRELESS_EXT
274 select LIB80211
274 select FW_LOADER 275 select FW_LOADER
275 ---help--- 276 ---help---
276 A library for Marvell Libertas 8xxx devices. 277 A library for Marvell Libertas 8xxx devices.
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index 079dbd07e2f6..223914e3e07e 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -1975,7 +1975,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
1975 } 1975 }
1976 1976
1977 IPW_DEBUG_INFO("%s: Associated with '%s' at %s, channel %d (BSSID=%pM)\n", 1977 IPW_DEBUG_INFO("%s: Associated with '%s' at %s, channel %d (BSSID=%pM)\n",
1978 priv->net_dev->name, escape_essid(essid, essid_len), 1978 priv->net_dev->name, escape_ssid(essid, essid_len),
1979 txratename, chan, bssid); 1979 txratename, chan, bssid);
1980 1980
1981 /* now we copy read ssid into dev */ 1981 /* now we copy read ssid into dev */
@@ -2003,7 +2003,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
2003 }; 2003 };
2004 int err; 2004 int err;
2005 2005
2006 IPW_DEBUG_HC("SSID: '%s'\n", escape_essid(essid, ssid_len)); 2006 IPW_DEBUG_HC("SSID: '%s'\n", escape_ssid(essid, ssid_len));
2007 2007
2008 if (ssid_len) 2008 if (ssid_len)
2009 memcpy(cmd.host_command_parameters, essid, ssid_len); 2009 memcpy(cmd.host_command_parameters, essid, ssid_len);
@@ -2046,7 +2046,7 @@ static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status)
2046{ 2046{
2047 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, 2047 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC,
2048 "disassociated: '%s' %pM \n", 2048 "disassociated: '%s' %pM \n",
2049 escape_essid(priv->essid, priv->essid_len), 2049 escape_ssid(priv->essid, priv->essid_len),
2050 priv->bssid); 2050 priv->bssid);
2051 2051
2052 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); 2052 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING);
@@ -6987,7 +6987,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev,
6987 goto done; 6987 goto done;
6988 } 6988 }
6989 6989
6990 IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", escape_essid(essid, length), 6990 IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", escape_ssid(essid, length),
6991 length); 6991 length);
6992 6992
6993 priv->essid_len = length; 6993 priv->essid_len = length;
@@ -7014,7 +7014,7 @@ static int ipw2100_wx_get_essid(struct net_device *dev,
7014 * configured ESSID then return that; otherwise return ANY */ 7014 * configured ESSID then return that; otherwise return ANY */
7015 if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) { 7015 if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) {
7016 IPW_DEBUG_WX("Getting essid: '%s'\n", 7016 IPW_DEBUG_WX("Getting essid: '%s'\n",
7017 escape_essid(priv->essid, priv->essid_len)); 7017 escape_ssid(priv->essid, priv->essid_len));
7018 memcpy(extra, priv->essid, priv->essid_len); 7018 memcpy(extra, priv->essid, priv->essid_len);
7019 wrqu->essid.length = priv->essid_len; 7019 wrqu->essid.length = priv->essid_len;
7020 wrqu->essid.flags = 1; /* active */ 7020 wrqu->essid.flags = 1; /* active */
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 6ec6de2960ee..22278f87d1c1 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -4409,8 +4409,8 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4409 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | 4409 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
4410 IPW_DL_ASSOC, 4410 IPW_DL_ASSOC,
4411 "associated: '%s' %pM \n", 4411 "associated: '%s' %pM \n",
4412 escape_essid(priv->essid, 4412 escape_ssid(priv->essid,
4413 priv->essid_len), 4413 priv->essid_len),
4414 priv->bssid); 4414 priv->bssid);
4415 4415
4416 switch (priv->ieee->iw_mode) { 4416 switch (priv->ieee->iw_mode) {
@@ -4490,10 +4490,10 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4490 "deauthenticated: '%s' " 4490 "deauthenticated: '%s' "
4491 "%pM" 4491 "%pM"
4492 ": (0x%04X) - %s \n", 4492 ": (0x%04X) - %s \n",
4493 escape_essid(priv-> 4493 escape_ssid(priv->
4494 essid, 4494 essid,
4495 priv-> 4495 priv->
4496 essid_len), 4496 essid_len),
4497 priv->bssid, 4497 priv->bssid,
4498 le16_to_cpu(auth->status), 4498 le16_to_cpu(auth->status),
4499 ipw_get_status_code 4499 ipw_get_status_code
@@ -4512,7 +4512,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4512 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | 4512 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
4513 IPW_DL_ASSOC, 4513 IPW_DL_ASSOC,
4514 "authenticated: '%s' %pM\n", 4514 "authenticated: '%s' %pM\n",
4515 escape_essid(priv->essid, 4515 escape_ssid(priv->essid,
4516 priv->essid_len), 4516 priv->essid_len),
4517 priv->bssid); 4517 priv->bssid);
4518 break; 4518 break;
@@ -4540,7 +4540,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4540 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | 4540 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
4541 IPW_DL_ASSOC, 4541 IPW_DL_ASSOC,
4542 "disassociated: '%s' %pM \n", 4542 "disassociated: '%s' %pM \n",
4543 escape_essid(priv->essid, 4543 escape_ssid(priv->essid,
4544 priv->essid_len), 4544 priv->essid_len),
4545 priv->bssid); 4545 priv->bssid);
4546 4546
@@ -4578,7 +4578,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4578 case CMAS_AUTHENTICATED: 4578 case CMAS_AUTHENTICATED:
4579 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, 4579 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE,
4580 "authenticated: '%s' %pM \n", 4580 "authenticated: '%s' %pM \n",
4581 escape_essid(priv->essid, 4581 escape_ssid(priv->essid,
4582 priv->essid_len), 4582 priv->essid_len),
4583 priv->bssid); 4583 priv->bssid);
4584 priv->status |= STATUS_AUTH; 4584 priv->status |= STATUS_AUTH;
@@ -4597,8 +4597,8 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4597 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | 4597 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
4598 IPW_DL_ASSOC, 4598 IPW_DL_ASSOC,
4599 "deauthenticated: '%s' %pM\n", 4599 "deauthenticated: '%s' %pM\n",
4600 escape_essid(priv->essid, 4600 escape_ssid(priv->essid,
4601 priv->essid_len), 4601 priv->essid_len),
4602 priv->bssid); 4602 priv->bssid);
4603 4603
4604 priv->status &= ~(STATUS_ASSOCIATING | 4604 priv->status &= ~(STATUS_ASSOCIATING |
@@ -5430,7 +5430,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5430 !(network->capability & WLAN_CAPABILITY_IBSS))) { 5430 !(network->capability & WLAN_CAPABILITY_IBSS))) {
5431 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded due to " 5431 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded due to "
5432 "capability mismatch.\n", 5432 "capability mismatch.\n",
5433 escape_essid(network->ssid, network->ssid_len), 5433 escape_ssid(network->ssid, network->ssid_len),
5434 network->bssid); 5434 network->bssid);
5435 return 0; 5435 return 0;
5436 } 5436 }
@@ -5440,7 +5440,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5440 if (network->flags & NETWORK_EMPTY_ESSID) { 5440 if (network->flags & NETWORK_EMPTY_ESSID) {
5441 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5441 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5442 "because of hidden ESSID.\n", 5442 "because of hidden ESSID.\n",
5443 escape_essid(network->ssid, network->ssid_len), 5443 escape_ssid(network->ssid, network->ssid_len),
5444 network->bssid); 5444 network->bssid);
5445 return 0; 5445 return 0;
5446 } 5446 }
@@ -5453,8 +5453,8 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5453 network->ssid_len)) { 5453 network->ssid_len)) {
5454 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5454 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5455 "because of non-network ESSID.\n", 5455 "because of non-network ESSID.\n",
5456 escape_essid(network->ssid, 5456 escape_ssid(network->ssid,
5457 network->ssid_len), 5457 network->ssid_len),
5458 network->bssid); 5458 network->bssid);
5459 return 0; 5459 return 0;
5460 } 5460 }
@@ -5468,13 +5468,13 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5468 char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; 5468 char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
5469 5469
5470 strncpy(escaped, 5470 strncpy(escaped,
5471 escape_essid(network->ssid, network->ssid_len), 5471 escape_ssid(network->ssid, network->ssid_len),
5472 sizeof(escaped)); 5472 sizeof(escaped));
5473 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5473 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5474 "because of ESSID mismatch: '%s'.\n", 5474 "because of ESSID mismatch: '%s'.\n",
5475 escaped, network->bssid, 5475 escaped, network->bssid,
5476 escape_essid(priv->essid, 5476 escape_ssid(priv->essid,
5477 priv->essid_len)); 5477 priv->essid_len));
5478 return 0; 5478 return 0;
5479 } 5479 }
5480 } 5480 }
@@ -5485,14 +5485,14 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5485 if (network->time_stamp[0] < match->network->time_stamp[0]) { 5485 if (network->time_stamp[0] < match->network->time_stamp[0]) {
5486 IPW_DEBUG_MERGE("Network '%s excluded because newer than " 5486 IPW_DEBUG_MERGE("Network '%s excluded because newer than "
5487 "current network.\n", 5487 "current network.\n",
5488 escape_essid(match->network->ssid, 5488 escape_ssid(match->network->ssid,
5489 match->network->ssid_len)); 5489 match->network->ssid_len));
5490 return 0; 5490 return 0;
5491 } else if (network->time_stamp[1] < match->network->time_stamp[1]) { 5491 } else if (network->time_stamp[1] < match->network->time_stamp[1]) {
5492 IPW_DEBUG_MERGE("Network '%s excluded because newer than " 5492 IPW_DEBUG_MERGE("Network '%s excluded because newer than "
5493 "current network.\n", 5493 "current network.\n",
5494 escape_essid(match->network->ssid, 5494 escape_ssid(match->network->ssid,
5495 match->network->ssid_len)); 5495 match->network->ssid_len));
5496 return 0; 5496 return 0;
5497 } 5497 }
5498 5498
@@ -5501,7 +5501,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5501 time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { 5501 time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) {
5502 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5502 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5503 "because of age: %ums.\n", 5503 "because of age: %ums.\n",
5504 escape_essid(network->ssid, network->ssid_len), 5504 escape_ssid(network->ssid, network->ssid_len),
5505 network->bssid, 5505 network->bssid,
5506 jiffies_to_msecs(jiffies - 5506 jiffies_to_msecs(jiffies -
5507 network->last_scanned)); 5507 network->last_scanned));
@@ -5512,7 +5512,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5512 (network->channel != priv->channel)) { 5512 (network->channel != priv->channel)) {
5513 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5513 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5514 "because of channel mismatch: %d != %d.\n", 5514 "because of channel mismatch: %d != %d.\n",
5515 escape_essid(network->ssid, network->ssid_len), 5515 escape_ssid(network->ssid, network->ssid_len),
5516 network->bssid, 5516 network->bssid,
5517 network->channel, priv->channel); 5517 network->channel, priv->channel);
5518 return 0; 5518 return 0;
@@ -5523,7 +5523,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5523 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { 5523 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) {
5524 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5524 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5525 "because of privacy mismatch: %s != %s.\n", 5525 "because of privacy mismatch: %s != %s.\n",
5526 escape_essid(network->ssid, network->ssid_len), 5526 escape_ssid(network->ssid, network->ssid_len),
5527 network->bssid, 5527 network->bssid,
5528 priv-> 5528 priv->
5529 capability & CAP_PRIVACY_ON ? "on" : "off", 5529 capability & CAP_PRIVACY_ON ? "on" : "off",
@@ -5536,8 +5536,8 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5536 if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { 5536 if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) {
5537 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5537 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5538 "because of the same BSSID match: %pM" 5538 "because of the same BSSID match: %pM"
5539 ".\n", escape_essid(network->ssid, 5539 ".\n", escape_ssid(network->ssid,
5540 network->ssid_len), 5540 network->ssid_len),
5541 network->bssid, 5541 network->bssid,
5542 priv->bssid); 5542 priv->bssid);
5543 return 0; 5543 return 0;
@@ -5548,7 +5548,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5548 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5548 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5549 "because of invalid frequency/mode " 5549 "because of invalid frequency/mode "
5550 "combination.\n", 5550 "combination.\n",
5551 escape_essid(network->ssid, network->ssid_len), 5551 escape_ssid(network->ssid, network->ssid_len),
5552 network->bssid); 5552 network->bssid);
5553 return 0; 5553 return 0;
5554 } 5554 }
@@ -5559,7 +5559,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5559 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5559 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5560 "because configured rate mask excludes " 5560 "because configured rate mask excludes "
5561 "AP mandatory rate.\n", 5561 "AP mandatory rate.\n",
5562 escape_essid(network->ssid, network->ssid_len), 5562 escape_ssid(network->ssid, network->ssid_len),
5563 network->bssid); 5563 network->bssid);
5564 return 0; 5564 return 0;
5565 } 5565 }
@@ -5567,7 +5567,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5567 if (rates.num_rates == 0) { 5567 if (rates.num_rates == 0) {
5568 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " 5568 IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5569 "because of no compatible rates.\n", 5569 "because of no compatible rates.\n",
5570 escape_essid(network->ssid, network->ssid_len), 5570 escape_ssid(network->ssid, network->ssid_len),
5571 network->bssid); 5571 network->bssid);
5572 return 0; 5572 return 0;
5573 } 5573 }
@@ -5580,7 +5580,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
5580 ipw_copy_rates(&match->rates, &rates); 5580 ipw_copy_rates(&match->rates, &rates);
5581 match->network = network; 5581 match->network = network;
5582 IPW_DEBUG_MERGE("Network '%s (%pM)' is a viable match.\n", 5582 IPW_DEBUG_MERGE("Network '%s (%pM)' is a viable match.\n",
5583 escape_essid(network->ssid, network->ssid_len), 5583 escape_ssid(network->ssid, network->ssid_len),
5584 network->bssid); 5584 network->bssid);
5585 5585
5586 return 1; 5586 return 1;
@@ -5618,8 +5618,8 @@ static void ipw_merge_adhoc_network(struct work_struct *work)
5618 mutex_lock(&priv->mutex); 5618 mutex_lock(&priv->mutex);
5619 if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { 5619 if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) {
5620 IPW_DEBUG_MERGE("remove network %s\n", 5620 IPW_DEBUG_MERGE("remove network %s\n",
5621 escape_essid(priv->essid, 5621 escape_ssid(priv->essid,
5622 priv->essid_len)); 5622 priv->essid_len));
5623 ipw_remove_current_network(priv); 5623 ipw_remove_current_network(priv);
5624 } 5624 }
5625 5625
@@ -5644,7 +5644,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5644 !(network->capability & WLAN_CAPABILITY_IBSS))) { 5644 !(network->capability & WLAN_CAPABILITY_IBSS))) {
5645 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded due to " 5645 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded due to "
5646 "capability mismatch.\n", 5646 "capability mismatch.\n",
5647 escape_essid(network->ssid, network->ssid_len), 5647 escape_ssid(network->ssid, network->ssid_len),
5648 network->bssid); 5648 network->bssid);
5649 return 0; 5649 return 0;
5650 } 5650 }
@@ -5654,7 +5654,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5654 if (network->flags & NETWORK_EMPTY_ESSID) { 5654 if (network->flags & NETWORK_EMPTY_ESSID) {
5655 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5655 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5656 "because of hidden ESSID.\n", 5656 "because of hidden ESSID.\n",
5657 escape_essid(network->ssid, network->ssid_len), 5657 escape_ssid(network->ssid, network->ssid_len),
5658 network->bssid); 5658 network->bssid);
5659 return 0; 5659 return 0;
5660 } 5660 }
@@ -5667,7 +5667,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5667 network->ssid_len)) { 5667 network->ssid_len)) {
5668 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5668 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5669 "because of non-network ESSID.\n", 5669 "because of non-network ESSID.\n",
5670 escape_essid(network->ssid, 5670 escape_ssid(network->ssid,
5671 network->ssid_len), 5671 network->ssid_len),
5672 network->bssid); 5672 network->bssid);
5673 return 0; 5673 return 0;
@@ -5681,13 +5681,13 @@ static int ipw_best_network(struct ipw_priv *priv,
5681 min(network->ssid_len, priv->essid_len)))) { 5681 min(network->ssid_len, priv->essid_len)))) {
5682 char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; 5682 char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
5683 strncpy(escaped, 5683 strncpy(escaped,
5684 escape_essid(network->ssid, network->ssid_len), 5684 escape_ssid(network->ssid, network->ssid_len),
5685 sizeof(escaped)); 5685 sizeof(escaped));
5686 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5686 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5687 "because of ESSID mismatch: '%s'.\n", 5687 "because of ESSID mismatch: '%s'.\n",
5688 escaped, network->bssid, 5688 escaped, network->bssid,
5689 escape_essid(priv->essid, 5689 escape_ssid(priv->essid,
5690 priv->essid_len)); 5690 priv->essid_len));
5691 return 0; 5691 return 0;
5692 } 5692 }
5693 } 5693 }
@@ -5697,13 +5697,13 @@ static int ipw_best_network(struct ipw_priv *priv,
5697 if (match->network && match->network->stats.rssi > network->stats.rssi) { 5697 if (match->network && match->network->stats.rssi > network->stats.rssi) {
5698 char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; 5698 char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
5699 strncpy(escaped, 5699 strncpy(escaped,
5700 escape_essid(network->ssid, network->ssid_len), 5700 escape_ssid(network->ssid, network->ssid_len),
5701 sizeof(escaped)); 5701 sizeof(escaped));
5702 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded because " 5702 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded because "
5703 "'%s (%pM)' has a stronger signal.\n", 5703 "'%s (%pM)' has a stronger signal.\n",
5704 escaped, network->bssid, 5704 escaped, network->bssid,
5705 escape_essid(match->network->ssid, 5705 escape_ssid(match->network->ssid,
5706 match->network->ssid_len), 5706 match->network->ssid_len),
5707 match->network->bssid); 5707 match->network->bssid);
5708 return 0; 5708 return 0;
5709 } 5709 }
@@ -5715,7 +5715,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5715 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5715 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5716 "because of storming (%ums since last " 5716 "because of storming (%ums since last "
5717 "assoc attempt).\n", 5717 "assoc attempt).\n",
5718 escape_essid(network->ssid, network->ssid_len), 5718 escape_ssid(network->ssid, network->ssid_len),
5719 network->bssid, 5719 network->bssid,
5720 jiffies_to_msecs(jiffies - 5720 jiffies_to_msecs(jiffies -
5721 network->last_associate)); 5721 network->last_associate));
@@ -5727,7 +5727,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5727 time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { 5727 time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) {
5728 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5728 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5729 "because of age: %ums.\n", 5729 "because of age: %ums.\n",
5730 escape_essid(network->ssid, network->ssid_len), 5730 escape_ssid(network->ssid, network->ssid_len),
5731 network->bssid, 5731 network->bssid,
5732 jiffies_to_msecs(jiffies - 5732 jiffies_to_msecs(jiffies -
5733 network->last_scanned)); 5733 network->last_scanned));
@@ -5738,7 +5738,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5738 (network->channel != priv->channel)) { 5738 (network->channel != priv->channel)) {
5739 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5739 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5740 "because of channel mismatch: %d != %d.\n", 5740 "because of channel mismatch: %d != %d.\n",
5741 escape_essid(network->ssid, network->ssid_len), 5741 escape_ssid(network->ssid, network->ssid_len),
5742 network->bssid, 5742 network->bssid,
5743 network->channel, priv->channel); 5743 network->channel, priv->channel);
5744 return 0; 5744 return 0;
@@ -5749,7 +5749,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5749 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { 5749 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) {
5750 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5750 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5751 "because of privacy mismatch: %s != %s.\n", 5751 "because of privacy mismatch: %s != %s.\n",
5752 escape_essid(network->ssid, network->ssid_len), 5752 escape_ssid(network->ssid, network->ssid_len),
5753 network->bssid, 5753 network->bssid,
5754 priv->capability & CAP_PRIVACY_ON ? "on" : 5754 priv->capability & CAP_PRIVACY_ON ? "on" :
5755 "off", 5755 "off",
@@ -5762,7 +5762,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5762 memcmp(network->bssid, priv->bssid, ETH_ALEN)) { 5762 memcmp(network->bssid, priv->bssid, ETH_ALEN)) {
5763 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5763 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5764 "because of BSSID mismatch: %pM.\n", 5764 "because of BSSID mismatch: %pM.\n",
5765 escape_essid(network->ssid, network->ssid_len), 5765 escape_ssid(network->ssid, network->ssid_len),
5766 network->bssid, priv->bssid); 5766 network->bssid, priv->bssid);
5767 return 0; 5767 return 0;
5768 } 5768 }
@@ -5772,7 +5772,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5772 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5772 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5773 "because of invalid frequency/mode " 5773 "because of invalid frequency/mode "
5774 "combination.\n", 5774 "combination.\n",
5775 escape_essid(network->ssid, network->ssid_len), 5775 escape_ssid(network->ssid, network->ssid_len),
5776 network->bssid); 5776 network->bssid);
5777 return 0; 5777 return 0;
5778 } 5778 }
@@ -5781,7 +5781,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5781 if (!ieee80211_is_valid_channel(priv->ieee, network->channel)) { 5781 if (!ieee80211_is_valid_channel(priv->ieee, network->channel)) {
5782 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5782 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5783 "because of invalid channel in current GEO\n", 5783 "because of invalid channel in current GEO\n",
5784 escape_essid(network->ssid, network->ssid_len), 5784 escape_ssid(network->ssid, network->ssid_len),
5785 network->bssid); 5785 network->bssid);
5786 return 0; 5786 return 0;
5787 } 5787 }
@@ -5792,7 +5792,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5792 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5792 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5793 "because configured rate mask excludes " 5793 "because configured rate mask excludes "
5794 "AP mandatory rate.\n", 5794 "AP mandatory rate.\n",
5795 escape_essid(network->ssid, network->ssid_len), 5795 escape_ssid(network->ssid, network->ssid_len),
5796 network->bssid); 5796 network->bssid);
5797 return 0; 5797 return 0;
5798 } 5798 }
@@ -5800,7 +5800,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5800 if (rates.num_rates == 0) { 5800 if (rates.num_rates == 0) {
5801 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " 5801 IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5802 "because of no compatible rates.\n", 5802 "because of no compatible rates.\n",
5803 escape_essid(network->ssid, network->ssid_len), 5803 escape_ssid(network->ssid, network->ssid_len),
5804 network->bssid); 5804 network->bssid);
5805 return 0; 5805 return 0;
5806 } 5806 }
@@ -5814,7 +5814,7 @@ static int ipw_best_network(struct ipw_priv *priv,
5814 match->network = network; 5814 match->network = network;
5815 5815
5816 IPW_DEBUG_ASSOC("Network '%s (%pM)' is a viable match.\n", 5816 IPW_DEBUG_ASSOC("Network '%s (%pM)' is a viable match.\n",
5817 escape_essid(network->ssid, network->ssid_len), 5817 escape_ssid(network->ssid, network->ssid_len),
5818 network->bssid); 5818 network->bssid);
5819 5819
5820 return 1; 5820 return 1;
@@ -6065,7 +6065,7 @@ static void ipw_debug_config(struct ipw_priv *priv)
6065 IPW_DEBUG_INFO("Channel unlocked.\n"); 6065 IPW_DEBUG_INFO("Channel unlocked.\n");
6066 if (priv->config & CFG_STATIC_ESSID) 6066 if (priv->config & CFG_STATIC_ESSID)
6067 IPW_DEBUG_INFO("ESSID locked to '%s'\n", 6067 IPW_DEBUG_INFO("ESSID locked to '%s'\n",
6068 escape_essid(priv->essid, priv->essid_len)); 6068 escape_ssid(priv->essid, priv->essid_len));
6069 else 6069 else
6070 IPW_DEBUG_INFO("ESSID unlocked.\n"); 6070 IPW_DEBUG_INFO("ESSID unlocked.\n");
6071 if (priv->config & CFG_STATIC_BSSID) 6071 if (priv->config & CFG_STATIC_BSSID)
@@ -7352,7 +7352,7 @@ static int ipw_associate_network(struct ipw_priv *priv,
7352 IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " 7352 IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, "
7353 "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n", 7353 "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n",
7354 roaming ? "Rea" : "A", 7354 roaming ? "Rea" : "A",
7355 escape_essid(priv->essid, priv->essid_len), 7355 escape_ssid(priv->essid, priv->essid_len),
7356 network->channel, 7356 network->channel,
7357 ipw_modes[priv->assoc_request.ieee_mode], 7357 ipw_modes[priv->assoc_request.ieee_mode],
7358 rates->num_rates, 7358 rates->num_rates,
@@ -7452,7 +7452,7 @@ static int ipw_associate_network(struct ipw_priv *priv,
7452 } 7452 }
7453 7453
7454 IPW_DEBUG(IPW_DL_STATE, "associating: '%s' %pM \n", 7454 IPW_DEBUG(IPW_DL_STATE, "associating: '%s' %pM \n",
7455 escape_essid(priv->essid, priv->essid_len), 7455 escape_ssid(priv->essid, priv->essid_len),
7456 priv->bssid); 7456 priv->bssid);
7457 7457
7458 return 0; 7458 return 0;
@@ -7604,8 +7604,8 @@ static int ipw_associate(void *data)
7604 target = oldest; 7604 target = oldest;
7605 IPW_DEBUG_ASSOC("Expired '%s' (%pM) from " 7605 IPW_DEBUG_ASSOC("Expired '%s' (%pM) from "
7606 "network list.\n", 7606 "network list.\n",
7607 escape_essid(target->ssid, 7607 escape_ssid(target->ssid,
7608 target->ssid_len), 7608 target->ssid_len),
7609 target->bssid); 7609 target->bssid);
7610 list_add_tail(&target->list, 7610 list_add_tail(&target->list,
7611 &priv->ieee->network_free_list); 7611 &priv->ieee->network_free_list);
@@ -9057,7 +9057,7 @@ static int ipw_wx_set_essid(struct net_device *dev,
9057 return 0; 9057 return 0;
9058 } 9058 }
9059 9059
9060 IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", escape_essid(extra, length), 9060 IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", escape_ssid(extra, length),
9061 length); 9061 length);
9062 9062
9063 priv->essid_len = length; 9063 priv->essid_len = length;
@@ -9084,7 +9084,7 @@ static int ipw_wx_get_essid(struct net_device *dev,
9084 if (priv->config & CFG_STATIC_ESSID || 9084 if (priv->config & CFG_STATIC_ESSID ||
9085 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { 9085 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) {
9086 IPW_DEBUG_WX("Getting essid: '%s'\n", 9086 IPW_DEBUG_WX("Getting essid: '%s'\n",
9087 escape_essid(priv->essid, priv->essid_len)); 9087 escape_ssid(priv->essid, priv->essid_len));
9088 memcpy(extra, priv->essid, priv->essid_len); 9088 memcpy(extra, priv->essid, priv->essid_len);
9089 wrqu->essid.length = priv->essid_len; 9089 wrqu->essid.length = priv->essid_len;
9090 wrqu->essid.flags = 1; /* active */ 9090 wrqu->essid.flags = 1; /* active */
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h
index 0bad1ec3e7e0..0a84d52147bd 100644
--- a/drivers/net/wireless/ipw2200.h
+++ b/drivers/net/wireless/ipw2200.h
@@ -48,6 +48,7 @@
48#include <linux/jiffies.h> 48#include <linux/jiffies.h>
49#include <asm/io.h> 49#include <asm/io.h>
50 50
51#include <net/lib80211.h>
51#include <net/ieee80211.h> 52#include <net/ieee80211.h>
52#include <net/ieee80211_radiotap.h> 53#include <net/ieee80211_radiotap.h>
53 54
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index b0ac0ce3fb9f..47bee0ee0a7c 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -4,6 +4,7 @@ config IWLWIFI
4config IWLCORE 4config IWLCORE
5 tristate "Intel Wireless Wifi Core" 5 tristate "Intel Wireless Wifi Core"
6 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL 6 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
7 select LIB80211
7 select IWLWIFI 8 select IWLWIFI
8 select MAC80211_LEDS if IWLWIFI_LEDS 9 select MAC80211_LEDS if IWLWIFI_LEDS
9 select LEDS_CLASS if IWLWIFI_LEDS 10 select LEDS_CLASS if IWLWIFI_LEDS
@@ -105,6 +106,7 @@ config IWL3945
105 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" 106 tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
106 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL 107 depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
107 select FW_LOADER 108 select FW_LOADER
109 select LIB80211
108 select IWLWIFI 110 select IWLWIFI
109 select MAC80211_LEDS if IWL3945_LEDS 111 select MAC80211_LEDS if IWL3945_LEDS
110 select LEDS_CLASS if IWL3945_LEDS 112 select LEDS_CLASS if IWL3945_LEDS
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 86b74571b513..1cc8aa592821 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -25,8 +25,10 @@
25 * Tomas Winkler <tomas.winkler@intel.com> 25 * Tomas Winkler <tomas.winkler@intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/ 27 *****************************************************************************/
28#include <net/mac80211.h> 28#include <linux/types.h>
29#include <linux/etherdevice.h> 29#include <linux/etherdevice.h>
30#include <net/lib80211.h>
31#include <net/mac80211.h>
30 32
31#include "iwl-eeprom.h" 33#include "iwl-eeprom.h"
32#include "iwl-dev.h" 34#include "iwl-dev.h"
@@ -64,48 +66,6 @@
64#define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) 66#define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
65 67
66 68
67static int iwl_is_empty_essid(const char *essid, int essid_len)
68{
69 /* Single white space is for Linksys APs */
70 if (essid_len == 1 && essid[0] == ' ')
71 return 1;
72
73 /* Otherwise, if the entire essid is 0, we assume it is hidden */
74 while (essid_len) {
75 essid_len--;
76 if (essid[essid_len] != '\0')
77 return 0;
78 }
79
80 return 1;
81}
82
83
84
85static const char *iwl_escape_essid(const char *essid, u8 essid_len)
86{
87 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
88 const char *s = essid;
89 char *d = escaped;
90
91 if (iwl_is_empty_essid(essid, essid_len)) {
92 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
93 return escaped;
94 }
95
96 essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE);
97 while (essid_len--) {
98 if (*s == '\0') {
99 *d++ = '\\';
100 *d++ = '0';
101 s++;
102 } else
103 *d++ = *s++;
104 }
105 *d = '\0';
106 return escaped;
107}
108
109/** 69/**
110 * iwl_scan_cancel - Cancel any currently executing HW scan 70 * iwl_scan_cancel - Cancel any currently executing HW scan
111 * 71 *
@@ -775,8 +735,8 @@ static void iwl_bg_request_scan(struct work_struct *data)
775 /* We should add the ability for user to lock to PASSIVE ONLY */ 735 /* We should add the ability for user to lock to PASSIVE ONLY */
776 if (priv->one_direct_scan) { 736 if (priv->one_direct_scan) {
777 IWL_DEBUG_SCAN("Start direct scan for '%s'\n", 737 IWL_DEBUG_SCAN("Start direct scan for '%s'\n",
778 iwl_escape_essid(priv->direct_ssid, 738 escape_ssid(priv->direct_ssid,
779 priv->direct_ssid_len)); 739 priv->direct_ssid_len));
780 scan->direct_scan[0].id = WLAN_EID_SSID; 740 scan->direct_scan[0].id = WLAN_EID_SSID;
781 scan->direct_scan[0].len = priv->direct_ssid_len; 741 scan->direct_scan[0].len = priv->direct_ssid_len;
782 memcpy(scan->direct_scan[0].ssid, 742 memcpy(scan->direct_scan[0].ssid,
@@ -784,7 +744,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
784 n_probes++; 744 n_probes++;
785 } else if (!iwl_is_associated(priv) && priv->essid_len) { 745 } else if (!iwl_is_associated(priv) && priv->essid_len) {
786 IWL_DEBUG_SCAN("Start direct scan for '%s' (not associated)\n", 746 IWL_DEBUG_SCAN("Start direct scan for '%s' (not associated)\n",
787 iwl_escape_essid(priv->essid, priv->essid_len)); 747 escape_ssid(priv->essid, priv->essid_len));
788 scan->direct_scan[0].id = WLAN_EID_SSID; 748 scan->direct_scan[0].id = WLAN_EID_SSID;
789 scan->direct_scan[0].len = priv->essid_len; 749 scan->direct_scan[0].len = priv->essid_len;
790 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 750 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 2cd33b4e9e13..370cc46b4888 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -41,6 +41,7 @@
41#include <linux/if_arp.h> 41#include <linux/if_arp.h>
42 42
43#include <net/ieee80211_radiotap.h> 43#include <net/ieee80211_radiotap.h>
44#include <net/lib80211.h>
44#include <net/mac80211.h> 45#include <net/mac80211.h>
45 46
46#include <asm/div64.h> 47#include <asm/div64.h>
@@ -107,46 +108,6 @@ static const struct ieee80211_supported_band *iwl3945_get_band(
107 return priv->hw->wiphy->bands[band]; 108 return priv->hw->wiphy->bands[band];
108} 109}
109 110
110static int iwl3945_is_empty_essid(const char *essid, int essid_len)
111{
112 /* Single white space is for Linksys APs */
113 if (essid_len == 1 && essid[0] == ' ')
114 return 1;
115
116 /* Otherwise, if the entire essid is 0, we assume it is hidden */
117 while (essid_len) {
118 essid_len--;
119 if (essid[essid_len] != '\0')
120 return 0;
121 }
122
123 return 1;
124}
125
126static const char *iwl3945_escape_essid(const char *essid, u8 essid_len)
127{
128 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
129 const char *s = essid;
130 char *d = escaped;
131
132 if (iwl3945_is_empty_essid(essid, essid_len)) {
133 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
134 return escaped;
135 }
136
137 essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE);
138 while (essid_len--) {
139 if (*s == '\0') {
140 *d++ = '\\';
141 *d++ = '0';
142 s++;
143 } else
144 *d++ = *s++;
145 }
146 *d = '\0';
147 return escaped;
148}
149
150/*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** 111/*************** DMA-QUEUE-GENERAL-FUNCTIONS *****
151 * DMA services 112 * DMA services
152 * 113 *
@@ -6193,8 +6154,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6193 if (priv->one_direct_scan) { 6154 if (priv->one_direct_scan) {
6194 IWL_DEBUG_SCAN 6155 IWL_DEBUG_SCAN
6195 ("Kicking off one direct scan for '%s'\n", 6156 ("Kicking off one direct scan for '%s'\n",
6196 iwl3945_escape_essid(priv->direct_ssid, 6157 escape_ssid(priv->direct_ssid, priv->direct_ssid_len));
6197 priv->direct_ssid_len));
6198 scan->direct_scan[0].id = WLAN_EID_SSID; 6158 scan->direct_scan[0].id = WLAN_EID_SSID;
6199 scan->direct_scan[0].len = priv->direct_ssid_len; 6159 scan->direct_scan[0].len = priv->direct_ssid_len;
6200 memcpy(scan->direct_scan[0].ssid, 6160 memcpy(scan->direct_scan[0].ssid,
@@ -6203,7 +6163,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6203 } else if (!iwl3945_is_associated(priv) && priv->essid_len) { 6163 } else if (!iwl3945_is_associated(priv) && priv->essid_len) {
6204 IWL_DEBUG_SCAN 6164 IWL_DEBUG_SCAN
6205 ("Kicking off one direct scan for '%s' when not associated\n", 6165 ("Kicking off one direct scan for '%s' when not associated\n",
6206 iwl3945_escape_essid(priv->essid, priv->essid_len)); 6166 escape_ssid(priv->essid, priv->essid_len));
6207 scan->direct_scan[0].id = WLAN_EID_SSID; 6167 scan->direct_scan[0].id = WLAN_EID_SSID;
6208 scan->direct_scan[0].len = priv->essid_len; 6168 scan->direct_scan[0].len = priv->essid_len;
6209 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 6169 memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
@@ -7018,7 +6978,7 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
7018 } 6978 }
7019 if (len) { 6979 if (len) {
7020 IWL_DEBUG_SCAN("direct scan for %s [%d]\n ", 6980 IWL_DEBUG_SCAN("direct scan for %s [%d]\n ",
7021 iwl3945_escape_essid(ssid, len), (int)len); 6981 escape_ssid(ssid, len), (int)len);
7022 6982
7023 priv->one_direct_scan = 1; 6983 priv->one_direct_scan = 1;
7024 priv->direct_ssid_len = (u8) 6984 priv->direct_ssid_len = (u8)
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:
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 93a56de3594b..dec10c41e2ec 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -127,10 +127,6 @@ static inline bool ieee80211_ratelimit_debug(u32 level)
127} 127}
128#endif /* CONFIG_IEEE80211_DEBUG */ 128#endif /* CONFIG_IEEE80211_DEBUG */
129 129
130/* escape_essid() is intended to be used in debug (and possibly error)
131 * messages. It should never be used for passing essid to user space. */
132const char *escape_essid(const char *essid, u8 essid_len);
133
134/* 130/*
135 * To use the debug system: 131 * To use the debug system:
136 * 132 *
@@ -1135,22 +1131,6 @@ static inline void *ieee80211_priv(struct net_device *dev)
1135 return ((struct ieee80211_device *)netdev_priv(dev))->priv; 1131 return ((struct ieee80211_device *)netdev_priv(dev))->priv;
1136} 1132}
1137 1133
1138static inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
1139{
1140 /* Single white space is for Linksys APs */
1141 if (essid_len == 1 && essid[0] == ' ')
1142 return 1;
1143
1144 /* Otherwise, if the entire essid is 0, we assume it is hidden */
1145 while (essid_len) {
1146 essid_len--;
1147 if (essid[essid_len] != '\0')
1148 return 0;
1149 }
1150
1151 return 1;
1152}
1153
1154static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, 1134static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
1155 int mode) 1135 int mode)
1156{ 1136{
diff --git a/include/net/lib80211.h b/include/net/lib80211.h
new file mode 100644
index 000000000000..91a64f358cef
--- /dev/null
+++ b/include/net/lib80211.h
@@ -0,0 +1,31 @@
1/*
2 * lib80211.h -- common bits for IEEE802.11 wireless drivers
3 *
4 * Copyright (c) 2008, John W. Linville <linville@tuxdriver.com>
5 *
6 */
7
8#ifndef LIB80211_H
9#define LIB80211_H
10
11/* escape_ssid() is intended to be used in debug (and possibly error)
12 * messages. It should never be used for passing ssid to user space. */
13const char *escape_ssid(const char *ssid, u8 ssid_len);
14
15static inline int is_empty_ssid(const char *ssid, int ssid_len)
16{
17 /* Single white space is for Linksys APs */
18 if (ssid_len == 1 && ssid[0] == ' ')
19 return 1;
20
21 /* Otherwise, if the entire ssid is 0, we assume it is hidden */
22 while (ssid_len) {
23 ssid_len--;
24 if (ssid[ssid_len] != '\0')
25 return 0;
26 }
27
28 return 1;
29}
30
31#endif /* LIB80211_H */
diff --git a/net/ieee80211/Kconfig b/net/ieee80211/Kconfig
index df9624c3cebf..d2282bb2e4f1 100644
--- a/net/ieee80211/Kconfig
+++ b/net/ieee80211/Kconfig
@@ -11,6 +11,7 @@ config IEEE80211
11 select IEEE80211_CRYPT_WEP 11 select IEEE80211_CRYPT_WEP
12 select IEEE80211_CRYPT_TKIP 12 select IEEE80211_CRYPT_TKIP
13 select IEEE80211_CRYPT_CCMP 13 select IEEE80211_CRYPT_CCMP
14 select LIB80211
14 ---help--- 15 ---help---
15 This option enables the hardware independent IEEE 802.11 16 This option enables the hardware independent IEEE 802.11
16 networking stack. This component is deprecated in favor of the 17 networking stack. This component is deprecated in favor of the
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c
index 949772a5a7dc..d34d4e79b6f7 100644
--- a/net/ieee80211/ieee80211_module.c
+++ b/net/ieee80211/ieee80211_module.c
@@ -308,31 +308,5 @@ MODULE_PARM_DESC(debug, "debug output mask");
308module_exit(ieee80211_exit); 308module_exit(ieee80211_exit);
309module_init(ieee80211_init); 309module_init(ieee80211_init);
310 310
311const char *escape_essid(const char *essid, u8 essid_len)
312{
313 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
314 const char *s = essid;
315 char *d = escaped;
316
317 if (ieee80211_is_empty_essid(essid, essid_len)) {
318 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
319 return escaped;
320 }
321
322 essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE);
323 while (essid_len--) {
324 if (*s == '\0') {
325 *d++ = '\\';
326 *d++ = '0';
327 s++;
328 } else {
329 *d++ = *s++;
330 }
331 }
332 *d = '\0';
333 return escaped;
334}
335
336EXPORT_SYMBOL(alloc_ieee80211); 311EXPORT_SYMBOL(alloc_ieee80211);
337EXPORT_SYMBOL(free_ieee80211); 312EXPORT_SYMBOL(free_ieee80211);
338EXPORT_SYMBOL(escape_essid);
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index 281223e41c58..876a004918b0 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -32,6 +32,7 @@
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <linux/ctype.h> 33#include <linux/ctype.h>
34 34
35#include <net/lib80211.h>
35#include <net/ieee80211.h> 36#include <net/ieee80211.h>
36 37
37static void ieee80211_monitor_rx(struct ieee80211_device *ieee, 38static void ieee80211_monitor_rx(struct ieee80211_device *ieee,
@@ -1145,8 +1146,8 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element
1145 1146
1146 switch (info_element->id) { 1147 switch (info_element->id) {
1147 case MFIE_TYPE_SSID: 1148 case MFIE_TYPE_SSID:
1148 if (ieee80211_is_empty_essid(info_element->data, 1149 if (is_empty_ssid(info_element->data,
1149 info_element->len)) { 1150 info_element->len)) {
1150 network->flags |= NETWORK_EMPTY_ESSID; 1151 network->flags |= NETWORK_EMPTY_ESSID;
1151 break; 1152 break;
1152 } 1153 }
@@ -1390,7 +1391,7 @@ static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee
1390 network->mode |= IEEE_B; 1391 network->mode |= IEEE_B;
1391 } 1392 }
1392 1393
1393 if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) 1394 if (is_empty_ssid(network->ssid, network->ssid_len))
1394 network->flags |= NETWORK_EMPTY_ESSID; 1395 network->flags |= NETWORK_EMPTY_ESSID;
1395 1396
1396 memcpy(&network->stats, stats, sizeof(network->stats)); 1397 memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1456,13 +1457,13 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021
1456 if (network->mode == 0) { 1457 if (network->mode == 0) {
1457 IEEE80211_DEBUG_SCAN("Filtered out '%s (%pM)' " 1458 IEEE80211_DEBUG_SCAN("Filtered out '%s (%pM)' "
1458 "network.\n", 1459 "network.\n",
1459 escape_essid(network->ssid, 1460 escape_ssid(network->ssid,
1460 network->ssid_len), 1461 network->ssid_len),
1461 network->bssid); 1462 network->bssid);
1462 return 1; 1463 return 1;
1463 } 1464 }
1464 1465
1465 if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) 1466 if (is_empty_ssid(network->ssid, network->ssid_len))
1466 network->flags |= NETWORK_EMPTY_ESSID; 1467 network->flags |= NETWORK_EMPTY_ESSID;
1467 1468
1468 memcpy(&network->stats, stats, sizeof(network->stats)); 1469 memcpy(&network->stats, stats, sizeof(network->stats));
@@ -1576,7 +1577,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1576 1577
1577 IEEE80211_DEBUG_SCAN("'%s' (%pM" 1578 IEEE80211_DEBUG_SCAN("'%s' (%pM"
1578 "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", 1579 "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n",
1579 escape_essid(info_element->data, info_element->len), 1580 escape_ssid(info_element->data, info_element->len),
1580 beacon->header.addr3, 1581 beacon->header.addr3,
1581 (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0', 1582 (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0',
1582 (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0', 1583 (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0',
@@ -1597,8 +1598,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1597 1598
1598 if (ieee80211_network_init(ieee, beacon, &network, stats)) { 1599 if (ieee80211_network_init(ieee, beacon, &network, stats)) {
1599 IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n", 1600 IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n",
1600 escape_essid(info_element->data, 1601 escape_ssid(info_element->data,
1601 info_element->len), 1602 info_element->len),
1602 beacon->header.addr3, 1603 beacon->header.addr3,
1603 is_beacon(beacon->header.frame_ctl) ? 1604 is_beacon(beacon->header.frame_ctl) ?
1604 "BEACON" : "PROBE RESPONSE"); 1605 "BEACON" : "PROBE RESPONSE");
@@ -1635,8 +1636,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1635 target = oldest; 1636 target = oldest;
1636 IEEE80211_DEBUG_SCAN("Expired '%s' (%pM) from " 1637 IEEE80211_DEBUG_SCAN("Expired '%s' (%pM) from "
1637 "network list.\n", 1638 "network list.\n",
1638 escape_essid(target->ssid, 1639 escape_ssid(target->ssid,
1639 target->ssid_len), 1640 target->ssid_len),
1640 target->bssid); 1641 target->bssid);
1641 ieee80211_network_reset(target); 1642 ieee80211_network_reset(target);
1642 } else { 1643 } else {
@@ -1648,8 +1649,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1648 1649
1649#ifdef CONFIG_IEEE80211_DEBUG 1650#ifdef CONFIG_IEEE80211_DEBUG
1650 IEEE80211_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n", 1651 IEEE80211_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n",
1651 escape_essid(network.ssid, 1652 escape_ssid(network.ssid,
1652 network.ssid_len), 1653 network.ssid_len),
1653 network.bssid, 1654 network.bssid,
1654 is_beacon(beacon->header.frame_ctl) ? 1655 is_beacon(beacon->header.frame_ctl) ?
1655 "BEACON" : "PROBE RESPONSE"); 1656 "BEACON" : "PROBE RESPONSE");
@@ -1659,8 +1660,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1659 list_add_tail(&target->list, &ieee->network_list); 1660 list_add_tail(&target->list, &ieee->network_list);
1660 } else { 1661 } else {
1661 IEEE80211_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n", 1662 IEEE80211_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n",
1662 escape_essid(target->ssid, 1663 escape_ssid(target->ssid,
1663 target->ssid_len), 1664 target->ssid_len),
1664 target->bssid, 1665 target->bssid,
1665 is_beacon(beacon->header.frame_ctl) ? 1666 is_beacon(beacon->header.frame_ctl) ?
1666 "BEACON" : "PROBE RESPONSE"); 1667 "BEACON" : "PROBE RESPONSE");
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c
index 89a81062ab4b..3b031c2910ac 100644
--- a/net/ieee80211/ieee80211_wx.c
+++ b/net/ieee80211/ieee80211_wx.c
@@ -283,8 +283,8 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
283 else 283 else
284 IEEE80211_DEBUG_SCAN("Not showing network '%s (" 284 IEEE80211_DEBUG_SCAN("Not showing network '%s ("
285 "%pM)' due to age (%dms).\n", 285 "%pM)' due to age (%dms).\n",
286 escape_essid(network->ssid, 286 escape_ssid(network->ssid,
287 network->ssid_len), 287 network->ssid_len),
288 network->bssid, 288 network->bssid,
289 jiffies_to_msecs(jiffies - 289 jiffies_to_msecs(jiffies -
290 network-> 290 network->
@@ -408,7 +408,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
408 memset(sec.keys[key] + erq->length, 0, 408 memset(sec.keys[key] + erq->length, 0,
409 len - erq->length); 409 len - erq->length);
410 IEEE80211_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n", 410 IEEE80211_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n",
411 key, escape_essid(sec.keys[key], len), 411 key, escape_ssid(sec.keys[key], len),
412 erq->length, len); 412 erq->length, len);
413 sec.key_sizes[key] = len; 413 sec.key_sizes[key] = len;
414 if (*crypt) 414 if (*crypt)
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
76config 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 @@
1obj-$(CONFIG_WIRELESS_EXT) += wext.o 1obj-$(CONFIG_WIRELESS_EXT) += wext.o
2obj-$(CONFIG_CFG80211) += cfg80211.o 2obj-$(CONFIG_CFG80211) += cfg80211.o
3obj-$(CONFIG_LIB80211) += lib80211.o
3 4
4cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o 5cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o
5cfg80211-$(CONFIG_NL80211) += nl80211.o 6cfg80211-$(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
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);