Commit 7bb528c6 authored by Martin Kaiser's avatar Martin Kaiser Committed by Greg Kroah-Hartman

staging: r8188eu: use ieee80211 helpers in mgt_dispatcher

Use structs and functions from ieee80211.h in mgt_dispatcher to parse
the incoming frame.
Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413200742.276806-4-martin@kaiser.cxSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7897aa28
...@@ -396,14 +396,15 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) ...@@ -396,14 +396,15 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame)
struct mlme_handler *ptable; struct mlme_handler *ptable;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
u8 *pframe = precv_frame->rx_data; u8 *pframe = precv_frame->rx_data;
struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(pframe)); struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data;
struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, hdr->addr2);
if (GetFrameType(pframe) != IEEE80211_FTYPE_MGMT) if (!ieee80211_is_mgmt(hdr->frame_control))
return; return;
/* receive the frames that ra(a1) is my address or ra(a1) is bc address. */ /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) && if (memcmp(hdr->addr1, myid(&padapter->eeprompriv), ETH_ALEN) &&
!is_broadcast_ether_addr(GetAddr1Ptr(pframe))) !is_broadcast_ether_addr(hdr->addr1))
return; return;
ptable = mlme_sta_tbl; ptable = mlme_sta_tbl;
...@@ -415,7 +416,7 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) ...@@ -415,7 +416,7 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame)
ptable += index; ptable += index;
if (psta) { if (psta) {
if (GetRetry(pframe)) { if (ieee80211_has_retry(hdr->frame_control)) {
if (precv_frame->attrib.seq_num == psta->RxMgmtFrameSeqNum) if (precv_frame->attrib.seq_num == psta->RxMgmtFrameSeqNum)
/* drop the duplicate management frame */ /* drop the duplicate management frame */
return; return;
...@@ -423,7 +424,7 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) ...@@ -423,7 +424,7 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame)
psta->RxMgmtFrameSeqNum = precv_frame->attrib.seq_num; psta->RxMgmtFrameSeqNum = precv_frame->attrib.seq_num;
} }
if (GetFrameSubType(pframe) == WIFI_AUTH) { if (ieee80211_is_auth(hdr->frame_control)) {
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
ptable->func = &OnAuth; ptable->func = &OnAuth;
else else
...@@ -432,8 +433,8 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame) ...@@ -432,8 +433,8 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame)
if (ptable->func) { if (ptable->func) {
/* receive the frames that ra(a1) is my address or ra(a1) is bc address. */ /* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) && if (memcmp(hdr->addr1, myid(&padapter->eeprompriv), ETH_ALEN) &&
!is_broadcast_ether_addr(GetAddr1Ptr(pframe))) !is_broadcast_ether_addr(hdr->addr1))
return; return;
ptable->func(padapter, precv_frame); ptable->func(padapter, precv_frame);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment