aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_rx.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ieee80211/ieee80211_rx.c')
-rw-r--r--net/ieee80211/ieee80211_rx.c59
1 files changed, 33 insertions, 26 deletions
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index 6284c99b456e..21c0fadde03b 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -271,6 +271,7 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
271{ 271{
272 struct ieee80211_hdr_3addr *hdr; 272 struct ieee80211_hdr_3addr *hdr;
273 int res, hdrlen; 273 int res, hdrlen;
274 DECLARE_MAC_BUF(mac);
274 275
275 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) 276 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
276 return 0; 277 return 0;
@@ -282,8 +283,8 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
282 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); 283 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv);
283 atomic_dec(&crypt->refcnt); 284 atomic_dec(&crypt->refcnt);
284 if (res < 0) { 285 if (res < 0) {
285 IEEE80211_DEBUG_DROP("decryption failed (SA=" MAC_FMT 286 IEEE80211_DEBUG_DROP("decryption failed (SA=%s"
286 ") res=%d\n", MAC_ARG(hdr->addr2), res); 287 ") res=%d\n", print_mac(mac, hdr->addr2), res);
287 if (res == -2) 288 if (res == -2)
288 IEEE80211_DEBUG_DROP("Decryption failed ICV " 289 IEEE80211_DEBUG_DROP("Decryption failed ICV "
289 "mismatch (key %d)\n", 290 "mismatch (key %d)\n",
@@ -303,6 +304,7 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee,
303{ 304{
304 struct ieee80211_hdr_3addr *hdr; 305 struct ieee80211_hdr_3addr *hdr;
305 int res, hdrlen; 306 int res, hdrlen;
307 DECLARE_MAC_BUF(mac);
306 308
307 if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) 309 if (crypt == NULL || crypt->ops->decrypt_msdu == NULL)
308 return 0; 310 return 0;
@@ -315,8 +317,8 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee,
315 atomic_dec(&crypt->refcnt); 317 atomic_dec(&crypt->refcnt);
316 if (res < 0) { 318 if (res < 0) {
317 printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" 319 printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
318 " (SA=" MAC_FMT " keyidx=%d)\n", 320 " (SA=%s keyidx=%d)\n",
319 ieee->dev->name, MAC_ARG(hdr->addr2), keyidx); 321 ieee->dev->name, print_mac(mac, hdr->addr2), keyidx);
320 return -1; 322 return -1;
321 } 323 }
322 324
@@ -350,6 +352,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
350 struct ieee80211_crypt_data *crypt = NULL; 352 struct ieee80211_crypt_data *crypt = NULL;
351 int keyidx = 0; 353 int keyidx = 0;
352 int can_be_decrypted = 0; 354 int can_be_decrypted = 0;
355 DECLARE_MAC_BUF(mac);
353 356
354 hdr = (struct ieee80211_hdr_4addr *)skb->data; 357 hdr = (struct ieee80211_hdr_4addr *)skb->data;
355 stats = &ieee->stats; 358 stats = &ieee->stats;
@@ -459,8 +462,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
459 * frames silently instead of filling system log with 462 * frames silently instead of filling system log with
460 * these reports. */ 463 * these reports. */
461 IEEE80211_DEBUG_DROP("Decryption failed (not set)" 464 IEEE80211_DEBUG_DROP("Decryption failed (not set)"
462 " (SA=" MAC_FMT ")\n", 465 " (SA=%s)\n",
463 MAC_ARG(hdr->addr2)); 466 print_mac(mac, hdr->addr2));
464 ieee->ieee_stats.rx_discards_undecryptable++; 467 ieee->ieee_stats.rx_discards_undecryptable++;
465 goto rx_dropped; 468 goto rx_dropped;
466 } 469 }
@@ -471,8 +474,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
471 fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && 474 fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt &&
472 (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) { 475 (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) {
473 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " 476 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
474 "from " MAC_FMT "\n", dev->name, 477 "from %s\n", dev->name,
475 MAC_ARG(hdr->addr2)); 478 print_mac(mac, hdr->addr2));
476 /* TODO: could inform hostapd about this so that it 479 /* TODO: could inform hostapd about this so that it
477 * could send auth failure report */ 480 * could send auth failure report */
478 goto rx_dropped; 481 goto rx_dropped;
@@ -650,8 +653,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
650 * configured */ 653 * configured */
651 } else { 654 } else {
652 IEEE80211_DEBUG_DROP("encryption configured, but RX " 655 IEEE80211_DEBUG_DROP("encryption configured, but RX "
653 "frame not encrypted (SA=" MAC_FMT 656 "frame not encrypted (SA=%s"
654 ")\n", MAC_ARG(hdr->addr2)); 657 ")\n", print_mac(mac, hdr->addr2));
655 goto rx_dropped; 658 goto rx_dropped;
656 } 659 }
657 } 660 }
@@ -659,9 +662,9 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
659 if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && 662 if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep &&
660 !ieee80211_is_eapol_frame(ieee, skb)) { 663 !ieee80211_is_eapol_frame(ieee, skb)) {
661 IEEE80211_DEBUG_DROP("dropped unencrypted RX data " 664 IEEE80211_DEBUG_DROP("dropped unencrypted RX data "
662 "frame from " MAC_FMT 665 "frame from %s"
663 " (drop_unencrypted=1)\n", 666 " (drop_unencrypted=1)\n",
664 MAC_ARG(hdr->addr2)); 667 print_mac(mac, hdr->addr2));
665 goto rx_dropped; 668 goto rx_dropped;
666 } 669 }
667 670
@@ -1411,6 +1414,8 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021
1411 struct ieee80211_network *network, 1414 struct ieee80211_network *network,
1412 struct ieee80211_rx_stats *stats) 1415 struct ieee80211_rx_stats *stats)
1413{ 1416{
1417 DECLARE_MAC_BUF(mac);
1418
1414 network->qos_data.active = 0; 1419 network->qos_data.active = 0;
1415 network->qos_data.supported = 0; 1420 network->qos_data.supported = 0;
1416 network->qos_data.param_count = 0; 1421 network->qos_data.param_count = 0;
@@ -1457,11 +1462,11 @@ static int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee8021
1457 } 1462 }
1458 1463
1459 if (network->mode == 0) { 1464 if (network->mode == 0) {
1460 IEEE80211_DEBUG_SCAN("Filtered out '%s (" MAC_FMT ")' " 1465 IEEE80211_DEBUG_SCAN("Filtered out '%s (%s)' "
1461 "network.\n", 1466 "network.\n",
1462 escape_essid(network->ssid, 1467 escape_essid(network->ssid,
1463 network->ssid_len), 1468 network->ssid_len),
1464 MAC_ARG(network->bssid)); 1469 print_mac(mac, network->bssid));
1465 return 1; 1470 return 1;
1466 } 1471 }
1467 1472
@@ -1490,6 +1495,7 @@ static void update_network(struct ieee80211_network *dst,
1490{ 1495{
1491 int qos_active; 1496 int qos_active;
1492 u8 old_param; 1497 u8 old_param;
1498 DECLARE_MAC_BUF(mac);
1493 1499
1494 ieee80211_network_reset(dst); 1500 ieee80211_network_reset(dst);
1495 dst->ibss_dfs = src->ibss_dfs; 1501 dst->ibss_dfs = src->ibss_dfs;
@@ -1503,8 +1509,8 @@ static void update_network(struct ieee80211_network *dst,
1503 memcpy(&dst->stats, &src->stats, 1509 memcpy(&dst->stats, &src->stats,
1504 sizeof(struct ieee80211_rx_stats)); 1510 sizeof(struct ieee80211_rx_stats));
1505 else 1511 else
1506 IEEE80211_DEBUG_SCAN("Network " MAC_FMT " info received " 1512 IEEE80211_DEBUG_SCAN("Network %s info received "
1507 "off channel (%d vs. %d)\n", MAC_ARG(src->bssid), 1513 "off channel (%d vs. %d)\n", print_mac(mac, src->bssid),
1508 dst->channel, src->stats.received_channel); 1514 dst->channel, src->stats.received_channel);
1509 1515
1510 dst->capability = src->capability; 1516 dst->capability = src->capability;
@@ -1576,12 +1582,13 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1576 struct ieee80211_info_element *info_element = beacon->info_element; 1582 struct ieee80211_info_element *info_element = beacon->info_element;
1577#endif 1583#endif
1578 unsigned long flags; 1584 unsigned long flags;
1585 DECLARE_MAC_BUF(mac);
1579 1586
1580 IEEE80211_DEBUG_SCAN("'%s' (" MAC_FMT 1587 IEEE80211_DEBUG_SCAN("'%s' (%s"
1581 "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", 1588 "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n",
1582 escape_essid(info_element->data, 1589 escape_essid(info_element->data,
1583 info_element->len), 1590 info_element->len),
1584 MAC_ARG(beacon->header.addr3), 1591 print_mac(mac, beacon->header.addr3),
1585 (beacon->capability & (1 << 0xf)) ? '1' : '0', 1592 (beacon->capability & (1 << 0xf)) ? '1' : '0',
1586 (beacon->capability & (1 << 0xe)) ? '1' : '0', 1593 (beacon->capability & (1 << 0xe)) ? '1' : '0',
1587 (beacon->capability & (1 << 0xd)) ? '1' : '0', 1594 (beacon->capability & (1 << 0xd)) ? '1' : '0',
@@ -1600,10 +1607,10 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1600 (beacon->capability & (1 << 0x0)) ? '1' : '0'); 1607 (beacon->capability & (1 << 0x0)) ? '1' : '0');
1601 1608
1602 if (ieee80211_network_init(ieee, beacon, &network, stats)) { 1609 if (ieee80211_network_init(ieee, beacon, &network, stats)) {
1603 IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n", 1610 IEEE80211_DEBUG_SCAN("Dropped '%s' (%s) via %s.\n",
1604 escape_essid(info_element->data, 1611 escape_essid(info_element->data,
1605 info_element->len), 1612 info_element->len),
1606 MAC_ARG(beacon->header.addr3), 1613 print_mac(mac, beacon->header.addr3),
1607 is_beacon(beacon->header.frame_ctl) ? 1614 is_beacon(beacon->header.frame_ctl) ?
1608 "BEACON" : "PROBE RESPONSE"); 1615 "BEACON" : "PROBE RESPONSE");
1609 return; 1616 return;
@@ -1637,11 +1644,11 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1637 /* If there are no more slots, expire the oldest */ 1644 /* If there are no more slots, expire the oldest */
1638 list_del(&oldest->list); 1645 list_del(&oldest->list);
1639 target = oldest; 1646 target = oldest;
1640 IEEE80211_DEBUG_SCAN("Expired '%s' (" MAC_FMT ") from " 1647 IEEE80211_DEBUG_SCAN("Expired '%s' (%s) from "
1641 "network list.\n", 1648 "network list.\n",
1642 escape_essid(target->ssid, 1649 escape_essid(target->ssid,
1643 target->ssid_len), 1650 target->ssid_len),
1644 MAC_ARG(target->bssid)); 1651 print_mac(mac, target->bssid));
1645 ieee80211_network_reset(target); 1652 ieee80211_network_reset(target);
1646 } else { 1653 } else {
1647 /* Otherwise just pull from the free list */ 1654 /* Otherwise just pull from the free list */
@@ -1651,10 +1658,10 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1651 } 1658 }
1652 1659
1653#ifdef CONFIG_IEEE80211_DEBUG 1660#ifdef CONFIG_IEEE80211_DEBUG
1654 IEEE80211_DEBUG_SCAN("Adding '%s' (" MAC_FMT ") via %s.\n", 1661 IEEE80211_DEBUG_SCAN("Adding '%s' (%s) via %s.\n",
1655 escape_essid(network.ssid, 1662 escape_essid(network.ssid,
1656 network.ssid_len), 1663 network.ssid_len),
1657 MAC_ARG(network.bssid), 1664 print_mac(mac, network.bssid),
1658 is_beacon(beacon->header.frame_ctl) ? 1665 is_beacon(beacon->header.frame_ctl) ?
1659 "BEACON" : "PROBE RESPONSE"); 1666 "BEACON" : "PROBE RESPONSE");
1660#endif 1667#endif
@@ -1662,10 +1669,10 @@ static void ieee80211_process_probe_response(struct ieee80211_device
1662 network.ibss_dfs = NULL; 1669 network.ibss_dfs = NULL;
1663 list_add_tail(&target->list, &ieee->network_list); 1670 list_add_tail(&target->list, &ieee->network_list);
1664 } else { 1671 } else {
1665 IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n", 1672 IEEE80211_DEBUG_SCAN("Updating '%s' (%s) via %s.\n",
1666 escape_essid(target->ssid, 1673 escape_essid(target->ssid,
1667 target->ssid_len), 1674 target->ssid_len),
1668 MAC_ARG(target->bssid), 1675 print_mac(mac, target->bssid),
1669 is_beacon(beacon->header.frame_ctl) ? 1676 is_beacon(beacon->header.frame_ctl) ?
1670 "BEACON" : "PROBE RESPONSE"); 1677 "BEACON" : "PROBE RESPONSE");
1671 update_network(target, &network); 1678 update_network(target, &network);