hostap: convert usage of net/ieee80211.h to linux/ieee80211.h
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / hostap / hostap_ap.c
index af3d4ef2a80b75218b52f538e93e58e8215f5930..645862fd37d1b2300b51cd2f562eb297bf85c906 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/proc_fs.h>
 #include <linux/delay.h>
 #include <linux/random.h>
+#include <linux/if_arp.h>
 
 #include "hostap_wlan.h"
 #include "hostap.h"
@@ -94,7 +95,6 @@ static void ap_sta_hash_add(struct ap_data *ap, struct sta_info *sta)
 static void ap_sta_hash_del(struct ap_data *ap, struct sta_info *sta)
 {
        struct sta_info *s;
-       DECLARE_MAC_BUF(mac);
 
        s = ap->sta_hash[STA_HASH(sta->addr)];
        if (s == NULL) return;
@@ -109,20 +109,18 @@ static void ap_sta_hash_del(struct ap_data *ap, struct sta_info *sta)
        if (s->hnext != NULL)
                s->hnext = s->hnext->hnext;
        else
-               printk("AP: could not remove STA %s"
-                      " from hash table\n",
-                      print_mac(mac, sta->addr));
+               printk("AP: could not remove STA %pM from hash table\n",
+                      sta->addr);
 }
 
 static void ap_free_sta(struct ap_data *ap, struct sta_info *sta)
 {
-       DECLARE_MAC_BUF(mac);
        if (sta->ap && sta->local)
                hostap_event_expired_sta(sta->local->dev, sta);
 
        if (ap->proc != NULL) {
                char name[20];
-               sprintf(name, "%s", print_mac(mac, sta->addr));
+               sprintf(name, "%pM", sta->addr);
                remove_proc_entry(name, ap->proc);
        }
 
@@ -185,7 +183,6 @@ static void ap_handle_timer(unsigned long data)
        struct ap_data *ap;
        unsigned long next_time = 0;
        int was_assoc;
-       DECLARE_MAC_BUF(mac);
 
        if (sta == NULL || sta->local == NULL || sta->local->ap == NULL) {
                PDEBUG(DEBUG_AP, "ap_handle_timer() called with NULL data\n");
@@ -242,8 +239,8 @@ static void ap_handle_timer(unsigned long data)
        if (sta->ap) {
                if (ap->autom_ap_wds) {
                        PDEBUG(DEBUG_AP, "%s: removing automatic WDS "
-                              "connection to AP %s\n",
-                              local->dev->name, print_mac(mac, sta->addr));
+                              "connection to AP %pM\n",
+                              local->dev->name, sta->addr);
                        hostap_wds_link_oper(local, sta->addr, WDS_DEL);
                }
        } else if (sta->timeout_next == STA_NULLFUNC) {
@@ -259,11 +256,11 @@ static void ap_handle_timer(unsigned long data)
        } else {
                int deauth = sta->timeout_next == STA_DEAUTH;
                __le16 resp;
-               PDEBUG(DEBUG_AP, "%s: sending %s info to STA %s"
+               PDEBUG(DEBUG_AP, "%s: sending %s info to STA %pM"
                       "(last=%lu, jiffies=%lu)\n",
                       local->dev->name,
                       deauth ? "deauthentication" : "disassociation",
-                      print_mac(mac, sta->addr), sta->last_rx, jiffies);
+                      sta->addr, sta->last_rx, jiffies);
 
                resp = cpu_to_le16(deauth ? WLAN_REASON_PREV_AUTH_NOT_VALID :
                                   WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
@@ -275,10 +272,10 @@ static void ap_handle_timer(unsigned long data)
 
        if (sta->timeout_next == STA_DEAUTH) {
                if (sta->flags & WLAN_STA_PERM) {
-                       PDEBUG(DEBUG_AP, "%s: STA %s"
+                       PDEBUG(DEBUG_AP, "%s: STA %pM"
                               " would have been removed, "
                               "but it has 'perm' flag\n",
-                              local->dev->name, print_mac(mac, sta->addr));
+                              local->dev->name, sta->addr);
                } else
                        ap_free_sta(ap, sta);
                return;
@@ -332,7 +329,6 @@ static int ap_control_proc_read(char *page, char **start, off_t off,
        struct ap_data *ap = (struct ap_data *) data;
        char *policy_txt;
        struct mac_entry *entry;
-       DECLARE_MAC_BUF(mac);
 
        if (off != 0) {
                *eof = 1;
@@ -363,7 +359,7 @@ static int ap_control_proc_read(char *page, char **start, off_t off,
                        break;
                }
 
-               p += sprintf(p, "%s\n", print_mac(mac, entry->addr));
+               p += sprintf(p, "%pM\n", entry->addr);
        }
        spin_unlock_bh(&ap->mac_restrictions.lock);
 
@@ -520,7 +516,6 @@ static int prism2_ap_proc_read(char *page, char **start, off_t off,
        struct ap_data *ap = (struct ap_data *) data;
        struct sta_info *sta;
        int i;
-       DECLARE_MAC_BUF(mac);
 
        if (off > PROC_LIMIT) {
                *eof = 1;
@@ -533,8 +528,8 @@ static int prism2_ap_proc_read(char *page, char **start, off_t off,
                if (!sta->ap)
                        continue;
 
-               p += sprintf(p, "%s %d %d %d %d '",
-                            print_mac(mac, sta->addr),
+               p += sprintf(p, "%pM %d %d %d %d '",
+                            sta->addr,
                             sta->u.ap.channel, sta->last_rx_signal,
                             sta->last_rx_silence, sta->last_rx_rate);
                for (i = 0; i < sta->u.ap.ssid_len; i++)
@@ -594,28 +589,24 @@ void hostap_check_sta_fw_version(struct ap_data *ap, int sta_fw_ver)
 static void hostap_ap_tx_cb(struct sk_buff *skb, int ok, void *data)
 {
        struct ap_data *ap = data;
-       u16 fc;
-       struct ieee80211_hdr_4addr *hdr;
+       struct ieee80211_hdr *hdr;
 
        if (!ap->local->hostapd || !ap->local->apdev) {
                dev_kfree_skb(skb);
                return;
        }
 
-       hdr = (struct ieee80211_hdr_4addr *) skb->data;
-       fc = le16_to_cpu(hdr->frame_ctl);
-
        /* Pass the TX callback frame to the hostapd; use 802.11 header version
         * 1 to indicate failure (no ACK) and 2 success (frame ACKed) */
 
-       fc &= ~IEEE80211_FCTL_VERS;
-       fc |= ok ? BIT(1) : BIT(0);
-       hdr->frame_ctl = cpu_to_le16(fc);
+       hdr = (struct ieee80211_hdr *) skb->data;
+       hdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_VERS);
+       hdr->frame_control |= cpu_to_le16(ok ? BIT(1) : BIT(0));
 
        skb->dev = ap->local->apdev;
-       skb_pull(skb, hostap_80211_get_hdrlen(fc));
+       skb_pull(skb, hostap_80211_get_hdrlen(hdr->frame_control));
        skb->pkt_type = PACKET_OTHERHOST;
-       skb->protocol = __constant_htons(ETH_P_802_2);
+       skb->protocol = cpu_to_be16(ETH_P_802_2);
        memset(skb->cb, 0, sizeof(skb->cb));
        netif_rx(skb);
 }
@@ -627,8 +618,8 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
 {
        struct ap_data *ap = data;
        struct net_device *dev = ap->local->dev;
-       struct ieee80211_hdr_4addr *hdr;
-       u16 fc, auth_alg, auth_transaction, status;
+       struct ieee80211_hdr *hdr;
+       u16 auth_alg, auth_transaction, status;
        __le16 *pos;
        struct sta_info *sta = NULL;
        char *txt = NULL;
@@ -638,10 +629,8 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
                return;
        }
 
-       hdr = (struct ieee80211_hdr_4addr *) skb->data;
-       fc = le16_to_cpu(hdr->frame_ctl);
-       if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT ||
-           WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_AUTH ||
+       hdr = (struct ieee80211_hdr *) skb->data;
+       if (!ieee80211_is_auth(hdr->frame_control) ||
            skb->len < IEEE80211_MGMT_HDR_LEN + 6) {
                printk(KERN_DEBUG "%s: hostap_ap_tx_cb_auth received invalid "
                       "frame\n", dev->name);
@@ -683,11 +672,9 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
        if (sta)
                atomic_dec(&sta->users);
        if (txt) {
-               PDEBUG(DEBUG_AP, "%s: " MAC_FMT " auth_cb - alg=%d "
+               PDEBUG(DEBUG_AP, "%s: %pM auth_cb - alg=%d "
                       "trans#=%d status=%d - %s\n",
-                      dev->name,
-                      hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
-                      hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
+                      dev->name, hdr->addr1,
                       auth_alg, auth_transaction, status, txt);
        }
        dev_kfree_skb(skb);
@@ -699,7 +686,7 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
 {
        struct ap_data *ap = data;
        struct net_device *dev = ap->local->dev;
-       struct ieee80211_hdr_4addr *hdr;
+       struct ieee80211_hdr *hdr;
        u16 fc, status;
        __le16 *pos;
        struct sta_info *sta = NULL;
@@ -710,11 +697,10 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
                return;
        }
 
-       hdr = (struct ieee80211_hdr_4addr *) skb->data;
-       fc = le16_to_cpu(hdr->frame_ctl);
-       if (WLAN_FC_GET_TYPE(fc) != IEEE80211_FTYPE_MGMT ||
-           (WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_ASSOC_RESP &&
-            WLAN_FC_GET_STYPE(fc) != IEEE80211_STYPE_REASSOC_RESP) ||
+       hdr = (struct ieee80211_hdr *) skb->data;
+       fc = le16_to_cpu(hdr->frame_control);
+       if ((!ieee80211_is_assoc_resp(hdr->frame_control) &&
+            !ieee80211_is_reassoc_resp(hdr->frame_control)) ||
            skb->len < IEEE80211_MGMT_HDR_LEN + 4) {
                printk(KERN_DEBUG "%s: hostap_ap_tx_cb_assoc received invalid "
                       "frame\n", dev->name);
@@ -754,11 +740,8 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
        if (sta)
                atomic_dec(&sta->users);
        if (txt) {
-               PDEBUG(DEBUG_AP, "%s: " MAC_FMT " assoc_cb - %s\n",
-                      dev->name,
-                      hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
-                      hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
-                      txt);
+               PDEBUG(DEBUG_AP, "%s: %pM assoc_cb - %s\n",
+                      dev->name, hdr->addr1, txt);
        }
        dev_kfree_skb(skb);
 }
@@ -768,12 +751,12 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
 static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data)
 {
        struct ap_data *ap = data;
-       struct ieee80211_hdr_4addr *hdr;
+       struct ieee80211_hdr *hdr;
        struct sta_info *sta;
 
        if (skb->len < 24)
                goto fail;
-       hdr = (struct ieee80211_hdr_4addr *) skb->data;
+       hdr = (struct ieee80211_hdr *) skb->data;
        if (ok) {
                spin_lock(&ap->sta_table_lock);
                sta = ap_get_sta(ap, hdr->addr1);
@@ -781,11 +764,9 @@ static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data)
                        sta->flags &= ~WLAN_STA_PENDING_POLL;
                spin_unlock(&ap->sta_table_lock);
        } else {
-               PDEBUG(DEBUG_AP, "%s: STA " MAC_FMT
-                      " did not ACK activity poll frame\n",
-                      ap->local->dev->name,
-                      hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
-                      hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
+               PDEBUG(DEBUG_AP,
+                      "%s: STA %pM did not ACK activity poll frame\n",
+                      ap->local->dev->name, hdr->addr1);
        }
 
  fail:
@@ -930,7 +911,7 @@ static void prism2_send_mgmt(struct net_device *dev,
 {
        struct hostap_interface *iface;
        local_info_t *local;
-       struct ieee80211_hdr_4addr *hdr;
+       struct ieee80211_hdr *hdr;
        u16 fc;
        struct sk_buff *skb;
        struct hostap_skb_tx_data *meta;
@@ -955,8 +936,8 @@ static void prism2_send_mgmt(struct net_device *dev,
        }
 
        fc = type_subtype;
-       hdrlen = hostap_80211_get_hdrlen(fc);
-       hdr = (struct ieee80211_hdr_4addr *) skb_put(skb, hdrlen);
+       hdrlen = hostap_80211_get_hdrlen(cpu_to_le16(type_subtype));
+       hdr = (struct ieee80211_hdr *) skb_put(skb, hdrlen);
        if (body)
                memcpy(skb_put(skb, body_len), body, body_len);
 
@@ -967,11 +948,11 @@ static void prism2_send_mgmt(struct net_device *dev,
 
 
        memcpy(hdr->addr1, addr, ETH_ALEN); /* DA / RA */
-       if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) {
+       if (ieee80211_is_data(hdr->frame_control)) {
                fc |= IEEE80211_FCTL_FROMDS;
                memcpy(hdr->addr2, dev->dev_addr, ETH_ALEN); /* BSSID */
                memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* SA */
-       } else if (WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_CTL) {
+       } else if (ieee80211_is_ctl(hdr->frame_control)) {
                /* control:ACK does not have addr2 or addr3 */
                memset(hdr->addr2, 0, ETH_ALEN);
                memset(hdr->addr3, 0, ETH_ALEN);
@@ -980,7 +961,7 @@ static void prism2_send_mgmt(struct net_device *dev,
                memcpy(hdr->addr3, dev->dev_addr, ETH_ALEN); /* BSSID */
        }
 
-       hdr->frame_ctl = cpu_to_le16(fc);
+       hdr->frame_control = cpu_to_le16(fc);
 
        meta = (struct hostap_skb_tx_data *) skb->cb;
        memset(meta, 0, sizeof(*meta));
@@ -1002,7 +983,6 @@ static int prism2_sta_proc_read(char *page, char **start, off_t off,
        char *p = page;
        struct sta_info *sta = (struct sta_info *) data;
        int i;
-       DECLARE_MAC_BUF(mac);
 
        /* FIX: possible race condition.. the STA data could have just expired,
         * but proc entry was still here so that the read could have started;
@@ -1013,11 +993,11 @@ static int prism2_sta_proc_read(char *page, char **start, off_t off,
                return 0;
        }
 
-       p += sprintf(p, "%s=%s\nusers=%d\naid=%d\n"
+       p += sprintf(p, "%s=%pM\nusers=%d\naid=%d\n"
                     "flags=0x%04x%s%s%s%s%s%s%s\n"
                     "capability=0x%02x\nlisten_interval=%d\nsupported_rates=",
                     sta->ap ? "AP" : "STA",
-                    print_mac(mac, sta->addr), atomic_read(&sta->users), sta->aid,
+                    sta->addr, atomic_read(&sta->users), sta->aid,
                     sta->flags,
                     sta->flags & WLAN_STA_AUTH ? " AUTH" : "",
                     sta->flags & WLAN_STA_ASSOC ? " ASSOC" : "",
@@ -1078,7 +1058,6 @@ static void handle_add_proc_queue(struct work_struct *work)
        struct sta_info *sta;
        char name[20];
        struct add_sta_proc_data *entry, *prev;
-       DECLARE_MAC_BUF(mac);
 
        entry = ap->add_sta_proc_entries;
        ap->add_sta_proc_entries = NULL;
@@ -1091,7 +1070,7 @@ static void handle_add_proc_queue(struct work_struct *work)
                spin_unlock_bh(&ap->sta_table_lock);
 
                if (sta) {
-                       sprintf(name, "%s", print_mac(mac, sta->addr));
+                       sprintf(name, "%pM", sta->addr);
                        sta->proc = create_proc_read_entry(
                                name, 0, ap->proc,
                                prism2_sta_proc_read, sta);
@@ -1221,7 +1200,7 @@ static void prism2_check_tx_rates(struct sta_info *sta)
 
 static void ap_crypt_init(struct ap_data *ap)
 {
-       ap->crypt = ieee80211_get_crypto_ops("WEP");
+       ap->crypt = lib80211_get_crypto_ops("WEP");
 
        if (ap->crypt) {
                if (ap->crypt->init) {
@@ -1239,7 +1218,7 @@ static void ap_crypt_init(struct ap_data *ap)
 
        if (ap->crypt == NULL) {
                printk(KERN_WARNING "AP could not initialize WEP: load module "
-                      "ieee80211_crypt_wep.ko\n");
+                      "lib80211_crypt_wep.ko\n");
        }
 }
 
@@ -1299,28 +1278,25 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
                          struct hostap_80211_rx_status *rx_stats)
 {
        struct net_device *dev = local->dev;
-       struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        size_t hdrlen;
        struct ap_data *ap = local->ap;
        char body[8 + WLAN_AUTH_CHALLENGE_LEN], *challenge = NULL;
        int len, olen;
        u16 auth_alg, auth_transaction, status_code;
        __le16 *pos;
-       u16 resp = WLAN_STATUS_SUCCESS, fc;
+       u16 resp = WLAN_STATUS_SUCCESS;
        struct sta_info *sta = NULL;
-       struct ieee80211_crypt_data *crypt;
+       struct lib80211_crypt_data *crypt;
        char *txt = "";
 
        len = skb->len - IEEE80211_MGMT_HDR_LEN;
 
-       fc = le16_to_cpu(hdr->frame_ctl);
-       hdrlen = hostap_80211_get_hdrlen(fc);
+       hdrlen = hostap_80211_get_hdrlen(hdr->frame_control);
 
        if (len < 6) {
                PDEBUG(DEBUG_AP, "%s: handle_authen - too short payload "
-                      "(len=%d) from " MAC_FMT "\n", dev->name, len,
-                      hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
-                      hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
+                      "(len=%d) from %pM\n", dev->name, len, hdr->addr2);
                return;
        }
 
@@ -1336,7 +1312,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
                int idx = 0;
                if (skb->len >= hdrlen + 3)
                        idx = skb->data[hdrlen + 3] >> 6;
-               crypt = local->crypt[idx];
+               crypt = local->crypt_info.crypt[idx];
        }
 
        pos = (__le16 *) (skb->data + IEEE80211_MGMT_HDR_LEN);
@@ -1385,10 +1361,8 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
                if (time_after(jiffies, sta->u.ap.last_beacon +
                               (10 * sta->listen_interval * HZ) / 1024)) {
                        PDEBUG(DEBUG_AP, "%s: no beacons received for a while,"
-                              " assuming AP " MAC_FMT " is now STA\n",
-                              dev->name,
-                              sta->addr[0], sta->addr[1], sta->addr[2],
-                              sta->addr[3], sta->addr[4], sta->addr[5]);
+                              " assuming AP %pM is now STA\n",
+                              dev->name, sta->addr);
                        sta->ap = 0;
                        sta->flags = 0;
                        sta->u.sta.challenge = NULL;
@@ -1454,7 +1428,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
                            challenge == NULL ||
                            memcmp(sta->u.sta.challenge, challenge,
                                   WLAN_AUTH_CHALLENGE_LEN) != 0 ||
-                           !(fc & IEEE80211_FCTL_PROTECTED)) {
+                           !ieee80211_has_protected(hdr->frame_control)) {
                                txt = "challenge response incorrect";
                                resp = WLAN_STATUS_CHALLENGE_FAIL;
                                goto fail;
@@ -1503,13 +1477,11 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
        }
 
        if (resp) {
-               PDEBUG(DEBUG_AP, "%s: " MAC_FMT " auth (alg=%d "
+               PDEBUG(DEBUG_AP, "%s: %pM auth (alg=%d "
                       "trans#=%d stat=%d len=%d fc=%04x) ==> %d (%s)\n",
-                      dev->name,
-                      hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
-                      hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
+                      dev->name, hdr->addr2,
                       auth_alg, auth_transaction, status_code, len,
-                      fc, resp, txt);
+                      le16_to_cpu(hdr->frame_control), resp, txt);
        }
 }
 
@@ -1519,7 +1491,7 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
                         struct hostap_80211_rx_status *rx_stats, int reassoc)
 {
        struct net_device *dev = local->dev;
-       struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        char body[12], *p, *lpos;
        int len, left;
        __le16 *pos;
@@ -1533,10 +1505,8 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
 
        if (len < (reassoc ? 10 : 4)) {
                PDEBUG(DEBUG_AP, "%s: handle_assoc - too short payload "
-                      "(len=%d, reassoc=%d) from " MAC_FMT "\n",
-                      dev->name, len, reassoc,
-                      hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
-                      hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
+                      "(len=%d, reassoc=%d) from %pM\n",
+                      dev->name, len, reassoc, hdr->addr2);
                return;
        }
 
@@ -1613,12 +1583,9 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
                }
 
                if (left > 0) {
-                       PDEBUG(DEBUG_AP, "%s: assoc from " MAC_FMT
+                       PDEBUG(DEBUG_AP, "%s: assoc from %pM"
                               " with extra data (%d bytes) [",
-                              dev->name,
-                              hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
-                              hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
-                              left);
+                              dev->name, hdr->addr2, left);
                        while (left > 0) {
                                PDEBUG2(DEBUG_AP, "<%02x>", *u);
                                u++; left--;
@@ -1717,14 +1684,12 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
        }
 
 #if 0
-       PDEBUG(DEBUG_AP, "%s: " MAC_FMT" %sassoc (len=%d "
-              "prev_ap=" MAC_FMT") => %d(%d) (%s)\n",
+       PDEBUG(DEBUG_AP, "%s: %pM %sassoc (len=%d "
+              "prev_ap=%pM) => %d(%d) (%s)\n",
               dev->name,
-              hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
-              hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
+              hdr->addr2,
               reassoc ? "re" : "", len,
-              prev_ap[0], prev_ap[1], prev_ap[2],
-              prev_ap[3], prev_ap[4], prev_ap[5],
+              prev_ap,
               resp, send_deauth, txt);
 #endif
 }
@@ -1735,13 +1700,12 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
                          struct hostap_80211_rx_status *rx_stats)
 {
        struct net_device *dev = local->dev;
-       struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        char *body = (char *) (skb->data + IEEE80211_MGMT_HDR_LEN);
        int len;
        u16 reason_code;
        __le16 *pos;
        struct sta_info *sta = NULL;
-       DECLARE_MAC_BUF(mac);
 
        len = skb->len - IEEE80211_MGMT_HDR_LEN;
 
@@ -1753,10 +1717,8 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
        pos = (__le16 *) body;
        reason_code = le16_to_cpu(*pos);
 
-       PDEBUG(DEBUG_AP, "%s: deauthentication: " MAC_FMT " len=%d, "
-              "reason_code=%d\n", dev->name,
-              hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
-              hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
+       PDEBUG(DEBUG_AP, "%s: deauthentication: %pM len=%d, "
+              "reason_code=%d\n", dev->name, hdr->addr2,
               len, reason_code);
 
        spin_lock_bh(&local->ap->sta_table_lock);
@@ -1768,11 +1730,9 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
        }
        spin_unlock_bh(&local->ap->sta_table_lock);
        if (sta == NULL) {
-               printk("%s: deauthentication from " MAC_FMT ", "
+               printk("%s: deauthentication from %pM, "
               "reason_code=%d, but STA not authenticated\n", dev->name,
-                      hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
-                      hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
-                      reason_code);
+                      hdr->addr2, reason_code);
        }
 }
 
@@ -1782,7 +1742,7 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
                            struct hostap_80211_rx_status *rx_stats)
 {
        struct net_device *dev = local->dev;
-       struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        char *body = skb->data + IEEE80211_MGMT_HDR_LEN;
        int len;
        u16 reason_code;
@@ -1799,10 +1759,8 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
        pos = (__le16 *) body;
        reason_code = le16_to_cpu(*pos);
 
-       PDEBUG(DEBUG_AP, "%s: disassociation: " MAC_FMT " len=%d, "
-              "reason_code=%d\n", dev->name,
-              hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
-              hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
+       PDEBUG(DEBUG_AP, "%s: disassociation: %pM len=%d, "
+              "reason_code=%d\n", dev->name, hdr->addr2,
               len, reason_code);
 
        spin_lock_bh(&local->ap->sta_table_lock);
@@ -1814,19 +1772,16 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
        }
        spin_unlock_bh(&local->ap->sta_table_lock);
        if (sta == NULL) {
-               printk("%s: disassociation from " MAC_FMT ", "
+               printk("%s: disassociation from %pM, "
                       "reason_code=%d, but STA not authenticated\n",
-                      dev->name,
-                      hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
-                      hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
-                      reason_code);
+                      dev->name, hdr->addr2, reason_code);
        }
 }
 
 
 /* Called only as a scheduled task for pending AP frames. */
 static void ap_handle_data_nullfunc(local_info_t *local,
-                                   struct ieee80211_hdr_4addr *hdr)
+                                   struct ieee80211_hdr *hdr)
 {
        struct net_device *dev = local->dev;
 
@@ -1843,7 +1798,7 @@ static void ap_handle_data_nullfunc(local_info_t *local,
 
 /* Called only as a scheduled task for pending AP frames. */
 static void ap_handle_dropped_data(local_info_t *local,
-                                  struct ieee80211_hdr_4addr *hdr)
+                                  struct ieee80211_hdr *hdr)
 {
        struct net_device *dev = local->dev;
        struct sta_info *sta;
@@ -1901,7 +1856,7 @@ static void pspoll_send_buffered(local_info_t *local, struct sta_info *sta,
 
 /* Called only as a scheduled task for pending AP frames. */
 static void handle_pspoll(local_info_t *local,
-                         struct ieee80211_hdr_4addr *hdr,
+                         struct ieee80211_hdr *hdr,
                          struct hostap_80211_rx_status *rx_stats)
 {
        struct net_device *dev = local->dev;
@@ -1909,19 +1864,13 @@ static void handle_pspoll(local_info_t *local,
        u16 aid;
        struct sk_buff *skb;
 
-       PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MAC_FMT
-              ", TA=" MAC_FMT " PWRMGT=%d\n",
-              hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
-              hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
-              hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
-              hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
-              !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM));
+       PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=%pM, TA=%pM PWRMGT=%d\n",
+              hdr->addr1, hdr->addr2, !!ieee80211_has_pm(hdr->frame_control));
 
        if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
-               PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MAC_FMT
-                      " not own MAC\n",
-                      hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
-                      hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
+               PDEBUG(DEBUG_AP,
+                      "handle_pspoll - addr1(BSSID)=%pM not own MAC\n",
+                      hdr->addr1);
                return;
        }
 
@@ -2007,11 +1956,10 @@ static void handle_wds_oper_queue(struct work_struct *work)
 
        while (entry) {
                PDEBUG(DEBUG_AP, "%s: %s automatic WDS connection "
-                      "to AP " MAC_FMT "\n",
+                      "to AP %pM\n",
                       local->dev->name,
                       entry->type == WDS_ADD ? "adding" : "removing",
-                      entry->addr[0], entry->addr[1], entry->addr[2],
-                      entry->addr[3], entry->addr[4], entry->addr[5]);
+                      entry->addr);
                if (entry->type == WDS_ADD)
                        prism2_wds_add(local, entry->addr, 0);
                else if (entry->type == WDS_DEL)
@@ -2028,7 +1976,7 @@ static void handle_wds_oper_queue(struct work_struct *work)
 static void handle_beacon(local_info_t *local, struct sk_buff *skb,
                          struct hostap_80211_rx_status *rx_stats)
 {
-       struct ieee80211_hdr_4addr *hdr = (struct ieee80211_hdr_4addr *) skb->data;
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
        char *body = skb->data + IEEE80211_MGMT_HDR_LEN;
        int len, left;
        u16 beacon_int, capability;
@@ -2187,14 +2135,14 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
        struct net_device *dev = local->dev;
 #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
        u16 fc, type, stype;
-       struct ieee80211_hdr_4addr *hdr;
+       struct ieee80211_hdr *hdr;
 
        /* FIX: should give skb->len to handler functions and check that the
         * buffer is long enough */
-       hdr = (struct ieee80211_hdr_4addr *) skb->data;
-       fc = le16_to_cpu(hdr->frame_ctl);
-       type = WLAN_FC_GET_TYPE(fc);
-       stype = WLAN_FC_GET_STYPE(fc);
+       hdr = (struct ieee80211_hdr *) skb->data;
+       fc = le16_to_cpu(hdr->frame_control);
+       type = fc & IEEE80211_FCTL_FTYPE;
+       stype = fc & IEEE80211_FCTL_STYPE;
 
 #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
        if (!local->hostapd && type == IEEE80211_FTYPE_DATA) {
@@ -2215,10 +2163,8 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
                }
 
                if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
-                       PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)="
-                              MAC_FMT " not own MAC\n",
-                              hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
-                              hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
+                       PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)=%pM"
+                              " not own MAC\n", hdr->addr1);
                        goto done;
                }
 
@@ -2254,18 +2200,14 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
        }
 
        if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
-               PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=" MAC_FMT
-                      " not own MAC\n",
-                      hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
-                      hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
+               PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=%pM"
+                      " not own MAC\n", hdr->addr1);
                goto done;
        }
 
        if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) {
-               PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=" MAC_FMT
-                      " not own MAC\n",
-                      hdr->addr3[0], hdr->addr3[1], hdr->addr3[2],
-                      hdr->addr3[3], hdr->addr3[4], hdr->addr3[5]);
+               PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=%pM"
+                      " not own MAC\n", hdr->addr3);
                goto done;
        }
 
@@ -2312,8 +2254,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
 {
        struct hostap_interface *iface;
        local_info_t *local;
-       u16 fc;
-       struct ieee80211_hdr_4addr *hdr;
+       struct ieee80211_hdr *hdr;
 
        iface = netdev_priv(dev);
        local = iface->local;
@@ -2323,15 +2264,13 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
 
        local->stats.rx_packets++;
 
-       hdr = (struct ieee80211_hdr_4addr *) skb->data;
-       fc = le16_to_cpu(hdr->frame_ctl);
+       hdr = (struct ieee80211_hdr *) skb->data;
 
        if (local->ap->ap_policy == AP_OTHER_AP_SKIP_ALL &&
-           WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_MGMT &&
-           WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_BEACON)
+           ieee80211_is_beacon(hdr->frame_control))
                goto drop;
 
-       skb->protocol = __constant_htons(ETH_P_HOSTAP);
+       skb->protocol = cpu_to_be16(ETH_P_HOSTAP);
        handle_ap_item(local, skb, rx_stats);
        return;
 
@@ -2344,7 +2283,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
 static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
 {
        struct sk_buff *skb;
-       struct ieee80211_hdr_4addr *hdr;
+       struct ieee80211_hdr *hdr;
        struct hostap_80211_rx_status rx_stats;
 
        if (skb_queue_empty(&sta->tx_buf))
@@ -2357,19 +2296,18 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
                return;
        }
 
-       hdr = (struct ieee80211_hdr_4addr *) skb_put(skb, 16);
+       hdr = (struct ieee80211_hdr *) skb_put(skb, 16);
 
        /* Generate a fake pspoll frame to start packet delivery */
-       hdr->frame_ctl = __constant_cpu_to_le16(
+       hdr->frame_control = cpu_to_le16(
                IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
        memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN);
        memcpy(hdr->addr2, sta->addr, ETH_ALEN);
        hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14));
 
-       PDEBUG(DEBUG_PS2, "%s: Scheduling buffered packet delivery for STA "
-              MAC_FMT "\n", local->dev->name,
-              sta->addr[0], sta->addr[1], sta->addr[2],
-              sta->addr[3], sta->addr[4], sta->addr[5]);
+       PDEBUG(DEBUG_PS2,
+              "%s: Scheduling buffered packet delivery for STA %pM\n",
+              local->dev->name, sta->addr);
 
        skb->dev = local->dev;
 
@@ -2723,12 +2661,8 @@ static int ap_update_sta_tx_rate(struct sta_info *sta, struct net_device *dev)
                        case 3: sta->tx_rate = 110; break;
                        default: sta->tx_rate = 0; break;
                        }
-                       PDEBUG(DEBUG_AP, "%s: STA " MAC_FMT
-                              " TX rate raised to %d\n",
-                              dev->name,
-                              sta->addr[0], sta->addr[1], sta->addr[2],
-                              sta->addr[3], sta->addr[4], sta->addr[5],
-                              sta->tx_rate);
+                       PDEBUG(DEBUG_AP, "%s: STA %pM TX rate raised to %d\n",
+                              dev->name, sta->addr, sta->tx_rate);
                }
                sta->tx_since_last_failure = 0;
        }
@@ -2744,7 +2678,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
        struct sta_info *sta = NULL;
        struct sk_buff *skb = tx->skb;
        int set_tim, ret;
-       struct ieee80211_hdr_4addr *hdr;
+       struct ieee80211_hdr *hdr;
        struct hostap_skb_tx_data *meta;
 
        meta = (struct hostap_skb_tx_data *) skb->cb;
@@ -2753,7 +2687,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
            meta->iface->type == HOSTAP_INTERFACE_STA)
                goto out;
 
-       hdr = (struct ieee80211_hdr_4addr *) skb->data;
+       hdr = (struct ieee80211_hdr *) skb->data;
 
        if (hdr->addr1[0] & 0x01) {
                /* broadcast/multicast frame - no AP related processing */
@@ -2781,9 +2715,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
                 * print out any errors here. */
                if (net_ratelimit()) {
                        printk(KERN_DEBUG "AP: drop packet to non-associated "
-                              "STA " MAC_FMT "\n",
-                              hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
-                              hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
+                              "STA %pM\n", hdr->addr1);
                }
 #endif
                local->ap->tx_drop_nonassoc++;
@@ -2810,8 +2742,8 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
 
        if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) {
                /* indicate to STA that more frames follow */
-               hdr->frame_ctl |=
-                       __constant_cpu_to_le16(IEEE80211_FCTL_MOREDATA);
+               hdr->frame_control |=
+                       cpu_to_le16(IEEE80211_FCTL_MOREDATA);
        }
 
        if (meta->flags & HOSTAP_TX_FLAGS_BUFFERED_FRAME) {
@@ -2821,11 +2753,9 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
        }
 
        if (skb_queue_len(&sta->tx_buf) >= STA_MAX_TX_BUFFER) {
-               PDEBUG(DEBUG_PS, "%s: No more space in STA (" MAC_FMT
-                      ")'s PS mode buffer\n",
-                      local->dev->name,
-                      sta->addr[0], sta->addr[1], sta->addr[2],
-                      sta->addr[3], sta->addr[4], sta->addr[5]);
+               PDEBUG(DEBUG_PS, "%s: No more space in STA (%pM)'s"
+                      "PS mode buffer\n",
+                      local->dev->name, sta->addr);
                /* Make sure that TIM is set for the station (it might not be
                 * after AP wlan hw reset). */
                /* FIX: should fix hw reset to restore bits based on STA
@@ -2887,22 +2817,19 @@ void hostap_handle_sta_release(void *ptr)
 void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
 {
        struct sta_info *sta;
-       struct ieee80211_hdr_4addr *hdr;
+       struct ieee80211_hdr *hdr;
        struct hostap_skb_tx_data *meta;
 
-       hdr = (struct ieee80211_hdr_4addr *) skb->data;
+       hdr = (struct ieee80211_hdr *) skb->data;
        meta = (struct hostap_skb_tx_data *) skb->cb;
 
        spin_lock(&local->ap->sta_table_lock);
        sta = ap_get_sta(local->ap, hdr->addr1);
        if (!sta) {
                spin_unlock(&local->ap->sta_table_lock);
-               PDEBUG(DEBUG_AP, "%s: Could not find STA " MAC_FMT
+               PDEBUG(DEBUG_AP, "%s: Could not find STA %pM"
                       " for this TX error (@%lu)\n",
-                      local->dev->name,
-                      hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
-                      hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
-                      jiffies);
+                      local->dev->name, hdr->addr1, jiffies);
                return;
        }
 
@@ -2929,12 +2856,9 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
                        case 3: sta->tx_rate = 110; break;
                        default: sta->tx_rate = 0; break;
                        }
-                       PDEBUG(DEBUG_AP, "%s: STA " MAC_FMT
-                              " TX rate lowered to %d\n",
-                              local->dev->name,
-                              sta->addr[0], sta->addr[1], sta->addr[2],
-                              sta->addr[3], sta->addr[4], sta->addr[5],
-                              sta->tx_rate);
+                       PDEBUG(DEBUG_AP,
+                              "%s: STA %pM TX rate lowered to %d\n",
+                              local->dev->name, sta->addr, sta->tx_rate);
                }
                sta->tx_consecutive_exc = 0;
        }
@@ -2945,17 +2869,16 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
 static void hostap_update_sta_ps2(local_info_t *local, struct sta_info *sta,
                                  int pwrmgt, int type, int stype)
 {
-       DECLARE_MAC_BUF(mac);
        if (pwrmgt && !(sta->flags & WLAN_STA_PS)) {
                sta->flags |= WLAN_STA_PS;
-               PDEBUG(DEBUG_PS2, "STA %s changed to use PS "
+               PDEBUG(DEBUG_PS2, "STA %pM changed to use PS "
                       "mode (type=0x%02X, stype=0x%02X)\n",
-                      print_mac(mac, sta->addr), type >> 2, stype >> 4);
+                      sta->addr, type >> 2, stype >> 4);
        } else if (!pwrmgt && (sta->flags & WLAN_STA_PS)) {
                sta->flags &= ~WLAN_STA_PS;
-               PDEBUG(DEBUG_PS2, "STA %s changed to not use "
+               PDEBUG(DEBUG_PS2, "STA %pM changed to not use "
                       "PS mode (type=0x%02X, stype=0x%02X)\n",
-                      print_mac(mac, sta->addr), type >> 2, stype >> 4);
+                      sta->addr, type >> 2, stype >> 4);
                if (type != IEEE80211_FTYPE_CTL ||
                    stype != IEEE80211_STYPE_PSPOLL)
                        schedule_packet_send(local, sta);
@@ -2964,8 +2887,8 @@ static void hostap_update_sta_ps2(local_info_t *local, struct sta_info *sta,
 
 
 /* Called only as a tasklet (software IRQ). Called for each RX frame to update
- * STA power saving state. pwrmgt is a flag from 802.11 frame_ctl field. */
-int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr)
+ * STA power saving state. pwrmgt is a flag from 802.11 frame_control field. */
+int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr *hdr)
 {
        struct sta_info *sta;
        u16 fc;
@@ -2979,9 +2902,10 @@ int hostap_update_sta_ps(local_info_t *local, struct ieee80211_hdr_4addr *hdr)
        if (!sta)
                return -1;
 
-       fc = le16_to_cpu(hdr->frame_ctl);
+       fc = le16_to_cpu(hdr->frame_control);
        hostap_update_sta_ps2(local, sta, fc & IEEE80211_FCTL_PM,
-                             WLAN_FC_GET_TYPE(fc), WLAN_FC_GET_STYPE(fc));
+                             fc & IEEE80211_FCTL_FTYPE,
+                             fc & IEEE80211_FCTL_STYPE);
 
        atomic_dec(&sta->users);
        return 0;
@@ -2998,16 +2922,16 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
        int ret;
        struct sta_info *sta;
        u16 fc, type, stype;
-       struct ieee80211_hdr_4addr *hdr;
+       struct ieee80211_hdr *hdr;
 
        if (local->ap == NULL)
                return AP_RX_CONTINUE;
 
-       hdr = (struct ieee80211_hdr_4addr *) skb->data;
+       hdr = (struct ieee80211_hdr *) skb->data;
 
-       fc = le16_to_cpu(hdr->frame_ctl);
-       type = WLAN_FC_GET_TYPE(fc);
-       stype = WLAN_FC_GET_STYPE(fc);
+       fc = le16_to_cpu(hdr->frame_control);
+       type = fc & IEEE80211_FCTL_FTYPE;
+       stype = fc & IEEE80211_FCTL_STYPE;
 
        spin_lock(&local->ap->sta_table_lock);
        sta = ap_get_sta(local->ap, hdr->addr2);
@@ -3029,13 +2953,9 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
 #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT
                        } else {
                                printk(KERN_DEBUG "%s: dropped received packet"
-                                      " from non-associated STA "
-                                      MAC_FMT
+                                      " from non-associated STA %pM"
                                       " (type=0x%02x, subtype=0x%02x)\n",
-                                      dev->name,
-                                      hdr->addr2[0], hdr->addr2[1],
-                                      hdr->addr2[2], hdr->addr2[3],
-                                      hdr->addr2[4], hdr->addr2[5],
+                                      dev->name, hdr->addr2,
                                       type >> 2, stype >> 4);
                                hostap_rx(dev, skb, rx_stats);
 #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
@@ -3068,13 +2988,9 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
                         * after being unavailable for some time. Speed up
                         * re-association by informing the station about it not
                         * being associated. */
-                       printk(KERN_DEBUG "%s: rejected received nullfunc "
-                              "frame without ToDS from not associated STA "
-                              MAC_FMT "\n",
-                              dev->name,
-                              hdr->addr2[0], hdr->addr2[1],
-                              hdr->addr2[2], hdr->addr2[3],
-                              hdr->addr2[4], hdr->addr2[5]);
+                       printk(KERN_DEBUG "%s: rejected received nullfunc frame"
+                              " without ToDS from not associated STA %pM\n",
+                              dev->name, hdr->addr2);
                        hostap_rx(dev, skb, rx_stats);
 #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
                }
@@ -3090,13 +3006,10 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
                 * broadcast frame from an IBSS network. Drop it silently.
                 * If BSSID is own, report the dropping of this frame. */
                if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {
-                       printk(KERN_DEBUG "%s: dropped received packet from "
-                              MAC_FMT " with no ToDS flag "
+                       printk(KERN_DEBUG "%s: dropped received packet from %pM"
+                              " with no ToDS flag "
                               "(type=0x%02x, subtype=0x%02x)\n", dev->name,
-                              hdr->addr2[0], hdr->addr2[1],
-                              hdr->addr2[2], hdr->addr2[3],
-                              hdr->addr2[4], hdr->addr2[5],
-                              type >> 2, stype >> 4);
+                              hdr->addr2, type >> 2, stype >> 4);
                        hostap_dump_rx_80211(dev->name, skb, rx_stats);
                }
                ret = AP_RX_DROP;
@@ -3141,8 +3054,8 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
 
 /* Called only as a tasklet (software IRQ) */
 int hostap_handle_sta_crypto(local_info_t *local,
-                            struct ieee80211_hdr_4addr *hdr,
-                            struct ieee80211_crypt_data **crypt,
+                            struct ieee80211_hdr *hdr,
+                            struct lib80211_crypt_data **crypt,
                             void **sta_ptr)
 {
        struct sta_info *sta;
@@ -3243,7 +3156,7 @@ int hostap_add_sta(struct ap_data *ap, u8 *sta_addr)
 
 /* Called only as a tasklet (software IRQ) */
 int hostap_update_rx_stats(struct ap_data *ap,
-                          struct ieee80211_hdr_4addr *hdr,
+                          struct ieee80211_hdr *hdr,
                           struct hostap_80211_rx_status *rx_stats)
 {
        struct sta_info *sta;
@@ -3290,7 +3203,7 @@ void hostap_update_rates(local_info_t *local)
 
 
 void * ap_crypt_get_ptrs(struct ap_data *ap, u8 *addr, int permanent,
-                        struct ieee80211_crypt_data ***crypt)
+                        struct lib80211_crypt_data ***crypt)
 {
        struct sta_info *sta;