Commit 4b4890cb authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Torvalds

wireless: ipw2x00: print SSID via %*pE

Instead of custom approach this allows to print escaped strings via
recently added kernel extension: %*pE.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "John W . Linville" <linville@tuxdriver.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent da169607
...@@ -2005,7 +2005,6 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) ...@@ -2005,7 +2005,6 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
u32 chan; u32 chan;
char *txratename; char *txratename;
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
DECLARE_SSID_BUF(ssid);
/* /*
* TBD: BSSID is usually 00:00:00:00:00:00 here and not * TBD: BSSID is usually 00:00:00:00:00:00 here and not
...@@ -2067,8 +2066,8 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) ...@@ -2067,8 +2066,8 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
break; break;
} }
IPW_DEBUG_INFO("%s: Associated with '%s' at %s, channel %d (BSSID=%pM)\n", IPW_DEBUG_INFO("%s: Associated with '%*pE' at %s, channel %d (BSSID=%pM)\n",
priv->net_dev->name, print_ssid(ssid, essid, essid_len), priv->net_dev->name, essid_len, essid,
txratename, chan, bssid); txratename, chan, bssid);
/* now we copy read ssid into dev */ /* now we copy read ssid into dev */
...@@ -2095,9 +2094,8 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, ...@@ -2095,9 +2094,8 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
.host_command_length = ssid_len .host_command_length = ssid_len
}; };
int err; int err;
DECLARE_SSID_BUF(ssid);
IPW_DEBUG_HC("SSID: '%s'\n", print_ssid(ssid, essid, ssid_len)); IPW_DEBUG_HC("SSID: '%*pE'\n", ssid_len, essid);
if (ssid_len) if (ssid_len)
memcpy(cmd.host_command_parameters, essid, ssid_len); memcpy(cmd.host_command_parameters, essid, ssid_len);
...@@ -2138,11 +2136,8 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, ...@@ -2138,11 +2136,8 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status) static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status)
{ {
DECLARE_SSID_BUF(ssid);
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: '%*pE' %pM\n", priv->essid_len, priv->essid,
print_ssid(ssid, priv->essid, priv->essid_len),
priv->bssid); priv->bssid);
priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING); priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING);
...@@ -6975,7 +6970,6 @@ static int ipw2100_wx_set_essid(struct net_device *dev, ...@@ -6975,7 +6970,6 @@ static int ipw2100_wx_set_essid(struct net_device *dev,
char *essid = ""; /* ANY */ char *essid = ""; /* ANY */
int length = 0; int length = 0;
int err = 0; int err = 0;
DECLARE_SSID_BUF(ssid);
mutex_lock(&priv->action_mutex); mutex_lock(&priv->action_mutex);
if (!(priv->status & STATUS_INITIALIZED)) { if (!(priv->status & STATUS_INITIALIZED)) {
...@@ -7005,8 +6999,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, ...@@ -7005,8 +6999,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev,
goto done; goto done;
} }
IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n", IPW_DEBUG_WX("Setting ESSID: '%*pE' (%d)\n", length, essid, length);
print_ssid(ssid, essid, length), length);
priv->essid_len = length; priv->essid_len = length;
memcpy(priv->essid, essid, priv->essid_len); memcpy(priv->essid, essid, priv->essid_len);
...@@ -7027,13 +7020,12 @@ static int ipw2100_wx_get_essid(struct net_device *dev, ...@@ -7027,13 +7020,12 @@ static int ipw2100_wx_get_essid(struct net_device *dev,
*/ */
struct ipw2100_priv *priv = libipw_priv(dev); struct ipw2100_priv *priv = libipw_priv(dev);
DECLARE_SSID_BUF(ssid);
/* If we are associated, trying to associate, or have a statically /* If we are associated, trying to associate, or have a statically
* 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: '%*pE'\n",
print_ssid(ssid, priv->essid, priv->essid_len)); priv->essid_len, priv->essid);
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 */
......
This diff is collapsed.
...@@ -1120,7 +1120,6 @@ static int libipw_parse_info_param(struct libipw_info_element ...@@ -1120,7 +1120,6 @@ static int libipw_parse_info_param(struct libipw_info_element
*info_element, u16 length, *info_element, u16 length,
struct libipw_network *network) struct libipw_network *network)
{ {
DECLARE_SSID_BUF(ssid);
u8 i; u8 i;
#ifdef CONFIG_LIBIPW_DEBUG #ifdef CONFIG_LIBIPW_DEBUG
char rates_str[64]; char rates_str[64];
...@@ -1151,9 +1150,8 @@ static int libipw_parse_info_param(struct libipw_info_element ...@@ -1151,9 +1150,8 @@ static int libipw_parse_info_param(struct libipw_info_element
memset(network->ssid + network->ssid_len, 0, memset(network->ssid + network->ssid_len, 0,
IW_ESSID_MAX_SIZE - network->ssid_len); IW_ESSID_MAX_SIZE - network->ssid_len);
LIBIPW_DEBUG_MGMT("WLAN_EID_SSID: '%s' len=%d.\n", LIBIPW_DEBUG_MGMT("WLAN_EID_SSID: '%*pE' len=%d.\n",
print_ssid(ssid, network->ssid, network->ssid_len, network->ssid,
network->ssid_len),
network->ssid_len); network->ssid_len);
break; break;
...@@ -1399,8 +1397,6 @@ static int libipw_network_init(struct libipw_device *ieee, struct libipw_probe_r ...@@ -1399,8 +1397,6 @@ static int libipw_network_init(struct libipw_device *ieee, struct libipw_probe_r
struct libipw_network *network, struct libipw_network *network,
struct libipw_rx_stats *stats) struct libipw_rx_stats *stats)
{ {
DECLARE_SSID_BUF(ssid);
network->qos_data.active = 0; network->qos_data.active = 0;
network->qos_data.supported = 0; network->qos_data.supported = 0;
network->qos_data.param_count = 0; network->qos_data.param_count = 0;
...@@ -1447,10 +1443,8 @@ static int libipw_network_init(struct libipw_device *ieee, struct libipw_probe_r ...@@ -1447,10 +1443,8 @@ static int libipw_network_init(struct libipw_device *ieee, struct libipw_probe_r
} }
if (network->mode == 0) { if (network->mode == 0) {
LIBIPW_DEBUG_SCAN("Filtered out '%s (%pM)' " LIBIPW_DEBUG_SCAN("Filtered out '%*pE (%pM)' network.\n",
"network.\n", network->ssid_len, network->ssid,
print_ssid(ssid, network->ssid,
network->ssid_len),
network->bssid); network->bssid);
return 1; return 1;
} }
...@@ -1563,11 +1557,9 @@ static void libipw_process_probe_response(struct libipw_device ...@@ -1563,11 +1557,9 @@ static void libipw_process_probe_response(struct libipw_device
struct libipw_info_element *info_element = beacon->info_element; struct libipw_info_element *info_element = beacon->info_element;
#endif #endif
unsigned long flags; unsigned long flags;
DECLARE_SSID_BUF(ssid);
LIBIPW_DEBUG_SCAN("'%s' (%pM" LIBIPW_DEBUG_SCAN("'%*pE' (%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", info_element->len, info_element->data,
print_ssid(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',
...@@ -1587,9 +1579,8 @@ static void libipw_process_probe_response(struct libipw_device ...@@ -1587,9 +1579,8 @@ static void libipw_process_probe_response(struct libipw_device
(beacon->capability & cpu_to_le16(1 << 0x0)) ? '1' : '0'); (beacon->capability & cpu_to_le16(1 << 0x0)) ? '1' : '0');
if (libipw_network_init(ieee, beacon, &network, stats)) { if (libipw_network_init(ieee, beacon, &network, stats)) {
LIBIPW_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n", LIBIPW_DEBUG_SCAN("Dropped '%*pE' (%pM) via %s.\n",
print_ssid(ssid, info_element->data, info_element->len, info_element->data,
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");
...@@ -1624,10 +1615,8 @@ static void libipw_process_probe_response(struct libipw_device ...@@ -1624,10 +1615,8 @@ static void libipw_process_probe_response(struct libipw_device
/* If there are no more slots, expire the oldest */ /* If there are no more slots, expire the oldest */
list_del(&oldest->list); list_del(&oldest->list);
target = oldest; target = oldest;
LIBIPW_DEBUG_SCAN("Expired '%s' (%pM) from " LIBIPW_DEBUG_SCAN("Expired '%*pE' (%pM) from network list.\n",
"network list.\n", target->ssid_len, target->ssid,
print_ssid(ssid, target->ssid,
target->ssid_len),
target->bssid); target->bssid);
libipw_network_reset(target); libipw_network_reset(target);
} else { } else {
...@@ -1638,9 +1627,8 @@ static void libipw_process_probe_response(struct libipw_device ...@@ -1638,9 +1627,8 @@ static void libipw_process_probe_response(struct libipw_device
} }
#ifdef CONFIG_LIBIPW_DEBUG #ifdef CONFIG_LIBIPW_DEBUG
LIBIPW_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n", LIBIPW_DEBUG_SCAN("Adding '%*pE' (%pM) via %s.\n",
print_ssid(ssid, network.ssid, network.ssid_len, network.ssid,
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");
...@@ -1649,9 +1637,8 @@ static void libipw_process_probe_response(struct libipw_device ...@@ -1649,9 +1637,8 @@ static void libipw_process_probe_response(struct libipw_device
network.ibss_dfs = NULL; network.ibss_dfs = NULL;
list_add_tail(&target->list, &ieee->network_list); list_add_tail(&target->list, &ieee->network_list);
} else { } else {
LIBIPW_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n", LIBIPW_DEBUG_SCAN("Updating '%*pE' (%pM) via %s.\n",
print_ssid(ssid, target->ssid, target->ssid_len, target->ssid,
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");
......
...@@ -272,7 +272,6 @@ int libipw_wx_get_scan(struct libipw_device *ieee, ...@@ -272,7 +272,6 @@ int libipw_wx_get_scan(struct libipw_device *ieee,
char *ev = extra; char *ev = extra;
char *stop = ev + wrqu->data.length; char *stop = ev + wrqu->data.length;
int i = 0; int i = 0;
DECLARE_SSID_BUF(ssid);
LIBIPW_DEBUG_WX("Getting scan\n"); LIBIPW_DEBUG_WX("Getting scan\n");
...@@ -290,10 +289,8 @@ int libipw_wx_get_scan(struct libipw_device *ieee, ...@@ -290,10 +289,8 @@ int libipw_wx_get_scan(struct libipw_device *ieee,
ev = libipw_translate_scan(ieee, ev, stop, network, ev = libipw_translate_scan(ieee, ev, stop, network,
info); info);
else { else {
LIBIPW_DEBUG_SCAN("Not showing network '%s (" LIBIPW_DEBUG_SCAN("Not showing network '%*pE (%pM)' due to age (%ums).\n",
"%pM)' due to age (%ums).\n", network->ssid_len, network->ssid,
print_ssid(ssid, network->ssid,
network->ssid_len),
network->bssid, network->bssid,
elapsed_jiffies_msecs( elapsed_jiffies_msecs(
network->last_scanned)); network->last_scanned));
...@@ -322,7 +319,6 @@ int libipw_wx_set_encode(struct libipw_device *ieee, ...@@ -322,7 +319,6 @@ int libipw_wx_set_encode(struct libipw_device *ieee,
int i, key, key_provided, len; int i, key, key_provided, len;
struct lib80211_crypt_data **crypt; struct lib80211_crypt_data **crypt;
int host_crypto = ieee->host_encrypt || ieee->host_decrypt; int host_crypto = ieee->host_encrypt || ieee->host_decrypt;
DECLARE_SSID_BUF(ssid);
LIBIPW_DEBUG_WX("SET_ENCODE\n"); LIBIPW_DEBUG_WX("SET_ENCODE\n");
...@@ -417,8 +413,8 @@ int libipw_wx_set_encode(struct libipw_device *ieee, ...@@ -417,8 +413,8 @@ int libipw_wx_set_encode(struct libipw_device *ieee,
if (len > erq->length) if (len > erq->length)
memset(sec.keys[key] + erq->length, 0, memset(sec.keys[key] + erq->length, 0,
len - erq->length); len - erq->length);
LIBIPW_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n", LIBIPW_DEBUG_WX("Setting key %d to '%*pE' (%d:%d bytes)\n",
key, print_ssid(ssid, sec.keys[key], len), key, len, sec.keys[key],
erq->length, len); erq->length, len);
sec.key_sizes[key] = len; sec.key_sizes[key] = len;
if (*crypt) if (*crypt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment