OSDN Git Service

staging: rtl8723au: validate_recv_data_frame() use fctl knowledge to obtain bssid
authorJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 9 May 2014 13:03:31 +0000 (15:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 May 2014 20:11:58 +0000 (13:11 -0700)
Use the knowledge we already have from parsing the TODS/FROMDS bits in
hdr->frame_control to obtain the bssid.

Note that get_hdr_bssid() would never return NULL as handling 4
combinations of a 2 bit word leaves little space for falling through
to the 'default' value.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_recv.c

index fd0958b..3376a65 100644 (file)
@@ -1308,9 +1308,8 @@ static int validate_recv_data_frame(struct rtw_adapter *adapter,
                                    struct recv_frame *precv_frame)
 {
        u8 bretry;
-       u8 *psa, *pda, *pbssid;
+       u8 *psa, *pda;
        struct sta_info *psta = NULL;
-       u8 *ptr = precv_frame->pkt->data;
        struct rx_pkt_attrib *pattrib = & precv_frame->attrib;
        struct security_priv *psecuritypriv = &adapter->securitypriv;
        int ret = _SUCCESS;
@@ -1322,39 +1321,39 @@ static int validate_recv_data_frame(struct rtw_adapter *adapter,
        bretry = ieee80211_has_retry(hdr->frame_control);
        pda = ieee80211_get_DA(hdr);
        psa = ieee80211_get_SA(hdr);
-       pbssid = get_hdr_bssid(ptr);
-
-       if (pbssid == NULL) {
-               ret = _FAIL;
-               goto exit;
-       }
 
        ether_addr_copy(pattrib->dst, pda);
        ether_addr_copy(pattrib->src, psa);
 
-       ether_addr_copy(pattrib->bssid, pbssid);
-
        switch (hdr->frame_control &
                cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
        case cpu_to_le16(0):
+               ether_addr_copy(pattrib->bssid, hdr->addr3);
                ether_addr_copy(pattrib->ra, pda);
                ether_addr_copy(pattrib->ta, psa);
                ret = sta2sta_data_frame(adapter, precv_frame, &psta);
                break;
 
        case cpu_to_le16(IEEE80211_FCTL_FROMDS):
+               ether_addr_copy(pattrib->bssid, hdr->addr2);
                ether_addr_copy(pattrib->ra, pda);
-               ether_addr_copy(pattrib->ta, pbssid);
+               ether_addr_copy(pattrib->ta, hdr->addr2);
                ret = ap2sta_data_frame(adapter, precv_frame, &psta);
                break;
 
        case cpu_to_le16(IEEE80211_FCTL_TODS):
-               ether_addr_copy(pattrib->ra, pbssid);
+               ether_addr_copy(pattrib->bssid, hdr->addr1);
+               ether_addr_copy(pattrib->ra, hdr->addr1);
                ether_addr_copy(pattrib->ta, psa);
                ret = sta2ap_data_frame(adapter, precv_frame, &psta);
                break;
 
        case cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
+               /*
+                * There is no BSSID in this case, but the driver has been
+                * using addr1 so far, so keep it for now.
+                */
+               ether_addr_copy(pattrib->bssid, hdr->addr1);
                ether_addr_copy(pattrib->ra, hdr->addr1);
                ether_addr_copy(pattrib->ta, hdr->addr2);
                ret = _FAIL;