aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap/hostap_ap.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2007-10-03 20:59:30 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:42 -0400
commit0795af5729b18218767fab27c44b1384f72dc9ad (patch)
tree67c16df84aa6ec219340b8ea1b5cfb0e8150a216 /drivers/net/wireless/hostap/hostap_ap.c
parent95ea36275f3c9a1d3d04c217b4b576c657c4e70e (diff)
[NET]: Introduce and use print_mac() and DECLARE_MAC_BUF()
This is nicer than the MAC_FMT stuff. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_ap.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c198
1 files changed, 114 insertions, 84 deletions
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 90900525379c..6bbdb76b32df 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -94,6 +94,7 @@ static void ap_sta_hash_add(struct ap_data *ap, struct sta_info *sta)
94static void ap_sta_hash_del(struct ap_data *ap, struct sta_info *sta) 94static void ap_sta_hash_del(struct ap_data *ap, struct sta_info *sta)
95{ 95{
96 struct sta_info *s; 96 struct sta_info *s;
97 DECLARE_MAC_BUF(mac);
97 98
98 s = ap->sta_hash[STA_HASH(sta->addr)]; 99 s = ap->sta_hash[STA_HASH(sta->addr)];
99 if (s == NULL) return; 100 if (s == NULL) return;
@@ -108,18 +109,20 @@ static void ap_sta_hash_del(struct ap_data *ap, struct sta_info *sta)
108 if (s->hnext != NULL) 109 if (s->hnext != NULL)
109 s->hnext = s->hnext->hnext; 110 s->hnext = s->hnext->hnext;
110 else 111 else
111 printk("AP: could not remove STA " MACSTR " from hash table\n", 112 printk("AP: could not remove STA %s"
112 MAC2STR(sta->addr)); 113 " from hash table\n",
114 print_mac(mac, sta->addr));
113} 115}
114 116
115static void ap_free_sta(struct ap_data *ap, struct sta_info *sta) 117static void ap_free_sta(struct ap_data *ap, struct sta_info *sta)
116{ 118{
119 DECLARE_MAC_BUF(mac);
117 if (sta->ap && sta->local) 120 if (sta->ap && sta->local)
118 hostap_event_expired_sta(sta->local->dev, sta); 121 hostap_event_expired_sta(sta->local->dev, sta);
119 122
120 if (ap->proc != NULL) { 123 if (ap->proc != NULL) {
121 char name[20]; 124 char name[20];
122 sprintf(name, MACSTR, MAC2STR(sta->addr)); 125 sprintf(name, "%s", print_mac(mac, sta->addr));
123 remove_proc_entry(name, ap->proc); 126 remove_proc_entry(name, ap->proc);
124 } 127 }
125 128
@@ -182,6 +185,7 @@ static void ap_handle_timer(unsigned long data)
182 struct ap_data *ap; 185 struct ap_data *ap;
183 unsigned long next_time = 0; 186 unsigned long next_time = 0;
184 int was_assoc; 187 int was_assoc;
188 DECLARE_MAC_BUF(mac);
185 189
186 if (sta == NULL || sta->local == NULL || sta->local->ap == NULL) { 190 if (sta == NULL || sta->local == NULL || sta->local->ap == NULL) {
187 PDEBUG(DEBUG_AP, "ap_handle_timer() called with NULL data\n"); 191 PDEBUG(DEBUG_AP, "ap_handle_timer() called with NULL data\n");
@@ -238,8 +242,8 @@ static void ap_handle_timer(unsigned long data)
238 if (sta->ap) { 242 if (sta->ap) {
239 if (ap->autom_ap_wds) { 243 if (ap->autom_ap_wds) {
240 PDEBUG(DEBUG_AP, "%s: removing automatic WDS " 244 PDEBUG(DEBUG_AP, "%s: removing automatic WDS "
241 "connection to AP " MACSTR "\n", 245 "connection to AP %s\n",
242 local->dev->name, MAC2STR(sta->addr)); 246 local->dev->name, print_mac(mac, sta->addr));
243 hostap_wds_link_oper(local, sta->addr, WDS_DEL); 247 hostap_wds_link_oper(local, sta->addr, WDS_DEL);
244 } 248 }
245 } else if (sta->timeout_next == STA_NULLFUNC) { 249 } else if (sta->timeout_next == STA_NULLFUNC) {
@@ -255,11 +259,11 @@ static void ap_handle_timer(unsigned long data)
255 } else { 259 } else {
256 int deauth = sta->timeout_next == STA_DEAUTH; 260 int deauth = sta->timeout_next == STA_DEAUTH;
257 u16 resp; 261 u16 resp;
258 PDEBUG(DEBUG_AP, "%s: sending %s info to STA " MACSTR 262 PDEBUG(DEBUG_AP, "%s: sending %s info to STA %s"
259 "(last=%lu, jiffies=%lu)\n", 263 "(last=%lu, jiffies=%lu)\n",
260 local->dev->name, 264 local->dev->name,
261 deauth ? "deauthentication" : "disassociation", 265 deauth ? "deauthentication" : "disassociation",
262 MAC2STR(sta->addr), sta->last_rx, jiffies); 266 print_mac(mac, sta->addr), sta->last_rx, jiffies);
263 267
264 resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID : 268 resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID :
265 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); 269 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
@@ -271,9 +275,10 @@ static void ap_handle_timer(unsigned long data)
271 275
272 if (sta->timeout_next == STA_DEAUTH) { 276 if (sta->timeout_next == STA_DEAUTH) {
273 if (sta->flags & WLAN_STA_PERM) { 277 if (sta->flags & WLAN_STA_PERM) {
274 PDEBUG(DEBUG_AP, "%s: STA " MACSTR " would have been " 278 PDEBUG(DEBUG_AP, "%s: STA %s"
275 "removed, but it has 'perm' flag\n", 279 " would have been removed, "
276 local->dev->name, MAC2STR(sta->addr)); 280 "but it has 'perm' flag\n",
281 local->dev->name, print_mac(mac, sta->addr));
277 } else 282 } else
278 ap_free_sta(ap, sta); 283 ap_free_sta(ap, sta);
279 return; 284 return;
@@ -327,6 +332,7 @@ static int ap_control_proc_read(char *page, char **start, off_t off,
327 struct ap_data *ap = (struct ap_data *) data; 332 struct ap_data *ap = (struct ap_data *) data;
328 char *policy_txt; 333 char *policy_txt;
329 struct mac_entry *entry; 334 struct mac_entry *entry;
335 DECLARE_MAC_BUF(mac);
330 336
331 if (off != 0) { 337 if (off != 0) {
332 *eof = 1; 338 *eof = 1;
@@ -357,7 +363,7 @@ static int ap_control_proc_read(char *page, char **start, off_t off,
357 break; 363 break;
358 } 364 }
359 365
360 p += sprintf(p, MACSTR "\n", MAC2STR(entry->addr)); 366 p += sprintf(p, "%s\n", print_mac(mac, entry->addr));
361 } 367 }
362 spin_unlock_bh(&ap->mac_restrictions.lock); 368 spin_unlock_bh(&ap->mac_restrictions.lock);
363 369
@@ -514,6 +520,7 @@ static int prism2_ap_proc_read(char *page, char **start, off_t off,
514 struct ap_data *ap = (struct ap_data *) data; 520 struct ap_data *ap = (struct ap_data *) data;
515 struct sta_info *sta; 521 struct sta_info *sta;
516 int i; 522 int i;
523 DECLARE_MAC_BUF(mac);
517 524
518 if (off > PROC_LIMIT) { 525 if (off > PROC_LIMIT) {
519 *eof = 1; 526 *eof = 1;
@@ -526,7 +533,8 @@ static int prism2_ap_proc_read(char *page, char **start, off_t off,
526 if (!sta->ap) 533 if (!sta->ap)
527 continue; 534 continue;
528 535
529 p += sprintf(p, MACSTR " %d %d %d %d '", MAC2STR(sta->addr), 536 p += sprintf(p, "%s %d %d %d %d '",
537 print_mac(mac, sta->addr),
530 sta->u.ap.channel, sta->last_rx_signal, 538 sta->u.ap.channel, sta->last_rx_signal,
531 sta->last_rx_silence, sta->last_rx_rate); 539 sta->last_rx_silence, sta->last_rx_rate);
532 for (i = 0; i < sta->u.ap.ssid_len; i++) 540 for (i = 0; i < sta->u.ap.ssid_len; i++)
@@ -623,6 +631,7 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
623 u16 fc, *pos, auth_alg, auth_transaction, status; 631 u16 fc, *pos, auth_alg, auth_transaction, status;
624 struct sta_info *sta = NULL; 632 struct sta_info *sta = NULL;
625 char *txt = NULL; 633 char *txt = NULL;
634 DECLARE_MAC_BUF(mac);
626 635
627 if (ap->local->hostapd) { 636 if (ap->local->hostapd) {
628 dev_kfree_skb(skb); 637 dev_kfree_skb(skb);
@@ -674,9 +683,9 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
674 if (sta) 683 if (sta)
675 atomic_dec(&sta->users); 684 atomic_dec(&sta->users);
676 if (txt) { 685 if (txt) {
677 PDEBUG(DEBUG_AP, "%s: " MACSTR " auth_cb - alg=%d trans#=%d " 686 PDEBUG(DEBUG_AP, "%s: %s auth_cb - alg=%d "
678 "status=%d - %s\n", 687 "trans#=%d status=%d - %s\n",
679 dev->name, MAC2STR(hdr->addr1), auth_alg, 688 dev->name, print_mac(mac, hdr->addr1), auth_alg,
680 auth_transaction, status, txt); 689 auth_transaction, status, txt);
681 } 690 }
682 dev_kfree_skb(skb); 691 dev_kfree_skb(skb);
@@ -692,6 +701,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
692 u16 fc, *pos, status; 701 u16 fc, *pos, status;
693 struct sta_info *sta = NULL; 702 struct sta_info *sta = NULL;
694 char *txt = NULL; 703 char *txt = NULL;
704 DECLARE_MAC_BUF(mac);
695 705
696 if (ap->local->hostapd) { 706 if (ap->local->hostapd) {
697 dev_kfree_skb(skb); 707 dev_kfree_skb(skb);
@@ -742,8 +752,8 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
742 if (sta) 752 if (sta)
743 atomic_dec(&sta->users); 753 atomic_dec(&sta->users);
744 if (txt) { 754 if (txt) {
745 PDEBUG(DEBUG_AP, "%s: " MACSTR " assoc_cb - %s\n", 755 PDEBUG(DEBUG_AP, "%s: %s assoc_cb - %s\n",
746 dev->name, MAC2STR(hdr->addr1), txt); 756 dev->name, print_mac(mac, hdr->addr1), txt);
747 } 757 }
748 dev_kfree_skb(skb); 758 dev_kfree_skb(skb);
749} 759}
@@ -755,6 +765,7 @@ static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data)
755 struct ap_data *ap = data; 765 struct ap_data *ap = data;
756 struct ieee80211_hdr_4addr *hdr; 766 struct ieee80211_hdr_4addr *hdr;
757 struct sta_info *sta; 767 struct sta_info *sta;
768 DECLARE_MAC_BUF(mac);
758 769
759 if (skb->len < 24) 770 if (skb->len < 24)
760 goto fail; 771 goto fail;
@@ -766,9 +777,9 @@ static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data)
766 sta->flags &= ~WLAN_STA_PENDING_POLL; 777 sta->flags &= ~WLAN_STA_PENDING_POLL;
767 spin_unlock(&ap->sta_table_lock); 778 spin_unlock(&ap->sta_table_lock);
768 } else { 779 } else {
769 PDEBUG(DEBUG_AP, "%s: STA " MACSTR " did not ACK activity " 780 PDEBUG(DEBUG_AP, "%s: STA %s"
770 "poll frame\n", ap->local->dev->name, 781 " did not ACK activity poll frame\n",
771 MAC2STR(hdr->addr1)); 782 ap->local->dev->name, print_mac(mac, hdr->addr1));
772 } 783 }
773 784
774 fail: 785 fail:
@@ -985,6 +996,7 @@ static int prism2_sta_proc_read(char *page, char **start, off_t off,
985 char *p = page; 996 char *p = page;
986 struct sta_info *sta = (struct sta_info *) data; 997 struct sta_info *sta = (struct sta_info *) data;
987 int i; 998 int i;
999 DECLARE_MAC_BUF(mac);
988 1000
989 /* FIX: possible race condition.. the STA data could have just expired, 1001 /* FIX: possible race condition.. the STA data could have just expired,
990 * but proc entry was still here so that the read could have started; 1002 * but proc entry was still here so that the read could have started;
@@ -995,11 +1007,11 @@ static int prism2_sta_proc_read(char *page, char **start, off_t off,
995 return 0; 1007 return 0;
996 } 1008 }
997 1009
998 p += sprintf(p, "%s=" MACSTR "\nusers=%d\naid=%d\n" 1010 p += sprintf(p, "%s=%s\nusers=%d\naid=%d\n"
999 "flags=0x%04x%s%s%s%s%s%s%s\n" 1011 "flags=0x%04x%s%s%s%s%s%s%s\n"
1000 "capability=0x%02x\nlisten_interval=%d\nsupported_rates=", 1012 "capability=0x%02x\nlisten_interval=%d\nsupported_rates=",
1001 sta->ap ? "AP" : "STA", 1013 sta->ap ? "AP" : "STA",
1002 MAC2STR(sta->addr), atomic_read(&sta->users), sta->aid, 1014 print_mac(mac, sta->addr), atomic_read(&sta->users), sta->aid,
1003 sta->flags, 1015 sta->flags,
1004 sta->flags & WLAN_STA_AUTH ? " AUTH" : "", 1016 sta->flags & WLAN_STA_AUTH ? " AUTH" : "",
1005 sta->flags & WLAN_STA_ASSOC ? " ASSOC" : "", 1017 sta->flags & WLAN_STA_ASSOC ? " ASSOC" : "",
@@ -1060,6 +1072,7 @@ static void handle_add_proc_queue(struct work_struct *work)
1060 struct sta_info *sta; 1072 struct sta_info *sta;
1061 char name[20]; 1073 char name[20];
1062 struct add_sta_proc_data *entry, *prev; 1074 struct add_sta_proc_data *entry, *prev;
1075 DECLARE_MAC_BUF(mac);
1063 1076
1064 entry = ap->add_sta_proc_entries; 1077 entry = ap->add_sta_proc_entries;
1065 ap->add_sta_proc_entries = NULL; 1078 ap->add_sta_proc_entries = NULL;
@@ -1072,7 +1085,7 @@ static void handle_add_proc_queue(struct work_struct *work)
1072 spin_unlock_bh(&ap->sta_table_lock); 1085 spin_unlock_bh(&ap->sta_table_lock);
1073 1086
1074 if (sta) { 1087 if (sta) {
1075 sprintf(name, MACSTR, MAC2STR(sta->addr)); 1088 sprintf(name, "%s", print_mac(mac, sta->addr));
1076 sta->proc = create_proc_read_entry( 1089 sta->proc = create_proc_read_entry(
1077 name, 0, ap->proc, 1090 name, 0, ap->proc,
1078 prism2_sta_proc_read, sta); 1091 prism2_sta_proc_read, sta);
@@ -1290,6 +1303,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1290 struct sta_info *sta = NULL; 1303 struct sta_info *sta = NULL;
1291 struct ieee80211_crypt_data *crypt; 1304 struct ieee80211_crypt_data *crypt;
1292 char *txt = ""; 1305 char *txt = "";
1306 DECLARE_MAC_BUF(mac);
1293 1307
1294 len = skb->len - IEEE80211_MGMT_HDR_LEN; 1308 len = skb->len - IEEE80211_MGMT_HDR_LEN;
1295 1309
@@ -1298,8 +1312,8 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1298 1312
1299 if (len < 6) { 1313 if (len < 6) {
1300 PDEBUG(DEBUG_AP, "%s: handle_authen - too short payload " 1314 PDEBUG(DEBUG_AP, "%s: handle_authen - too short payload "
1301 "(len=%d) from " MACSTR "\n", dev->name, len, 1315 "(len=%d) from %s\n", dev->name, len,
1302 MAC2STR(hdr->addr2)); 1316 print_mac(mac, hdr->addr2));
1303 return; 1317 return;
1304 } 1318 }
1305 1319
@@ -1364,8 +1378,8 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1364 if (time_after(jiffies, sta->u.ap.last_beacon + 1378 if (time_after(jiffies, sta->u.ap.last_beacon +
1365 (10 * sta->listen_interval * HZ) / 1024)) { 1379 (10 * sta->listen_interval * HZ) / 1024)) {
1366 PDEBUG(DEBUG_AP, "%s: no beacons received for a while," 1380 PDEBUG(DEBUG_AP, "%s: no beacons received for a while,"
1367 " assuming AP " MACSTR " is now STA\n", 1381 " assuming AP %s is now STA\n",
1368 dev->name, MAC2STR(sta->addr)); 1382 dev->name, print_mac(mac, sta->addr));
1369 sta->ap = 0; 1383 sta->ap = 0;
1370 sta->flags = 0; 1384 sta->flags = 0;
1371 sta->u.sta.challenge = NULL; 1385 sta->u.sta.challenge = NULL;
@@ -1480,9 +1494,9 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1480 } 1494 }
1481 1495
1482 if (resp) { 1496 if (resp) {
1483 PDEBUG(DEBUG_AP, "%s: " MACSTR " auth (alg=%d trans#=%d " 1497 PDEBUG(DEBUG_AP, "%s: %s auth (alg=%d "
1484 "stat=%d len=%d fc=%04x) ==> %d (%s)\n", 1498 "trans#=%d stat=%d len=%d fc=%04x) ==> %d (%s)\n",
1485 dev->name, MAC2STR(hdr->addr2), auth_alg, 1499 dev->name, print_mac(mac, hdr->addr2), auth_alg,
1486 auth_transaction, status_code, len, fc, resp, txt); 1500 auth_transaction, status_code, len, fc, resp, txt);
1487 } 1501 }
1488} 1502}
@@ -1502,13 +1516,14 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1502 int send_deauth = 0; 1516 int send_deauth = 0;
1503 char *txt = ""; 1517 char *txt = "";
1504 u8 prev_ap[ETH_ALEN]; 1518 u8 prev_ap[ETH_ALEN];
1519 DECLARE_MAC_BUF(mac);
1505 1520
1506 left = len = skb->len - IEEE80211_MGMT_HDR_LEN; 1521 left = len = skb->len - IEEE80211_MGMT_HDR_LEN;
1507 1522
1508 if (len < (reassoc ? 10 : 4)) { 1523 if (len < (reassoc ? 10 : 4)) {
1509 PDEBUG(DEBUG_AP, "%s: handle_assoc - too short payload " 1524 PDEBUG(DEBUG_AP, "%s: handle_assoc - too short payload "
1510 "(len=%d, reassoc=%d) from " MACSTR "\n", 1525 "(len=%d, reassoc=%d) from %s\n",
1511 dev->name, len, reassoc, MAC2STR(hdr->addr2)); 1526 dev->name, len, reassoc, print_mac(mac, hdr->addr2));
1512 return; 1527 return;
1513 } 1528 }
1514 1529
@@ -1585,9 +1600,9 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1585 } 1600 }
1586 1601
1587 if (left > 0) { 1602 if (left > 0) {
1588 PDEBUG(DEBUG_AP, "%s: assoc from " MACSTR " with extra" 1603 PDEBUG(DEBUG_AP, "%s: assoc from %s"
1589 " data (%d bytes) [", 1604 " with extra data (%d bytes) [",
1590 dev->name, MAC2STR(hdr->addr2), left); 1605 dev->name, print_mac(mac, hdr->addr2), left);
1591 while (left > 0) { 1606 while (left > 0) {
1592 PDEBUG2(DEBUG_AP, "<%02x>", *u); 1607 PDEBUG2(DEBUG_AP, "<%02x>", *u);
1593 u++; left--; 1608 u++; left--;
@@ -1687,10 +1702,10 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1687 } 1702 }
1688 1703
1689#if 0 1704#if 0
1690 PDEBUG(DEBUG_AP, "%s: " MACSTR " %sassoc (len=%d prev_ap=" MACSTR 1705 PDEBUG(DEBUG_AP, "%s: %s %sassoc (len=%d "
1691 ") => %d(%d) (%s)\n", 1706 "prev_ap=%s) => %d(%d) (%s)\n",
1692 dev->name, MAC2STR(hdr->addr2), reassoc ? "re" : "", len, 1707 dev->name, print_mac(mac, hdr->addr2), reassoc ? "re" : "", len,
1693 MAC2STR(prev_ap), resp, send_deauth, txt); 1708 print_mac(mac, prev_ap), resp, send_deauth, txt);
1694#endif 1709#endif
1695} 1710}
1696 1711
@@ -1705,6 +1720,7 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
1705 int len; 1720 int len;
1706 u16 reason_code, *pos; 1721 u16 reason_code, *pos;
1707 struct sta_info *sta = NULL; 1722 struct sta_info *sta = NULL;
1723 DECLARE_MAC_BUF(mac);
1708 1724
1709 len = skb->len - IEEE80211_MGMT_HDR_LEN; 1725 len = skb->len - IEEE80211_MGMT_HDR_LEN;
1710 1726
@@ -1716,8 +1732,8 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
1716 pos = (u16 *) body; 1732 pos = (u16 *) body;
1717 reason_code = __le16_to_cpu(*pos); 1733 reason_code = __le16_to_cpu(*pos);
1718 1734
1719 PDEBUG(DEBUG_AP, "%s: deauthentication: " MACSTR " len=%d, " 1735 PDEBUG(DEBUG_AP, "%s: deauthentication: %s len=%d, "
1720 "reason_code=%d\n", dev->name, MAC2STR(hdr->addr2), len, 1736 "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len,
1721 reason_code); 1737 reason_code);
1722 1738
1723 spin_lock_bh(&local->ap->sta_table_lock); 1739 spin_lock_bh(&local->ap->sta_table_lock);
@@ -1729,9 +1745,9 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
1729 } 1745 }
1730 spin_unlock_bh(&local->ap->sta_table_lock); 1746 spin_unlock_bh(&local->ap->sta_table_lock);
1731 if (sta == NULL) { 1747 if (sta == NULL) {
1732 printk("%s: deauthentication from " MACSTR ", " 1748 printk("%s: deauthentication from %s, "
1733 "reason_code=%d, but STA not authenticated\n", dev->name, 1749 "reason_code=%d, but STA not authenticated\n", dev->name,
1734 MAC2STR(hdr->addr2), reason_code); 1750 print_mac(mac, hdr->addr2), reason_code);
1735 } 1751 }
1736} 1752}
1737 1753
@@ -1746,6 +1762,7 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1746 int len; 1762 int len;
1747 u16 reason_code, *pos; 1763 u16 reason_code, *pos;
1748 struct sta_info *sta = NULL; 1764 struct sta_info *sta = NULL;
1765 DECLARE_MAC_BUF(mac);
1749 1766
1750 len = skb->len - IEEE80211_MGMT_HDR_LEN; 1767 len = skb->len - IEEE80211_MGMT_HDR_LEN;
1751 1768
@@ -1757,8 +1774,8 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1757 pos = (u16 *) body; 1774 pos = (u16 *) body;
1758 reason_code = __le16_to_cpu(*pos); 1775 reason_code = __le16_to_cpu(*pos);
1759 1776
1760 PDEBUG(DEBUG_AP, "%s: disassociation: " MACSTR " len=%d, " 1777 PDEBUG(DEBUG_AP, "%s: disassociation: %s len=%d, "
1761 "reason_code=%d\n", dev->name, MAC2STR(hdr->addr2), len, 1778 "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len,
1762 reason_code); 1779 reason_code);
1763 1780
1764 spin_lock_bh(&local->ap->sta_table_lock); 1781 spin_lock_bh(&local->ap->sta_table_lock);
@@ -1770,9 +1787,9 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1770 } 1787 }
1771 spin_unlock_bh(&local->ap->sta_table_lock); 1788 spin_unlock_bh(&local->ap->sta_table_lock);
1772 if (sta == NULL) { 1789 if (sta == NULL) {
1773 printk("%s: disassociation from " MACSTR ", " 1790 printk("%s: disassociation from %s, "
1774 "reason_code=%d, but STA not authenticated\n", 1791 "reason_code=%d, but STA not authenticated\n",
1775 dev->name, MAC2STR(hdr->addr2), reason_code); 1792 dev->name, print_mac(mac, hdr->addr2), reason_code);
1776 } 1793 }
1777} 1794}
1778 1795
@@ -1862,15 +1879,16 @@ static void handle_pspoll(local_info_t *local,
1862 struct sta_info *sta; 1879 struct sta_info *sta;
1863 u16 aid; 1880 u16 aid;
1864 struct sk_buff *skb; 1881 struct sk_buff *skb;
1882 DECLARE_MAC_BUF(mac);
1865 1883
1866 PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MACSTR ", TA=" MACSTR 1884 PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=%s"
1867 " PWRMGT=%d\n", 1885 ", TA=%s PWRMGT=%d\n",
1868 MAC2STR(hdr->addr1), MAC2STR(hdr->addr2), 1886 print_mac(mac, hdr->addr1), print_mac(mac, hdr->addr2),
1869 !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM)); 1887 !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM));
1870 1888
1871 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { 1889 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
1872 PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MACSTR 1890 PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=%s"
1873 " not own MAC\n", MAC2STR(hdr->addr1)); 1891 " not own MAC\n", print_mac(mac, hdr->addr1));
1874 return; 1892 return;
1875 } 1893 }
1876 1894
@@ -1948,6 +1966,7 @@ static void handle_wds_oper_queue(struct work_struct *work)
1948 wds_oper_queue); 1966 wds_oper_queue);
1949 local_info_t *local = ap->local; 1967 local_info_t *local = ap->local;
1950 struct wds_oper_data *entry, *prev; 1968 struct wds_oper_data *entry, *prev;
1969 DECLARE_MAC_BUF(mac);
1951 1970
1952 spin_lock_bh(&local->lock); 1971 spin_lock_bh(&local->lock);
1953 entry = local->ap->wds_oper_entries; 1972 entry = local->ap->wds_oper_entries;
@@ -1956,10 +1975,10 @@ static void handle_wds_oper_queue(struct work_struct *work)
1956 1975
1957 while (entry) { 1976 while (entry) {
1958 PDEBUG(DEBUG_AP, "%s: %s automatic WDS connection " 1977 PDEBUG(DEBUG_AP, "%s: %s automatic WDS connection "
1959 "to AP " MACSTR "\n", 1978 "to AP %s\n",
1960 local->dev->name, 1979 local->dev->name,
1961 entry->type == WDS_ADD ? "adding" : "removing", 1980 entry->type == WDS_ADD ? "adding" : "removing",
1962 MAC2STR(entry->addr)); 1981 print_mac(mac, entry->addr));
1963 if (entry->type == WDS_ADD) 1982 if (entry->type == WDS_ADD)
1964 prism2_wds_add(local, entry->addr, 0); 1983 prism2_wds_add(local, entry->addr, 0);
1965 else if (entry->type == WDS_DEL) 1984 else if (entry->type == WDS_DEL)
@@ -2135,6 +2154,7 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2135#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2154#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
2136 u16 fc, type, stype; 2155 u16 fc, type, stype;
2137 struct ieee80211_hdr_4addr *hdr; 2156 struct ieee80211_hdr_4addr *hdr;
2157 DECLARE_MAC_BUF(mac);
2138 2158
2139 /* FIX: should give skb->len to handler functions and check that the 2159 /* FIX: should give skb->len to handler functions and check that the
2140 * buffer is long enough */ 2160 * buffer is long enough */
@@ -2163,8 +2183,8 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2163 2183
2164 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { 2184 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
2165 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)=" 2185 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)="
2166 MACSTR " not own MAC\n", 2186 "%s not own MAC\n",
2167 MAC2STR(hdr->addr1)); 2187 print_mac(mac, hdr->addr1));
2168 goto done; 2188 goto done;
2169 } 2189 }
2170 2190
@@ -2200,14 +2220,14 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2200 } 2220 }
2201 2221
2202 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { 2222 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
2203 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=" MACSTR 2223 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=%s"
2204 " not own MAC\n", MAC2STR(hdr->addr1)); 2224 " not own MAC\n", print_mac(mac, hdr->addr1));
2205 goto done; 2225 goto done;
2206 } 2226 }
2207 2227
2208 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) { 2228 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) {
2209 PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=" MACSTR 2229 PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=%s"
2210 " not own MAC\n", MAC2STR(hdr->addr3)); 2230 " not own MAC\n", print_mac(mac, hdr->addr3));
2211 goto done; 2231 goto done;
2212 } 2232 }
2213 2233
@@ -2288,6 +2308,7 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
2288 struct sk_buff *skb; 2308 struct sk_buff *skb;
2289 struct ieee80211_hdr_4addr *hdr; 2309 struct ieee80211_hdr_4addr *hdr;
2290 struct hostap_80211_rx_status rx_stats; 2310 struct hostap_80211_rx_status rx_stats;
2311 DECLARE_MAC_BUF(mac);
2291 2312
2292 if (skb_queue_empty(&sta->tx_buf)) 2313 if (skb_queue_empty(&sta->tx_buf))
2293 return; 2314 return;
@@ -2308,8 +2329,8 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
2308 memcpy(hdr->addr2, sta->addr, ETH_ALEN); 2329 memcpy(hdr->addr2, sta->addr, ETH_ALEN);
2309 hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14)); 2330 hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14));
2310 2331
2311 PDEBUG(DEBUG_PS2, "%s: Scheduling buffered packet delivery for " 2332 PDEBUG(DEBUG_PS2, "%s: Scheduling buffered packet delivery for STA "
2312 "STA " MACSTR "\n", local->dev->name, MAC2STR(sta->addr)); 2333 "%s\n", local->dev->name, print_mac(mac, sta->addr));
2313 2334
2314 skb->dev = local->dev; 2335 skb->dev = local->dev;
2315 2336
@@ -2636,6 +2657,7 @@ static int ap_update_sta_tx_rate(struct sta_info *sta, struct net_device *dev)
2636 int ret = sta->tx_rate; 2657 int ret = sta->tx_rate;
2637 struct hostap_interface *iface; 2658 struct hostap_interface *iface;
2638 local_info_t *local; 2659 local_info_t *local;
2660 DECLARE_MAC_BUF(mac);
2639 2661
2640 iface = netdev_priv(dev); 2662 iface = netdev_priv(dev);
2641 local = iface->local; 2663 local = iface->local;
@@ -2663,9 +2685,9 @@ static int ap_update_sta_tx_rate(struct sta_info *sta, struct net_device *dev)
2663 case 3: sta->tx_rate = 110; break; 2685 case 3: sta->tx_rate = 110; break;
2664 default: sta->tx_rate = 0; break; 2686 default: sta->tx_rate = 0; break;
2665 } 2687 }
2666 PDEBUG(DEBUG_AP, "%s: STA " MACSTR " TX rate raised to" 2688 PDEBUG(DEBUG_AP, "%s: STA %s"
2667 " %d\n", dev->name, MAC2STR(sta->addr), 2689 " TX rate raised to %d\n",
2668 sta->tx_rate); 2690 dev->name, print_mac(mac, sta->addr), sta->tx_rate);
2669 } 2691 }
2670 sta->tx_since_last_failure = 0; 2692 sta->tx_since_last_failure = 0;
2671 } 2693 }
@@ -2683,6 +2705,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2683 int set_tim, ret; 2705 int set_tim, ret;
2684 struct ieee80211_hdr_4addr *hdr; 2706 struct ieee80211_hdr_4addr *hdr;
2685 struct hostap_skb_tx_data *meta; 2707 struct hostap_skb_tx_data *meta;
2708 DECLARE_MAC_BUF(mac);
2686 2709
2687 meta = (struct hostap_skb_tx_data *) skb->cb; 2710 meta = (struct hostap_skb_tx_data *) skb->cb;
2688 ret = AP_TX_CONTINUE; 2711 ret = AP_TX_CONTINUE;
@@ -2718,7 +2741,8 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2718 * print out any errors here. */ 2741 * print out any errors here. */
2719 if (net_ratelimit()) { 2742 if (net_ratelimit()) {
2720 printk(KERN_DEBUG "AP: drop packet to non-associated " 2743 printk(KERN_DEBUG "AP: drop packet to non-associated "
2721 "STA " MACSTR "\n", MAC2STR(hdr->addr1)); 2744 "STA %s\n",
2745 print_mac(mac, hdr->addr1));
2722 } 2746 }
2723#endif 2747#endif
2724 local->ap->tx_drop_nonassoc++; 2748 local->ap->tx_drop_nonassoc++;
@@ -2756,8 +2780,9 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2756 } 2780 }
2757 2781
2758 if (skb_queue_len(&sta->tx_buf) >= STA_MAX_TX_BUFFER) { 2782 if (skb_queue_len(&sta->tx_buf) >= STA_MAX_TX_BUFFER) {
2759 PDEBUG(DEBUG_PS, "%s: No more space in STA (" MACSTR ")'s PS " 2783 PDEBUG(DEBUG_PS, "%s: No more space in STA (%s"
2760 "mode buffer\n", local->dev->name, MAC2STR(sta->addr)); 2784 ")'s PS mode buffer\n",
2785 local->dev->name, print_mac(mac, sta->addr));
2761 /* Make sure that TIM is set for the station (it might not be 2786 /* Make sure that TIM is set for the station (it might not be
2762 * after AP wlan hw reset). */ 2787 * after AP wlan hw reset). */
2763 /* FIX: should fix hw reset to restore bits based on STA 2788 /* FIX: should fix hw reset to restore bits based on STA
@@ -2821,6 +2846,7 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2821 struct sta_info *sta; 2846 struct sta_info *sta;
2822 struct ieee80211_hdr_4addr *hdr; 2847 struct ieee80211_hdr_4addr *hdr;
2823 struct hostap_skb_tx_data *meta; 2848 struct hostap_skb_tx_data *meta;
2849 DECLARE_MAC_BUF(mac);
2824 2850
2825 hdr = (struct ieee80211_hdr_4addr *) skb->data; 2851 hdr = (struct ieee80211_hdr_4addr *) skb->data;
2826 meta = (struct hostap_skb_tx_data *) skb->cb; 2852 meta = (struct hostap_skb_tx_data *) skb->cb;
@@ -2829,9 +2855,9 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2829 sta = ap_get_sta(local->ap, hdr->addr1); 2855 sta = ap_get_sta(local->ap, hdr->addr1);
2830 if (!sta) { 2856 if (!sta) {
2831 spin_unlock(&local->ap->sta_table_lock); 2857 spin_unlock(&local->ap->sta_table_lock);
2832 PDEBUG(DEBUG_AP, "%s: Could not find STA " MACSTR " for this " 2858 PDEBUG(DEBUG_AP, "%s: Could not find STA %s"
2833 "TX error (@%lu)\n", 2859 " for this TX error (@%lu)\n",
2834 local->dev->name, MAC2STR(hdr->addr1), jiffies); 2860 local->dev->name, print_mac(mac, hdr->addr1), jiffies);
2835 return; 2861 return;
2836 } 2862 }
2837 2863
@@ -2858,8 +2884,9 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2858 case 3: sta->tx_rate = 110; break; 2884 case 3: sta->tx_rate = 110; break;
2859 default: sta->tx_rate = 0; break; 2885 default: sta->tx_rate = 0; break;
2860 } 2886 }
2861 PDEBUG(DEBUG_AP, "%s: STA " MACSTR " TX rate lowered " 2887 PDEBUG(DEBUG_AP, "%s: STA %s"
2862 "to %d\n", local->dev->name, MAC2STR(sta->addr), 2888 " TX rate lowered to %d\n",
2889 local->dev->name, print_mac(mac, sta->addr),
2863 sta->tx_rate); 2890 sta->tx_rate);
2864 } 2891 }
2865 sta->tx_consecutive_exc = 0; 2892 sta->tx_consecutive_exc = 0;
@@ -2871,16 +2898,17 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2871static void hostap_update_sta_ps2(local_info_t *local, struct sta_info *sta, 2898static void hostap_update_sta_ps2(local_info_t *local, struct sta_info *sta,
2872 int pwrmgt, int type, int stype) 2899 int pwrmgt, int type, int stype)
2873{ 2900{
2901 DECLARE_MAC_BUF(mac);
2874 if (pwrmgt && !(sta->flags & WLAN_STA_PS)) { 2902 if (pwrmgt && !(sta->flags & WLAN_STA_PS)) {
2875 sta->flags |= WLAN_STA_PS; 2903 sta->flags |= WLAN_STA_PS;
2876 PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to use PS " 2904 PDEBUG(DEBUG_PS2, "STA %s changed to use PS "
2877 "mode (type=0x%02X, stype=0x%02X)\n", 2905 "mode (type=0x%02X, stype=0x%02X)\n",
2878 MAC2STR(sta->addr), type >> 2, stype >> 4); 2906 print_mac(mac, sta->addr), type >> 2, stype >> 4);
2879 } else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) { 2907 } else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) {
2880 sta->flags &= ~WLAN_STA_PS; 2908 sta->flags &= ~WLAN_STA_PS;
2881 PDEBUG(DEBUG_PS2, "STA " MACSTR " changed to not use " 2909 PDEBUG(DEBUG_PS2, "STA %s changed to not use "
2882 "PS mode (type=0x%02X, stype=0x%02X)\n", 2910 "PS mode (type=0x%02X, stype=0x%02X)\n",
2883 MAC2STR(sta->addr), type >> 2, stype >> 4); 2911 print_mac(mac, sta->addr), type >> 2, stype >> 4);
2884 if (type != IEEE80211_FTYPE_CTL || 2912 if (type != IEEE80211_FTYPE_CTL ||
2885 stype != IEEE80211_STYPE_PSPOLL) 2913 stype != IEEE80211_STYPE_PSPOLL)
2886 schedule_packet_send(local, sta); 2914 schedule_packet_send(local, sta);
@@ -2924,6 +2952,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2924 struct sta_info *sta; 2952 struct sta_info *sta;
2925 u16 fc, type, stype; 2953 u16 fc, type, stype;
2926 struct ieee80211_hdr_4addr *hdr; 2954 struct ieee80211_hdr_4addr *hdr;
2955 DECLARE_MAC_BUF(mac);
2927 2956
2928 if (local->ap == NULL) 2957 if (local->ap == NULL)
2929 return AP_RX_CONTINUE; 2958 return AP_RX_CONTINUE;
@@ -2954,9 +2983,10 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2954#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT 2983#ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
2955 } else { 2984 } else {
2956 printk(KERN_DEBUG "%s: dropped received packet" 2985 printk(KERN_DEBUG "%s: dropped received packet"
2957 " from non-associated STA " MACSTR 2986 " from non-associated STA "
2987 "%s"
2958 " (type=0x%02x, subtype=0x%02x)\n", 2988 " (type=0x%02x, subtype=0x%02x)\n",
2959 dev->name, MAC2STR(hdr->addr2), 2989 dev->name, print_mac(mac, hdr->addr2),
2960 type >> 2, stype >> 4); 2990 type >> 2, stype >> 4);
2961 hostap_rx(dev, skb, rx_stats); 2991 hostap_rx(dev, skb, rx_stats);
2962#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2992#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
@@ -2991,8 +3021,8 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2991 * being associated. */ 3021 * being associated. */
2992 printk(KERN_DEBUG "%s: rejected received nullfunc " 3022 printk(KERN_DEBUG "%s: rejected received nullfunc "
2993 "frame without ToDS from not associated STA " 3023 "frame without ToDS from not associated STA "
2994 MACSTR "\n", 3024 "%s\n",
2995 dev->name, MAC2STR(hdr->addr2)); 3025 dev->name, print_mac(mac, hdr->addr2));
2996 hostap_rx(dev, skb, rx_stats); 3026 hostap_rx(dev, skb, rx_stats);
2997#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 3027#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
2998 } 3028 }
@@ -3009,9 +3039,9 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3009 * If BSSID is own, report the dropping of this frame. */ 3039 * If BSSID is own, report the dropping of this frame. */
3010 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { 3040 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {
3011 printk(KERN_DEBUG "%s: dropped received packet from " 3041 printk(KERN_DEBUG "%s: dropped received packet from "
3012 MACSTR " with no ToDS flag (type=0x%02x, " 3042 "%s with no ToDS flag "
3013 "subtype=0x%02x)\n", dev->name, 3043 "(type=0x%02x, subtype=0x%02x)\n", dev->name,
3014 MAC2STR(hdr->addr2), type >> 2, stype >> 4); 3044 print_mac(mac, hdr->addr2), type >> 2, stype >> 4);
3015 hostap_dump_rx_80211(dev->name, skb, rx_stats); 3045 hostap_dump_rx_80211(dev->name, skb, rx_stats);
3016 } 3046 }
3017 ret = AP_RX_DROP; 3047 ret = AP_RX_DROP;