struct sta_info *psta;
struct sk_buff *skb = precvframe->pkt;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
- u8 *wlanhdr = skb->data;
-
- pkt_info.bPacketMatchBSSID =
- (!ieee80211_is_ctl(hdr->frame_control) &&
- !pattrib->icv_err &&
- !pattrib->crc_err &&
- !memcmp(get_hdr_bssid(wlanhdr),
- get_bssid(&padapter->mlmepriv), ETH_ALEN));
+ bool matchbssid = false;
+ u8 *bssid;
+
+ matchbssid = (!ieee80211_is_ctl(hdr->frame_control) &&
+ !pattrib->icv_err && !pattrib->crc_err);
+
+ if (matchbssid) {
+ switch (hdr->frame_control &
+ cpu_to_le16(IEEE80211_FCTL_TODS |
+ IEEE80211_FCTL_FROMDS)) {
+ case cpu_to_le16(IEEE80211_FCTL_TODS):
+ bssid = hdr->addr1;
+ break;
+ case cpu_to_le16(IEEE80211_FCTL_FROMDS):
+ bssid = hdr->addr2;
+ break;
+ case cpu_to_le16(0):
+ bssid = hdr->addr3;
+ break;
+ default:
+ bssid = NULL;
+ matchbssid = false;
+ }
+
+ if (bssid)
+ matchbssid = ether_addr_equal(
+ get_bssid(&padapter->mlmepriv), bssid);
+ }
+
+ pkt_info.bPacketMatchBSSID = matchbssid;
da = ieee80211_get_DA(hdr);
pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID &&
(((ieee80211_has_tods(pbuf)<<1) | \
ieee80211_has_fromds(pbuf)) == 3 ? 30 : 24))) & 0x000f)
-static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
-{
- unsigned char *sa;
- unsigned int to_fr_ds;
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) pframe;
-
- to_fr_ds = (ieee80211_has_tods(hdr->frame_control) << 1) |
- ieee80211_has_fromds(hdr->frame_control);
-
- switch (to_fr_ds) {
- case 0x00: /* ToDs=0, FromDs=0 */
- sa = hdr->addr3;
- break;
- case 0x01: /* ToDs=0, FromDs=1 */
- sa = hdr->addr2;
- break;
- case 0x02: /* ToDs=1, FromDs=0 */
- sa = hdr->addr1;
- break;
- case 0x03: /* ToDs=1, FromDs=1 */
- sa = hdr->addr1;
- break;
- default:
- sa = NULL; /* */
- break;
- }
- return sa;
-}
-
/*-----------------------------------------------------------------------------
Below is for the security related definition
------------------------------------------------------------------------------*/