staging: rtl8723au: OnBeacon23a(): Use ieee80211_mgmt to calculate ie location

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jes Sorensen 2014-04-15 19:43:57 +02:00 committed by Greg Kroah-Hartman
parent ee79b56c0e
commit f96355b8f0

View File

@ -733,16 +733,16 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
struct sk_buff *skb = precv_frame->pkt; struct sk_buff *skb = precv_frame->pkt;
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) skb->data; struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) skb->data;
u8 *pframe = skb->data; u8 *pframe = skb->data;
uint len = skb->len; int pkt_len = skb->len;
struct wlan_bssid_ex *pbss; struct wlan_bssid_ex *pbss;
int ret = _SUCCESS; int ret = _SUCCESS;
u8 *p = NULL; u8 *p, *pie;
int pie_len;
u32 ielen = 0; u32 ielen = 0;
p = rtw_get_ie23a(pframe + sizeof(struct ieee80211_hdr_3addr) + pie = mgmt->u.beacon.variable;
_BEACON_IE_OFFSET_, WLAN_EID_EXT_SUPP_RATES, &ielen, pie_len = pkt_len - offsetof(struct ieee80211_mgmt, u.beacon.variable);
len - sizeof(struct ieee80211_hdr_3addr) - p = rtw_get_ie23a(pie, WLAN_EID_EXT_SUPP_RATES, &ielen, pie_len);
_BEACON_IE_OFFSET_);
if ((p != NULL) && (ielen > 0)) { if ((p != NULL) && (ielen > 0)) {
if ((*(p + 1 + ielen) == 0x2D) && (*(p + 2 + ielen) != 0x2D)) { if ((*(p + 1 + ielen) == 0x2D) && (*(p + 2 + ielen) != 0x2D)) {
/* Invalid value 0x2D is detected in Extended Supported /* Invalid value 0x2D is detected in Extended Supported
@ -780,10 +780,10 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
} }
/* check the vendor of the assoc AP */ /* check the vendor of the assoc AP */
pmlmeinfo->assoc_AP_vendor = check_assoc_AP23a(pframe + sizeof(struct ieee80211_hdr_3addr), len-sizeof(struct ieee80211_hdr_3addr)); pmlmeinfo->assoc_AP_vendor = check_assoc_AP23a(pframe + sizeof(struct ieee80211_hdr_3addr), pkt_len-sizeof(struct ieee80211_hdr_3addr));
/* update TSF Value */ /* update TSF Value */
update_TSF23a(pmlmeext, pframe, len); update_TSF23a(pmlmeext, pframe, pkt_len);
/* start auth */ /* start auth */
start_clnt_auth23a(padapter); start_clnt_auth23a(padapter);
@ -796,7 +796,7 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
psta = rtw_get_stainfo23a(pstapriv, mgmt->sa); psta = rtw_get_stainfo23a(pstapriv, mgmt->sa);
if (psta) { if (psta) {
ret = rtw_check_bcn_info23a(padapter, pframe, ret = rtw_check_bcn_info23a(padapter, pframe,
len); pkt_len);
if (!ret) { if (!ret) {
DBG_8723A_LEVEL(_drv_always_, DBG_8723A_LEVEL(_drv_always_,
"ap has changed, " "ap has changed, "
@ -810,7 +810,7 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
if ((sta_rx_pkts(psta) & 0xf) == 0) { if ((sta_rx_pkts(psta) & 0xf) == 0) {
/* DBG_8723A("update_bcn_info\n"); */ /* DBG_8723A("update_bcn_info\n"); */
update_beacon23a_info(padapter, pframe, update_beacon23a_info(padapter, pframe,
len, psta); pkt_len, psta);
} }
} }
} else if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) { } else if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) {
@ -822,7 +822,7 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
if ((sta_rx_pkts(psta) & 0xf) == 0) { if ((sta_rx_pkts(psta) & 0xf) == 0) {
/* DBG_8723A("update_bcn_info\n"); */ /* DBG_8723A("update_bcn_info\n"); */
update_beacon23a_info(padapter, pframe, update_beacon23a_info(padapter, pframe,
len, psta); pkt_len, psta);
} }
} else { } else {
/* allocate a new CAM entry for IBSS station */ /* allocate a new CAM entry for IBSS station */
@ -831,13 +831,15 @@ OnBeacon23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame)
goto _END_ONBEACON_; goto _END_ONBEACON_;
/* get supported rate */ /* get supported rate */
if (update_sta_support_rate23a(padapter, (pframe + sizeof(struct ieee80211_hdr_3addr) + _BEACON_IE_OFFSET_), (len - sizeof(struct ieee80211_hdr_3addr) - _BEACON_IE_OFFSET_), cam_idx) == _FAIL) { if (update_sta_support_rate23a(padapter, pie,
pie_len,
cam_idx) == _FAIL) {
pmlmeinfo->FW_sta_info[cam_idx].status = 0; pmlmeinfo->FW_sta_info[cam_idx].status = 0;
goto _END_ONBEACON_; goto _END_ONBEACON_;
} }
/* update TSF Value */ /* update TSF Value */
update_TSF23a(pmlmeext, pframe, len); update_TSF23a(pmlmeext, pframe, pkt_len);
/* report sta add event */ /* report sta add event */
report_add_sta_event23a(padapter, mgmt->sa, report_add_sta_event23a(padapter, mgmt->sa,