diff options
author | John W. Linville <linville@tuxdriver.com> | 2008-09-24 18:13:14 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:46 -0400 |
commit | 7e272fcff6f0a32a3d46e600ea5895f6058f4e2d (patch) | |
tree | 39857028913862af4d71170d1f16ee360ba49115 /net/ieee80211 | |
parent | ddf4ac53fb8a12a027c0486db743ae040f45b56a (diff) |
wireless: consolidate on a single escape_essid implementation
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/ieee80211')
-rw-r--r-- | net/ieee80211/Kconfig | 1 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_module.c | 26 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_rx.c | 31 | ||||
-rw-r--r-- | net/ieee80211/ieee80211_wx.c | 6 |
4 files changed, 20 insertions, 44 deletions
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"); | |||
308 | module_exit(ieee80211_exit); | 308 | module_exit(ieee80211_exit); |
309 | module_init(ieee80211_init); | 309 | module_init(ieee80211_init); |
310 | 310 | ||
311 | const 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 | |||
336 | EXPORT_SYMBOL(alloc_ieee80211); | 311 | EXPORT_SYMBOL(alloc_ieee80211); |
337 | EXPORT_SYMBOL(free_ieee80211); | 312 | EXPORT_SYMBOL(free_ieee80211); |
338 | EXPORT_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 | ||
37 | static void ieee80211_monitor_rx(struct ieee80211_device *ieee, | 38 | static 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) |