提交 7e272fcf 编写于 作者: J John W. Linville

wireless: consolidate on a single escape_essid implementation

Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 ddf4ac53
...@@ -271,6 +271,7 @@ config LIBERTAS ...@@ -271,6 +271,7 @@ config LIBERTAS
tristate "Marvell 8xxx Libertas WLAN driver support" tristate "Marvell 8xxx Libertas WLAN driver support"
depends on WLAN_80211 depends on WLAN_80211
select WIRELESS_EXT select WIRELESS_EXT
select LIB80211
select FW_LOADER select FW_LOADER
---help--- ---help---
A library for Marvell Libertas 8xxx devices. A library for Marvell Libertas 8xxx devices.
......
...@@ -1975,7 +1975,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) ...@@ -1975,7 +1975,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
} }
IPW_DEBUG_INFO("%s: Associated with '%s' at %s, channel %d (BSSID=%pM)\n", IPW_DEBUG_INFO("%s: Associated with '%s' at %s, channel %d (BSSID=%pM)\n",
priv->net_dev->name, escape_essid(essid, essid_len), priv->net_dev->name, escape_ssid(essid, essid_len),
txratename, chan, bssid); txratename, chan, bssid);
/* now we copy read ssid into dev */ /* now we copy read ssid into dev */
...@@ -2003,7 +2003,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, ...@@ -2003,7 +2003,7 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
}; };
int err; int err;
IPW_DEBUG_HC("SSID: '%s'\n", escape_essid(essid, ssid_len)); IPW_DEBUG_HC("SSID: '%s'\n", escape_ssid(essid, ssid_len));
if (ssid_len) if (ssid_len)
memcpy(cmd.host_command_parameters, essid, ssid_len); 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,7 +2046,7 @@ static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status)
{ {
IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC, IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC,
"disassociated: '%s' %pM \n", "disassociated: '%s' %pM \n",
escape_essid(priv->essid, priv->essid_len), escape_ssid(priv->essid, priv->essid_len),
priv->bssid); priv->bssid);
priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING);
...@@ -6987,7 +6987,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, ...@@ -6987,7 +6987,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev,
goto done; goto done;
} }
IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", escape_essid(essid, length), IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", escape_ssid(essid, length),
length); length);
priv->essid_len = length; priv->essid_len = length;
...@@ -7014,7 +7014,7 @@ static int ipw2100_wx_get_essid(struct net_device *dev, ...@@ -7014,7 +7014,7 @@ static int ipw2100_wx_get_essid(struct net_device *dev,
* configured ESSID then return that; otherwise return ANY */ * configured ESSID then return that; otherwise return ANY */
if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) { if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) {
IPW_DEBUG_WX("Getting essid: '%s'\n", IPW_DEBUG_WX("Getting essid: '%s'\n",
escape_essid(priv->essid, priv->essid_len)); escape_ssid(priv->essid, priv->essid_len));
memcpy(extra, priv->essid, priv->essid_len); memcpy(extra, priv->essid, priv->essid_len);
wrqu->essid.length = priv->essid_len; wrqu->essid.length = priv->essid_len;
wrqu->essid.flags = 1; /* active */ wrqu->essid.flags = 1; /* active */
......
...@@ -4409,8 +4409,8 @@ static void ipw_rx_notification(struct ipw_priv *priv, ...@@ -4409,8 +4409,8 @@ static void ipw_rx_notification(struct ipw_priv *priv,
IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
IPW_DL_ASSOC, IPW_DL_ASSOC,
"associated: '%s' %pM \n", "associated: '%s' %pM \n",
escape_essid(priv->essid, escape_ssid(priv->essid,
priv->essid_len), priv->essid_len),
priv->bssid); priv->bssid);
switch (priv->ieee->iw_mode) { switch (priv->ieee->iw_mode) {
...@@ -4490,10 +4490,10 @@ static void ipw_rx_notification(struct ipw_priv *priv, ...@@ -4490,10 +4490,10 @@ static void ipw_rx_notification(struct ipw_priv *priv,
"deauthenticated: '%s' " "deauthenticated: '%s' "
"%pM" "%pM"
": (0x%04X) - %s \n", ": (0x%04X) - %s \n",
escape_essid(priv-> escape_ssid(priv->
essid, essid,
priv-> priv->
essid_len), essid_len),
priv->bssid, priv->bssid,
le16_to_cpu(auth->status), le16_to_cpu(auth->status),
ipw_get_status_code ipw_get_status_code
...@@ -4512,7 +4512,7 @@ static void ipw_rx_notification(struct ipw_priv *priv, ...@@ -4512,7 +4512,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
IPW_DL_ASSOC, IPW_DL_ASSOC,
"authenticated: '%s' %pM\n", "authenticated: '%s' %pM\n",
escape_essid(priv->essid, escape_ssid(priv->essid,
priv->essid_len), priv->essid_len),
priv->bssid); priv->bssid);
break; break;
...@@ -4540,7 +4540,7 @@ static void ipw_rx_notification(struct ipw_priv *priv, ...@@ -4540,7 +4540,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
IPW_DL_ASSOC, IPW_DL_ASSOC,
"disassociated: '%s' %pM \n", "disassociated: '%s' %pM \n",
escape_essid(priv->essid, escape_ssid(priv->essid,
priv->essid_len), priv->essid_len),
priv->bssid); priv->bssid);
...@@ -4578,7 +4578,7 @@ static void ipw_rx_notification(struct ipw_priv *priv, ...@@ -4578,7 +4578,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
case CMAS_AUTHENTICATED: case CMAS_AUTHENTICATED:
IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE,
"authenticated: '%s' %pM \n", "authenticated: '%s' %pM \n",
escape_essid(priv->essid, escape_ssid(priv->essid,
priv->essid_len), priv->essid_len),
priv->bssid); priv->bssid);
priv->status |= STATUS_AUTH; priv->status |= STATUS_AUTH;
...@@ -4597,8 +4597,8 @@ static void ipw_rx_notification(struct ipw_priv *priv, ...@@ -4597,8 +4597,8 @@ static void ipw_rx_notification(struct ipw_priv *priv,
IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
IPW_DL_ASSOC, IPW_DL_ASSOC,
"deauthenticated: '%s' %pM\n", "deauthenticated: '%s' %pM\n",
escape_essid(priv->essid, escape_ssid(priv->essid,
priv->essid_len), priv->essid_len),
priv->bssid); priv->bssid);
priv->status &= ~(STATUS_ASSOCIATING | priv->status &= ~(STATUS_ASSOCIATING |
...@@ -5430,7 +5430,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5430,7 +5430,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
!(network->capability & WLAN_CAPABILITY_IBSS))) { !(network->capability & WLAN_CAPABILITY_IBSS))) {
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded due to " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded due to "
"capability mismatch.\n", "capability mismatch.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5440,7 +5440,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5440,7 +5440,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
if (network->flags & NETWORK_EMPTY_ESSID) { if (network->flags & NETWORK_EMPTY_ESSID) {
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
"because of hidden ESSID.\n", "because of hidden ESSID.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5453,8 +5453,8 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5453,8 +5453,8 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
network->ssid_len)) { network->ssid_len)) {
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
"because of non-network ESSID.\n", "because of non-network ESSID.\n",
escape_essid(network->ssid, escape_ssid(network->ssid,
network->ssid_len), network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5468,13 +5468,13 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5468,13 +5468,13 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
strncpy(escaped, strncpy(escaped,
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
sizeof(escaped)); sizeof(escaped));
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
"because of ESSID mismatch: '%s'.\n", "because of ESSID mismatch: '%s'.\n",
escaped, network->bssid, escaped, network->bssid,
escape_essid(priv->essid, escape_ssid(priv->essid,
priv->essid_len)); priv->essid_len));
return 0; return 0;
} }
} }
...@@ -5485,14 +5485,14 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5485,14 +5485,14 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
if (network->time_stamp[0] < match->network->time_stamp[0]) { if (network->time_stamp[0] < match->network->time_stamp[0]) {
IPW_DEBUG_MERGE("Network '%s excluded because newer than " IPW_DEBUG_MERGE("Network '%s excluded because newer than "
"current network.\n", "current network.\n",
escape_essid(match->network->ssid, escape_ssid(match->network->ssid,
match->network->ssid_len)); match->network->ssid_len));
return 0; return 0;
} else if (network->time_stamp[1] < match->network->time_stamp[1]) { } else if (network->time_stamp[1] < match->network->time_stamp[1]) {
IPW_DEBUG_MERGE("Network '%s excluded because newer than " IPW_DEBUG_MERGE("Network '%s excluded because newer than "
"current network.\n", "current network.\n",
escape_essid(match->network->ssid, escape_ssid(match->network->ssid,
match->network->ssid_len)); match->network->ssid_len));
return 0; return 0;
} }
...@@ -5501,7 +5501,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5501,7 +5501,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) {
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
"because of age: %ums.\n", "because of age: %ums.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid, network->bssid,
jiffies_to_msecs(jiffies - jiffies_to_msecs(jiffies -
network->last_scanned)); network->last_scanned));
...@@ -5512,7 +5512,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5512,7 +5512,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
(network->channel != priv->channel)) { (network->channel != priv->channel)) {
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
"because of channel mismatch: %d != %d.\n", "because of channel mismatch: %d != %d.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid, network->bssid,
network->channel, priv->channel); network->channel, priv->channel);
return 0; return 0;
...@@ -5523,7 +5523,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5523,7 +5523,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) {
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
"because of privacy mismatch: %s != %s.\n", "because of privacy mismatch: %s != %s.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid, network->bssid,
priv-> priv->
capability & CAP_PRIVACY_ON ? "on" : "off", capability & CAP_PRIVACY_ON ? "on" : "off",
...@@ -5536,8 +5536,8 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5536,8 +5536,8 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) { if (!memcmp(network->bssid, priv->bssid, ETH_ALEN)) {
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
"because of the same BSSID match: %pM" "because of the same BSSID match: %pM"
".\n", escape_essid(network->ssid, ".\n", escape_ssid(network->ssid,
network->ssid_len), network->ssid_len),
network->bssid, network->bssid,
priv->bssid); priv->bssid);
return 0; return 0;
...@@ -5548,7 +5548,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5548,7 +5548,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
"because of invalid frequency/mode " "because of invalid frequency/mode "
"combination.\n", "combination.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5559,7 +5559,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5559,7 +5559,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
"because configured rate mask excludes " "because configured rate mask excludes "
"AP mandatory rate.\n", "AP mandatory rate.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5567,7 +5567,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5567,7 +5567,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
if (rates.num_rates == 0) { if (rates.num_rates == 0) {
IPW_DEBUG_MERGE("Network '%s (%pM)' excluded " IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
"because of no compatible rates.\n", "because of no compatible rates.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5580,7 +5580,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, ...@@ -5580,7 +5580,7 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv,
ipw_copy_rates(&match->rates, &rates); ipw_copy_rates(&match->rates, &rates);
match->network = network; match->network = network;
IPW_DEBUG_MERGE("Network '%s (%pM)' is a viable match.\n", IPW_DEBUG_MERGE("Network '%s (%pM)' is a viable match.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 1; return 1;
...@@ -5618,8 +5618,8 @@ static void ipw_merge_adhoc_network(struct work_struct *work) ...@@ -5618,8 +5618,8 @@ static void ipw_merge_adhoc_network(struct work_struct *work)
mutex_lock(&priv->mutex); mutex_lock(&priv->mutex);
if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) { if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) {
IPW_DEBUG_MERGE("remove network %s\n", IPW_DEBUG_MERGE("remove network %s\n",
escape_essid(priv->essid, escape_ssid(priv->essid,
priv->essid_len)); priv->essid_len));
ipw_remove_current_network(priv); ipw_remove_current_network(priv);
} }
...@@ -5644,7 +5644,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5644,7 +5644,7 @@ static int ipw_best_network(struct ipw_priv *priv,
!(network->capability & WLAN_CAPABILITY_IBSS))) { !(network->capability & WLAN_CAPABILITY_IBSS))) {
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded due to " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded due to "
"capability mismatch.\n", "capability mismatch.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5654,7 +5654,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5654,7 +5654,7 @@ static int ipw_best_network(struct ipw_priv *priv,
if (network->flags & NETWORK_EMPTY_ESSID) { if (network->flags & NETWORK_EMPTY_ESSID) {
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of hidden ESSID.\n", "because of hidden ESSID.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5667,7 +5667,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5667,7 +5667,7 @@ static int ipw_best_network(struct ipw_priv *priv,
network->ssid_len)) { network->ssid_len)) {
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of non-network ESSID.\n", "because of non-network ESSID.\n",
escape_essid(network->ssid, escape_ssid(network->ssid,
network->ssid_len), network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
...@@ -5681,13 +5681,13 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5681,13 +5681,13 @@ static int ipw_best_network(struct ipw_priv *priv,
min(network->ssid_len, priv->essid_len)))) { min(network->ssid_len, priv->essid_len)))) {
char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
strncpy(escaped, strncpy(escaped,
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
sizeof(escaped)); sizeof(escaped));
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of ESSID mismatch: '%s'.\n", "because of ESSID mismatch: '%s'.\n",
escaped, network->bssid, escaped, network->bssid,
escape_essid(priv->essid, escape_ssid(priv->essid,
priv->essid_len)); priv->essid_len));
return 0; return 0;
} }
} }
...@@ -5697,13 +5697,13 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5697,13 +5697,13 @@ static int ipw_best_network(struct ipw_priv *priv,
if (match->network && match->network->stats.rssi > network->stats.rssi) { if (match->network && match->network->stats.rssi > network->stats.rssi) {
char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
strncpy(escaped, strncpy(escaped,
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
sizeof(escaped)); sizeof(escaped));
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded because " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded because "
"'%s (%pM)' has a stronger signal.\n", "'%s (%pM)' has a stronger signal.\n",
escaped, network->bssid, escaped, network->bssid,
escape_essid(match->network->ssid, escape_ssid(match->network->ssid,
match->network->ssid_len), match->network->ssid_len),
match->network->bssid); match->network->bssid);
return 0; return 0;
} }
...@@ -5715,7 +5715,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5715,7 +5715,7 @@ static int ipw_best_network(struct ipw_priv *priv,
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of storming (%ums since last " "because of storming (%ums since last "
"assoc attempt).\n", "assoc attempt).\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid, network->bssid,
jiffies_to_msecs(jiffies - jiffies_to_msecs(jiffies -
network->last_associate)); network->last_associate));
...@@ -5727,7 +5727,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5727,7 +5727,7 @@ static int ipw_best_network(struct ipw_priv *priv,
time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) { time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) {
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of age: %ums.\n", "because of age: %ums.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid, network->bssid,
jiffies_to_msecs(jiffies - jiffies_to_msecs(jiffies -
network->last_scanned)); network->last_scanned));
...@@ -5738,7 +5738,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5738,7 +5738,7 @@ static int ipw_best_network(struct ipw_priv *priv,
(network->channel != priv->channel)) { (network->channel != priv->channel)) {
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of channel mismatch: %d != %d.\n", "because of channel mismatch: %d != %d.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid, network->bssid,
network->channel, priv->channel); network->channel, priv->channel);
return 0; return 0;
...@@ -5749,7 +5749,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5749,7 +5749,7 @@ static int ipw_best_network(struct ipw_priv *priv,
((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) { ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) {
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of privacy mismatch: %s != %s.\n", "because of privacy mismatch: %s != %s.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid, network->bssid,
priv->capability & CAP_PRIVACY_ON ? "on" : priv->capability & CAP_PRIVACY_ON ? "on" :
"off", "off",
...@@ -5762,7 +5762,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5762,7 +5762,7 @@ static int ipw_best_network(struct ipw_priv *priv,
memcmp(network->bssid, priv->bssid, ETH_ALEN)) { memcmp(network->bssid, priv->bssid, ETH_ALEN)) {
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of BSSID mismatch: %pM.\n", "because of BSSID mismatch: %pM.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid, priv->bssid); network->bssid, priv->bssid);
return 0; return 0;
} }
...@@ -5772,7 +5772,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5772,7 +5772,7 @@ static int ipw_best_network(struct ipw_priv *priv,
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of invalid frequency/mode " "because of invalid frequency/mode "
"combination.\n", "combination.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5781,7 +5781,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5781,7 +5781,7 @@ static int ipw_best_network(struct ipw_priv *priv,
if (!ieee80211_is_valid_channel(priv->ieee, network->channel)) { if (!ieee80211_is_valid_channel(priv->ieee, network->channel)) {
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of invalid channel in current GEO\n", "because of invalid channel in current GEO\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5792,7 +5792,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5792,7 +5792,7 @@ static int ipw_best_network(struct ipw_priv *priv,
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because configured rate mask excludes " "because configured rate mask excludes "
"AP mandatory rate.\n", "AP mandatory rate.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5800,7 +5800,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5800,7 +5800,7 @@ static int ipw_best_network(struct ipw_priv *priv,
if (rates.num_rates == 0) { if (rates.num_rates == 0) {
IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded " IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
"because of no compatible rates.\n", "because of no compatible rates.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 0; return 0;
} }
...@@ -5814,7 +5814,7 @@ static int ipw_best_network(struct ipw_priv *priv, ...@@ -5814,7 +5814,7 @@ static int ipw_best_network(struct ipw_priv *priv,
match->network = network; match->network = network;
IPW_DEBUG_ASSOC("Network '%s (%pM)' is a viable match.\n", IPW_DEBUG_ASSOC("Network '%s (%pM)' is a viable match.\n",
escape_essid(network->ssid, network->ssid_len), escape_ssid(network->ssid, network->ssid_len),
network->bssid); network->bssid);
return 1; return 1;
...@@ -6065,7 +6065,7 @@ static void ipw_debug_config(struct ipw_priv *priv) ...@@ -6065,7 +6065,7 @@ static void ipw_debug_config(struct ipw_priv *priv)
IPW_DEBUG_INFO("Channel unlocked.\n"); IPW_DEBUG_INFO("Channel unlocked.\n");
if (priv->config & CFG_STATIC_ESSID) if (priv->config & CFG_STATIC_ESSID)
IPW_DEBUG_INFO("ESSID locked to '%s'\n", IPW_DEBUG_INFO("ESSID locked to '%s'\n",
escape_essid(priv->essid, priv->essid_len)); escape_ssid(priv->essid, priv->essid_len));
else else
IPW_DEBUG_INFO("ESSID unlocked.\n"); IPW_DEBUG_INFO("ESSID unlocked.\n");
if (priv->config & CFG_STATIC_BSSID) if (priv->config & CFG_STATIC_BSSID)
...@@ -7352,7 +7352,7 @@ static int ipw_associate_network(struct ipw_priv *priv, ...@@ -7352,7 +7352,7 @@ static int ipw_associate_network(struct ipw_priv *priv,
IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, " IPW_DEBUG_ASSOC("%sssocation attempt: '%s', channel %d, "
"802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n", "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n",
roaming ? "Rea" : "A", roaming ? "Rea" : "A",
escape_essid(priv->essid, priv->essid_len), escape_ssid(priv->essid, priv->essid_len),
network->channel, network->channel,
ipw_modes[priv->assoc_request.ieee_mode], ipw_modes[priv->assoc_request.ieee_mode],
rates->num_rates, rates->num_rates,
...@@ -7452,7 +7452,7 @@ static int ipw_associate_network(struct ipw_priv *priv, ...@@ -7452,7 +7452,7 @@ static int ipw_associate_network(struct ipw_priv *priv,
} }
IPW_DEBUG(IPW_DL_STATE, "associating: '%s' %pM \n", IPW_DEBUG(IPW_DL_STATE, "associating: '%s' %pM \n",
escape_essid(priv->essid, priv->essid_len), escape_ssid(priv->essid, priv->essid_len),
priv->bssid); priv->bssid);
return 0; return 0;
...@@ -7604,8 +7604,8 @@ static int ipw_associate(void *data) ...@@ -7604,8 +7604,8 @@ static int ipw_associate(void *data)
target = oldest; target = oldest;
IPW_DEBUG_ASSOC("Expired '%s' (%pM) from " IPW_DEBUG_ASSOC("Expired '%s' (%pM) from "
"network list.\n", "network list.\n",
escape_essid(target->ssid, escape_ssid(target->ssid,
target->ssid_len), target->ssid_len),
target->bssid); target->bssid);
list_add_tail(&target->list, list_add_tail(&target->list,
&priv->ieee->network_free_list); &priv->ieee->network_free_list);
...@@ -9057,7 +9057,7 @@ static int ipw_wx_set_essid(struct net_device *dev, ...@@ -9057,7 +9057,7 @@ static int ipw_wx_set_essid(struct net_device *dev,
return 0; return 0;
} }
IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", escape_essid(extra, length), IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", escape_ssid(extra, length),
length); length);
priv->essid_len = length; priv->essid_len = length;
...@@ -9084,7 +9084,7 @@ static int ipw_wx_get_essid(struct net_device *dev, ...@@ -9084,7 +9084,7 @@ static int ipw_wx_get_essid(struct net_device *dev,
if (priv->config & CFG_STATIC_ESSID || if (priv->config & CFG_STATIC_ESSID ||
priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) { priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) {
IPW_DEBUG_WX("Getting essid: '%s'\n", IPW_DEBUG_WX("Getting essid: '%s'\n",
escape_essid(priv->essid, priv->essid_len)); escape_ssid(priv->essid, priv->essid_len));
memcpy(extra, priv->essid, priv->essid_len); memcpy(extra, priv->essid, priv->essid_len);
wrqu->essid.length = priv->essid_len; wrqu->essid.length = priv->essid_len;
wrqu->essid.flags = 1; /* active */ wrqu->essid.flags = 1; /* active */
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <asm/io.h> #include <asm/io.h>
#include <net/lib80211.h>
#include <net/ieee80211.h> #include <net/ieee80211.h>
#include <net/ieee80211_radiotap.h> #include <net/ieee80211_radiotap.h>
......
...@@ -4,6 +4,7 @@ config IWLWIFI ...@@ -4,6 +4,7 @@ config IWLWIFI
config IWLCORE config IWLCORE
tristate "Intel Wireless Wifi Core" tristate "Intel Wireless Wifi Core"
depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
select LIB80211
select IWLWIFI select IWLWIFI
select MAC80211_LEDS if IWLWIFI_LEDS select MAC80211_LEDS if IWLWIFI_LEDS
select LEDS_CLASS if IWLWIFI_LEDS select LEDS_CLASS if IWLWIFI_LEDS
...@@ -105,6 +106,7 @@ config IWL3945 ...@@ -105,6 +106,7 @@ config IWL3945
tristate "Intel PRO/Wireless 3945ABG/BG Network Connection" tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
select FW_LOADER select FW_LOADER
select LIB80211
select IWLWIFI select IWLWIFI
select MAC80211_LEDS if IWL3945_LEDS select MAC80211_LEDS if IWL3945_LEDS
select LEDS_CLASS if IWL3945_LEDS select LEDS_CLASS if IWL3945_LEDS
......
...@@ -25,8 +25,10 @@ ...@@ -25,8 +25,10 @@
* Tomas Winkler <tomas.winkler@intel.com> * Tomas Winkler <tomas.winkler@intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*****************************************************************************/ *****************************************************************************/
#include <net/mac80211.h> #include <linux/types.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <net/lib80211.h>
#include <net/mac80211.h>
#include "iwl-eeprom.h" #include "iwl-eeprom.h"
#include "iwl-dev.h" #include "iwl-dev.h"
...@@ -64,48 +66,6 @@ ...@@ -64,48 +66,6 @@
#define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) #define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
static int iwl_is_empty_essid(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
return 1;
/* Otherwise, if the entire essid is 0, we assume it is hidden */
while (essid_len) {
essid_len--;
if (essid[essid_len] != '\0')
return 0;
}
return 1;
}
static const char *iwl_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 (iwl_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;
}
/** /**
* iwl_scan_cancel - Cancel any currently executing HW scan * iwl_scan_cancel - Cancel any currently executing HW scan
* *
...@@ -775,8 +735,8 @@ static void iwl_bg_request_scan(struct work_struct *data) ...@@ -775,8 +735,8 @@ static void iwl_bg_request_scan(struct work_struct *data)
/* We should add the ability for user to lock to PASSIVE ONLY */ /* We should add the ability for user to lock to PASSIVE ONLY */
if (priv->one_direct_scan) { if (priv->one_direct_scan) {
IWL_DEBUG_SCAN("Start direct scan for '%s'\n", IWL_DEBUG_SCAN("Start direct scan for '%s'\n",
iwl_escape_essid(priv->direct_ssid, escape_ssid(priv->direct_ssid,
priv->direct_ssid_len)); priv->direct_ssid_len));
scan->direct_scan[0].id = WLAN_EID_SSID; scan->direct_scan[0].id = WLAN_EID_SSID;
scan->direct_scan[0].len = priv->direct_ssid_len; scan->direct_scan[0].len = priv->direct_ssid_len;
memcpy(scan->direct_scan[0].ssid, memcpy(scan->direct_scan[0].ssid,
...@@ -784,7 +744,7 @@ static void iwl_bg_request_scan(struct work_struct *data) ...@@ -784,7 +744,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
n_probes++; n_probes++;
} else if (!iwl_is_associated(priv) && priv->essid_len) { } else if (!iwl_is_associated(priv) && priv->essid_len) {
IWL_DEBUG_SCAN("Start direct scan for '%s' (not associated)\n", IWL_DEBUG_SCAN("Start direct scan for '%s' (not associated)\n",
iwl_escape_essid(priv->essid, priv->essid_len)); escape_ssid(priv->essid, priv->essid_len));
scan->direct_scan[0].id = WLAN_EID_SSID; scan->direct_scan[0].id = WLAN_EID_SSID;
scan->direct_scan[0].len = priv->essid_len; scan->direct_scan[0].len = priv->essid_len;
memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len);
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <net/ieee80211_radiotap.h> #include <net/ieee80211_radiotap.h>
#include <net/lib80211.h>
#include <net/mac80211.h> #include <net/mac80211.h>
#include <asm/div64.h> #include <asm/div64.h>
...@@ -107,46 +108,6 @@ static const struct ieee80211_supported_band *iwl3945_get_band( ...@@ -107,46 +108,6 @@ static const struct ieee80211_supported_band *iwl3945_get_band(
return priv->hw->wiphy->bands[band]; return priv->hw->wiphy->bands[band];
} }
static int iwl3945_is_empty_essid(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
return 1;
/* Otherwise, if the entire essid is 0, we assume it is hidden */
while (essid_len) {
essid_len--;
if (essid[essid_len] != '\0')
return 0;
}
return 1;
}
static const char *iwl3945_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 (iwl3945_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;
}
/*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** /*************** DMA-QUEUE-GENERAL-FUNCTIONS *****
* DMA services * DMA services
* *
...@@ -6193,8 +6154,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) ...@@ -6193,8 +6154,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
if (priv->one_direct_scan) { if (priv->one_direct_scan) {
IWL_DEBUG_SCAN IWL_DEBUG_SCAN
("Kicking off one direct scan for '%s'\n", ("Kicking off one direct scan for '%s'\n",
iwl3945_escape_essid(priv->direct_ssid, escape_ssid(priv->direct_ssid, priv->direct_ssid_len));
priv->direct_ssid_len));
scan->direct_scan[0].id = WLAN_EID_SSID; scan->direct_scan[0].id = WLAN_EID_SSID;
scan->direct_scan[0].len = priv->direct_ssid_len; scan->direct_scan[0].len = priv->direct_ssid_len;
memcpy(scan->direct_scan[0].ssid, memcpy(scan->direct_scan[0].ssid,
...@@ -6203,7 +6163,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) ...@@ -6203,7 +6163,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
} else if (!iwl3945_is_associated(priv) && priv->essid_len) { } else if (!iwl3945_is_associated(priv) && priv->essid_len) {
IWL_DEBUG_SCAN IWL_DEBUG_SCAN
("Kicking off one direct scan for '%s' when not associated\n", ("Kicking off one direct scan for '%s' when not associated\n",
iwl3945_escape_essid(priv->essid, priv->essid_len)); escape_ssid(priv->essid, priv->essid_len));
scan->direct_scan[0].id = WLAN_EID_SSID; scan->direct_scan[0].id = WLAN_EID_SSID;
scan->direct_scan[0].len = priv->essid_len; scan->direct_scan[0].len = priv->essid_len;
memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); 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,7 +6978,7 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
} }
if (len) { if (len) {
IWL_DEBUG_SCAN("direct scan for %s [%d]\n ", IWL_DEBUG_SCAN("direct scan for %s [%d]\n ",
iwl3945_escape_essid(ssid, len), (int)len); escape_ssid(ssid, len), (int)len);
priv->one_direct_scan = 1; priv->one_direct_scan = 1;
priv->direct_ssid_len = (u8) priv->direct_ssid_len = (u8)
......
/* Copyright (C) 2006, Red Hat, Inc. */ /* Copyright (C) 2006, Red Hat, Inc. */
#include <linux/types.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <net/lib80211.h>
#include "assoc.h" #include "assoc.h"
#include "decl.h" #include "decl.h"
...@@ -157,11 +159,11 @@ static int lbs_adhoc_join(struct lbs_private *priv, ...@@ -157,11 +159,11 @@ static int lbs_adhoc_join(struct lbs_private *priv,
lbs_deb_enter(LBS_DEB_ASSOC); lbs_deb_enter(LBS_DEB_ASSOC);
lbs_deb_join("current SSID '%s', ssid length %u\n", lbs_deb_join("current SSID '%s', ssid length %u\n",
escape_essid(priv->curbssparams.ssid, escape_ssid(priv->curbssparams.ssid,
priv->curbssparams.ssid_len), priv->curbssparams.ssid_len),
priv->curbssparams.ssid_len); priv->curbssparams.ssid_len);
lbs_deb_join("requested ssid '%s', ssid length %u\n", lbs_deb_join("requested ssid '%s', ssid length %u\n",
escape_essid(bss->ssid, bss->ssid_len), escape_ssid(bss->ssid, bss->ssid_len),
bss->ssid_len); bss->ssid_len);
/* check if the requested SSID is already joined */ /* check if the requested SSID is already joined */
...@@ -325,7 +327,7 @@ static int lbs_adhoc_start(struct lbs_private *priv, ...@@ -325,7 +327,7 @@ static int lbs_adhoc_start(struct lbs_private *priv,
memcpy(cmd.ssid, assoc_req->ssid, assoc_req->ssid_len); memcpy(cmd.ssid, assoc_req->ssid, assoc_req->ssid_len);
lbs_deb_join("ADHOC_START: SSID '%s', ssid length %u\n", lbs_deb_join("ADHOC_START: SSID '%s', ssid length %u\n",
escape_essid(assoc_req->ssid, assoc_req->ssid_len), escape_ssid(assoc_req->ssid, assoc_req->ssid_len),
assoc_req->ssid_len); assoc_req->ssid_len);
cmd.bsstype = CMD_BSS_TYPE_IBSS; cmd.bsstype = CMD_BSS_TYPE_IBSS;
...@@ -704,7 +706,7 @@ static int assoc_helper_essid(struct lbs_private *priv, ...@@ -704,7 +706,7 @@ static int assoc_helper_essid(struct lbs_private *priv,
channel = assoc_req->channel; channel = assoc_req->channel;
lbs_deb_assoc("SSID '%s' requested\n", lbs_deb_assoc("SSID '%s' requested\n",
escape_essid(assoc_req->ssid, assoc_req->ssid_len)); escape_ssid(assoc_req->ssid, assoc_req->ssid_len));
if (assoc_req->mode == IW_MODE_INFRA) { if (assoc_req->mode == IW_MODE_INFRA) {
lbs_send_specific_ssid_scan(priv, assoc_req->ssid, lbs_send_specific_ssid_scan(priv, assoc_req->ssid,
assoc_req->ssid_len); assoc_req->ssid_len);
...@@ -1228,7 +1230,7 @@ void lbs_association_worker(struct work_struct *work) ...@@ -1228,7 +1230,7 @@ void lbs_association_worker(struct work_struct *work)
" secinfo: %s%s%s\n" " secinfo: %s%s%s\n"
" auth_mode: %d\n", " auth_mode: %d\n",
assoc_req->flags, assoc_req->flags,
escape_essid(assoc_req->ssid, assoc_req->ssid_len), escape_ssid(assoc_req->ssid, assoc_req->ssid_len),
assoc_req->channel, assoc_req->band, assoc_req->mode, assoc_req->channel, assoc_req->band, assoc_req->mode,
assoc_req->bssid, assoc_req->bssid,
assoc_req->secinfo.WPAenabled ? " WPA" : "", assoc_req->secinfo.WPAenabled ? " WPA" : "",
...@@ -1814,7 +1816,7 @@ static int lbs_adhoc_post(struct lbs_private *priv, struct cmd_header *resp) ...@@ -1814,7 +1816,7 @@ static int lbs_adhoc_post(struct lbs_private *priv, struct cmd_header *resp)
wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
lbs_deb_join("ADHOC_RESP: Joined/started '%s', BSSID %pM, channel %d\n", lbs_deb_join("ADHOC_RESP: Joined/started '%s', BSSID %pM, channel %d\n",
escape_essid(bss->ssid, bss->ssid_len), escape_ssid(bss->ssid, bss->ssid_len),
priv->curbssparams.bssid, priv->curbssparams.bssid,
priv->curbssparams.channel); priv->curbssparams.channel);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
#include <net/iw_handler.h> #include <net/iw_handler.h>
#include <net/lib80211.h>
#include <net/ieee80211.h> #include <net/ieee80211.h>
#include <linux/kfifo.h> #include <linux/kfifo.h>
#include "host.h" #include "host.h"
...@@ -1092,7 +1093,7 @@ int lbs_mesh_config(struct lbs_private *priv, uint16_t action, uint16_t chan) ...@@ -1092,7 +1093,7 @@ int lbs_mesh_config(struct lbs_private *priv, uint16_t action, uint16_t chan)
} }
lbs_deb_cmd("mesh config action %d type %x channel %d SSID %s\n", lbs_deb_cmd("mesh config action %d type %x channel %d SSID %s\n",
action, priv->mesh_tlv, chan, action, priv->mesh_tlv, chan,
escape_essid(priv->mesh_ssid, priv->mesh_ssid_len)); escape_ssid(priv->mesh_ssid, priv->mesh_ssid_len));
return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv); return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv);
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/string.h> #include <linux/string.h>
#include <net/iw_handler.h> #include <net/iw_handler.h>
#include <net/lib80211.h>
#include "dev.h" #include "dev.h"
#include "decl.h" #include "decl.h"
...@@ -85,7 +86,7 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf, ...@@ -85,7 +86,7 @@ static ssize_t lbs_getscantable(struct file *file, char __user *userbuf,
spectrum_mgmt ? 'S' : ' '); spectrum_mgmt ? 'S' : ' ');
pos += snprintf(buf+pos, len-pos, " %04d |", SCAN_RSSI(iter_bss->rssi)); pos += snprintf(buf+pos, len-pos, " %04d |", SCAN_RSSI(iter_bss->rssi));
pos += snprintf(buf+pos, len-pos, " %s\n", pos += snprintf(buf+pos, len-pos, " %s\n",
escape_essid(iter_bss->ssid, iter_bss->ssid_len)); escape_ssid(iter_bss->ssid, iter_bss->ssid_len));
numscansdone++; numscansdone++;
} }
......
...@@ -74,8 +74,4 @@ void lbs_host_to_card_done(struct lbs_private *priv); ...@@ -74,8 +74,4 @@ void lbs_host_to_card_done(struct lbs_private *priv);
int lbs_update_channel(struct lbs_private *priv); int lbs_update_channel(struct lbs_private *priv);
#ifndef CONFIG_IEEE80211
const char *escape_essid(const char *essid, u8 essid_len);
#endif
#endif #endif
...@@ -1646,33 +1646,6 @@ static int lbs_add_rtap(struct lbs_private *priv) ...@@ -1646,33 +1646,6 @@ static int lbs_add_rtap(struct lbs_private *priv)
return ret; return ret;
} }
#ifndef CONFIG_IEEE80211
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;
}
#endif
module_init(lbs_init_module); module_init(lbs_init_module);
module_exit(lbs_exit_module); module_exit(lbs_exit_module);
......
...@@ -4,9 +4,12 @@ ...@@ -4,9 +4,12 @@
* IOCTL handlers as well as command preperation and response routines * IOCTL handlers as well as command preperation and response routines
* for sending scan commands to the firmware. * for sending scan commands to the firmware.
*/ */
#include <linux/types.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <net/lib80211.h>
#include "host.h" #include "host.h"
#include "decl.h" #include "decl.h"
#include "dev.h" #include "dev.h"
...@@ -452,7 +455,7 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan) ...@@ -452,7 +455,7 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan)
list_for_each_entry(iter, &priv->network_list, list) list_for_each_entry(iter, &priv->network_list, list)
lbs_deb_scan("%02d: BSSID %pM, RSSI %d, SSID '%s'\n", lbs_deb_scan("%02d: BSSID %pM, RSSI %d, SSID '%s'\n",
i++, iter->bssid, iter->rssi, i++, iter->bssid, iter->rssi,
escape_essid(iter->ssid, iter->ssid_len)); escape_ssid(iter->ssid, iter->ssid_len));
mutex_unlock(&priv->lock); mutex_unlock(&priv->lock);
#endif #endif
...@@ -599,7 +602,7 @@ static int lbs_process_bss(struct bss_descriptor *bss, ...@@ -599,7 +602,7 @@ static int lbs_process_bss(struct bss_descriptor *bss,
bss->ssid_len = min_t(int, 32, elem->len); bss->ssid_len = min_t(int, 32, elem->len);
memcpy(bss->ssid, elem->data, bss->ssid_len); memcpy(bss->ssid, elem->data, bss->ssid_len);
lbs_deb_scan("got SSID IE: '%s', len %u\n", lbs_deb_scan("got SSID IE: '%s', len %u\n",
escape_essid(bss->ssid, bss->ssid_len), escape_ssid(bss->ssid, bss->ssid_len),
bss->ssid_len); bss->ssid_len);
break; break;
...@@ -742,7 +745,7 @@ int lbs_send_specific_ssid_scan(struct lbs_private *priv, uint8_t *ssid, ...@@ -742,7 +745,7 @@ int lbs_send_specific_ssid_scan(struct lbs_private *priv, uint8_t *ssid,
int ret = 0; int ret = 0;
lbs_deb_enter_args(LBS_DEB_SCAN, "SSID '%s'\n", lbs_deb_enter_args(LBS_DEB_SCAN, "SSID '%s'\n",
escape_essid(ssid, ssid_len)); escape_ssid(ssid, ssid_len));
if (!ssid_len) if (!ssid_len)
goto out; goto out;
...@@ -966,7 +969,7 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info, ...@@ -966,7 +969,7 @@ int lbs_set_scan(struct net_device *dev, struct iw_request_info *info,
priv->scan_ssid_len = req->essid_len; priv->scan_ssid_len = req->essid_len;
memcpy(priv->scan_ssid, req->essid, priv->scan_ssid_len); memcpy(priv->scan_ssid, req->essid, priv->scan_ssid_len);
lbs_deb_wext("set_scan, essid '%s'\n", lbs_deb_wext("set_scan, essid '%s'\n",
escape_essid(priv->scan_ssid, priv->scan_ssid_len)); escape_ssid(priv->scan_ssid, priv->scan_ssid_len));
} else { } else {
priv->scan_ssid_len = 0; priv->scan_ssid_len = 0;
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/wireless.h> #include <linux/wireless.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <net/lib80211.h>
#include <net/ieee80211.h> #include <net/ieee80211.h>
#include <net/iw_handler.h> #include <net/iw_handler.h>
...@@ -2005,7 +2006,7 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info, ...@@ -2005,7 +2006,7 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,
lbs_deb_wext("requested any SSID\n"); lbs_deb_wext("requested any SSID\n");
} else { } else {
lbs_deb_wext("requested SSID '%s'\n", lbs_deb_wext("requested SSID '%s'\n",
escape_essid(ssid, ssid_len)); escape_ssid(ssid, ssid_len));
} }
out: out:
......
...@@ -127,10 +127,6 @@ static inline bool ieee80211_ratelimit_debug(u32 level) ...@@ -127,10 +127,6 @@ static inline bool ieee80211_ratelimit_debug(u32 level)
} }
#endif /* CONFIG_IEEE80211_DEBUG */ #endif /* CONFIG_IEEE80211_DEBUG */
/* escape_essid() is intended to be used in debug (and possibly error)
* messages. It should never be used for passing essid to user space. */
const char *escape_essid(const char *essid, u8 essid_len);
/* /*
* To use the debug system: * To use the debug system:
* *
...@@ -1135,22 +1131,6 @@ static inline void *ieee80211_priv(struct net_device *dev) ...@@ -1135,22 +1131,6 @@ static inline void *ieee80211_priv(struct net_device *dev)
return ((struct ieee80211_device *)netdev_priv(dev))->priv; return ((struct ieee80211_device *)netdev_priv(dev))->priv;
} }
static inline int ieee80211_is_empty_essid(const char *essid, int essid_len)
{
/* Single white space is for Linksys APs */
if (essid_len == 1 && essid[0] == ' ')
return 1;
/* Otherwise, if the entire essid is 0, we assume it is hidden */
while (essid_len) {
essid_len--;
if (essid[essid_len] != '\0')
return 0;
}
return 1;
}
static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee,
int mode) int mode)
{ {
......
/*
* lib80211.h -- common bits for IEEE802.11 wireless drivers
*
* Copyright (c) 2008, John W. Linville <linville@tuxdriver.com>
*
*/
#ifndef LIB80211_H
#define LIB80211_H
/* escape_ssid() is intended to be used in debug (and possibly error)
* messages. It should never be used for passing ssid to user space. */
const char *escape_ssid(const char *ssid, u8 ssid_len);
static inline int is_empty_ssid(const char *ssid, int ssid_len)
{
/* Single white space is for Linksys APs */
if (ssid_len == 1 && ssid[0] == ' ')
return 1;
/* Otherwise, if the entire ssid is 0, we assume it is hidden */
while (ssid_len) {
ssid_len--;
if (ssid[ssid_len] != '\0')
return 0;
}
return 1;
}
#endif /* LIB80211_H */
...@@ -11,6 +11,7 @@ config IEEE80211 ...@@ -11,6 +11,7 @@ config IEEE80211
select IEEE80211_CRYPT_WEP select IEEE80211_CRYPT_WEP
select IEEE80211_CRYPT_TKIP select IEEE80211_CRYPT_TKIP
select IEEE80211_CRYPT_CCMP select IEEE80211_CRYPT_CCMP
select LIB80211
---help--- ---help---
This option enables the hardware independent IEEE 802.11 This option enables the hardware independent IEEE 802.11
networking stack. This component is deprecated in favor of the networking stack. This component is deprecated in favor of the
......
...@@ -308,31 +308,5 @@ MODULE_PARM_DESC(debug, "debug output mask"); ...@@ -308,31 +308,5 @@ MODULE_PARM_DESC(debug, "debug output mask");
module_exit(ieee80211_exit); module_exit(ieee80211_exit);
module_init(ieee80211_init); module_init(ieee80211_init);
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(alloc_ieee80211);
EXPORT_SYMBOL(free_ieee80211); EXPORT_SYMBOL(free_ieee80211);
EXPORT_SYMBOL(escape_essid);
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <net/lib80211.h>
#include <net/ieee80211.h> #include <net/ieee80211.h>
static void ieee80211_monitor_rx(struct ieee80211_device *ieee, static void ieee80211_monitor_rx(struct ieee80211_device *ieee,
...@@ -1145,8 +1146,8 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element ...@@ -1145,8 +1146,8 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element
switch (info_element->id) { switch (info_element->id) {
case MFIE_TYPE_SSID: case MFIE_TYPE_SSID:
if (ieee80211_is_empty_essid(info_element->data, if (is_empty_ssid(info_element->data,
info_element->len)) { info_element->len)) {
network->flags |= NETWORK_EMPTY_ESSID; network->flags |= NETWORK_EMPTY_ESSID;
break; break;
} }
...@@ -1390,7 +1391,7 @@ static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee ...@@ -1390,7 +1391,7 @@ static int ieee80211_handle_assoc_resp(struct ieee80211_device *ieee, struct iee
network->mode |= IEEE_B; network->mode |= IEEE_B;
} }
if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) if (is_empty_ssid(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID; network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats)); memcpy(&network->stats, stats, sizeof(network->stats));
...@@ -1456,13 +1457,13 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021 ...@@ -1456,13 +1457,13 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021
if (network->mode == 0) { if (network->mode == 0) {
IEEE80211_DEBUG_SCAN("Filtered out '%s (%pM)' " IEEE80211_DEBUG_SCAN("Filtered out '%s (%pM)' "
"network.\n", "network.\n",
escape_essid(network->ssid, escape_ssid(network->ssid,
network->ssid_len), network->ssid_len),
network->bssid); network->bssid);
return 1; return 1;
} }
if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) if (is_empty_ssid(network->ssid, network->ssid_len))
network->flags |= NETWORK_EMPTY_ESSID; network->flags |= NETWORK_EMPTY_ESSID;
memcpy(&network->stats, stats, sizeof(network->stats)); memcpy(&network->stats, stats, sizeof(network->stats));
...@@ -1576,7 +1577,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device ...@@ -1576,7 +1577,7 @@ static void ieee80211_process_probe_response(struct ieee80211_device
IEEE80211_DEBUG_SCAN("'%s' (%pM" IEEE80211_DEBUG_SCAN("'%s' (%pM"
"): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n",
escape_essid(info_element->data, info_element->len), escape_ssid(info_element->data, info_element->len),
beacon->header.addr3, beacon->header.addr3,
(beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0', (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0',
(beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0', (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0',
...@@ -1597,8 +1598,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device ...@@ -1597,8 +1598,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device
if (ieee80211_network_init(ieee, beacon, &network, stats)) { if (ieee80211_network_init(ieee, beacon, &network, stats)) {
IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n", IEEE80211_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n",
escape_essid(info_element->data, escape_ssid(info_element->data,
info_element->len), info_element->len),
beacon->header.addr3, beacon->header.addr3,
is_beacon(beacon->header.frame_ctl) ? is_beacon(beacon->header.frame_ctl) ?
"BEACON" : "PROBE RESPONSE"); "BEACON" : "PROBE RESPONSE");
...@@ -1635,8 +1636,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device ...@@ -1635,8 +1636,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device
target = oldest; target = oldest;
IEEE80211_DEBUG_SCAN("Expired '%s' (%pM) from " IEEE80211_DEBUG_SCAN("Expired '%s' (%pM) from "
"network list.\n", "network list.\n",
escape_essid(target->ssid, escape_ssid(target->ssid,
target->ssid_len), target->ssid_len),
target->bssid); target->bssid);
ieee80211_network_reset(target); ieee80211_network_reset(target);
} else { } else {
...@@ -1648,8 +1649,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device ...@@ -1648,8 +1649,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device
#ifdef CONFIG_IEEE80211_DEBUG #ifdef CONFIG_IEEE80211_DEBUG
IEEE80211_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n", IEEE80211_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n",
escape_essid(network.ssid, escape_ssid(network.ssid,
network.ssid_len), network.ssid_len),
network.bssid, network.bssid,
is_beacon(beacon->header.frame_ctl) ? is_beacon(beacon->header.frame_ctl) ?
"BEACON" : "PROBE RESPONSE"); "BEACON" : "PROBE RESPONSE");
...@@ -1659,8 +1660,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device ...@@ -1659,8 +1660,8 @@ static void ieee80211_process_probe_response(struct ieee80211_device
list_add_tail(&target->list, &ieee->network_list); list_add_tail(&target->list, &ieee->network_list);
} else { } else {
IEEE80211_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n", IEEE80211_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n",
escape_essid(target->ssid, escape_ssid(target->ssid,
target->ssid_len), target->ssid_len),
target->bssid, target->bssid,
is_beacon(beacon->header.frame_ctl) ? is_beacon(beacon->header.frame_ctl) ?
"BEACON" : "PROBE RESPONSE"); "BEACON" : "PROBE RESPONSE");
......
...@@ -283,8 +283,8 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee, ...@@ -283,8 +283,8 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
else else
IEEE80211_DEBUG_SCAN("Not showing network '%s (" IEEE80211_DEBUG_SCAN("Not showing network '%s ("
"%pM)' due to age (%dms).\n", "%pM)' due to age (%dms).\n",
escape_essid(network->ssid, escape_ssid(network->ssid,
network->ssid_len), network->ssid_len),
network->bssid, network->bssid,
jiffies_to_msecs(jiffies - jiffies_to_msecs(jiffies -
network-> network->
...@@ -408,7 +408,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee, ...@@ -408,7 +408,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
memset(sec.keys[key] + erq->length, 0, memset(sec.keys[key] + erq->length, 0,
len - erq->length); len - erq->length);
IEEE80211_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n", IEEE80211_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n",
key, escape_essid(sec.keys[key], len), key, escape_ssid(sec.keys[key], len),
erq->length, len); erq->length, len);
sec.key_sizes[key] = len; sec.key_sizes[key] = len;
if (*crypt) if (*crypt)
......
...@@ -72,3 +72,13 @@ config WIRELESS_EXT_SYSFS ...@@ -72,3 +72,13 @@ config WIRELESS_EXT_SYSFS
Say Y if you have programs using it, like old versions of Say Y if you have programs using it, like old versions of
hal. hal.
config LIB80211
tristate "Common routines for IEEE802.11 drivers"
default n
help
This options enables a library of common routines used
by IEEE802.11 wireless LAN drivers.
Drivers should select this themselves if needed. Say Y if
you want this built into your kernel.
obj-$(CONFIG_WIRELESS_EXT) += wext.o obj-$(CONFIG_WIRELESS_EXT) += wext.o
obj-$(CONFIG_CFG80211) += cfg80211.o obj-$(CONFIG_CFG80211) += cfg80211.o
obj-$(CONFIG_LIB80211) += lib80211.o
cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o
cfg80211-$(CONFIG_NL80211) += nl80211.o cfg80211-$(CONFIG_NL80211) += nl80211.o
/*
* lib80211 -- common bits for IEEE802.11 drivers
*
* Copyright(c) 2008 John W. Linville <linville@tuxdriver.com>
*
*/
#include <linux/module.h>
#include <linux/ieee80211.h>
#include <net/lib80211.h>
#define DRV_NAME "lib80211"
#define DRV_DESCRIPTION "common routines for IEEE802.11 drivers"
MODULE_DESCRIPTION(DRV_DESCRIPTION);
MODULE_AUTHOR("John W. Linville <linville@tuxdriver.com>");
MODULE_LICENSE("GPL");
const char *escape_ssid(const char *ssid, u8 ssid_len)
{
static char escaped[IEEE80211_MAX_SSID_LEN * 2 + 1];
const char *s = ssid;
char *d = escaped;
if (is_empty_ssid(ssid, ssid_len)) {
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
return escaped;
}
ssid_len = min_t(u8, ssid_len, IEEE80211_MAX_SSID_LEN);
while (ssid_len--) {
if (*s == '\0') {
*d++ = '\\';
*d++ = '0';
s++;
} else {
*d++ = *s++;
}
}
*d = '\0';
return escaped;
}
EXPORT_SYMBOL(escape_ssid);
static int __init ieee80211_init(void)
{
printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION "\n");
return 0;
}
static void __exit ieee80211_exit(void)
{
}
module_init(ieee80211_init);
module_exit(ieee80211_exit);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册