Commit b1b2bbbd authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: OnAuth23() Use cfg80211_find_ie()

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9f0e5866
...@@ -832,8 +832,9 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter, ...@@ -832,8 +832,9 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter,
struct recv_frame *precv_frame) struct recv_frame *precv_frame)
{ {
#ifdef CONFIG_8723AU_AP_MODE #ifdef CONFIG_8723AU_AP_MODE
unsigned int auth_mode, seq, ie_len; unsigned int auth_mode, seq;
unsigned char *sa, *p; unsigned char *sa;
const u8 *p;
u16 algorithm; u16 algorithm;
int status; int status;
static struct sta_info stat; static struct sta_info stat;
...@@ -847,7 +848,7 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter, ...@@ -847,7 +848,7 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter,
u8 *pframe = skb->data; u8 *pframe = skb->data;
uint len = skb->len; uint len = skb->len;
if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) if ((pmlmeinfo->state & 0x03) != WIFI_FW_AP_STATE)
return _FAIL; return _FAIL;
DBG_8723A("+OnAuth23a\n"); DBG_8723A("+OnAuth23a\n");
...@@ -855,10 +856,12 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter, ...@@ -855,10 +856,12 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter,
sa = hdr->addr2; sa = hdr->addr2;
auth_mode = psecuritypriv->dot11AuthAlgrthm; auth_mode = psecuritypriv->dot11AuthAlgrthm;
seq = cpu_to_le16(*(u16*)((unsigned long)pframe +
sizeof(struct ieee80211_hdr_3addr) + 2)); pframe += sizeof(struct ieee80211_hdr_3addr);
algorithm = cpu_to_le16(*(u16*)((unsigned long)pframe + len -= sizeof(struct ieee80211_hdr_3addr);
sizeof(struct ieee80211_hdr_3addr)));
seq = cpu_to_le16(*(u16 *)(pframe + 2));
algorithm = cpu_to_le16(*(u16 *)pframe);
DBG_8723A("auth alg =%x, seq =%X\n", algorithm, seq); DBG_8723A("auth alg =%x, seq =%X\n", algorithm, seq);
...@@ -909,8 +912,7 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter, ...@@ -909,8 +912,7 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter,
if (!list_empty(&pstat->asoc_list)) { if (!list_empty(&pstat->asoc_list)) {
list_del_init(&pstat->asoc_list); list_del_init(&pstat->asoc_list);
pstapriv->asoc_list_cnt--; pstapriv->asoc_list_cnt--;
if (pstat->expire_to > 0) if (pstat->expire_to > 0) {
{
/* TODO: STA re_auth within expire_to */ /* TODO: STA re_auth within expire_to */
} }
} }
...@@ -962,23 +964,18 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter, ...@@ -962,23 +964,18 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter,
/* checking for challenging txt... */ /* checking for challenging txt... */
DBG_8723A("checking for challenging txt...\n"); DBG_8723A("checking for challenging txt...\n");
p = rtw_get_ie23a(pframe + p = cfg80211_find_ie(WLAN_EID_CHALLENGE,
sizeof(struct ieee80211_hdr_3addr) + pframe + 4 + _AUTH_IE_OFFSET_,
4 + _AUTH_IE_OFFSET_, len - _AUTH_IE_OFFSET_ - 4);
WLAN_EID_CHALLENGE, if (!p || p[1] <= 0) {
(int *)&ie_len, len -
sizeof(struct ieee80211_hdr_3addr) -
_AUTH_IE_OFFSET_ - 4);
if ((p == NULL) || (ie_len<= 0)) {
DBG_8723A("auth rejected because challenge " DBG_8723A("auth rejected because challenge "
"failure!(1)\n"); "failure!(1)\n");
status = WLAN_STATUS_CHALLENGE_FAIL; status = WLAN_STATUS_CHALLENGE_FAIL;
goto auth_fail; goto auth_fail;
} }
if (!memcmp((void *)(p + 2), pstat->chg_txt, 128)) { if (!memcmp(p + 2, pstat->chg_txt, 128)) {
pstat->state &= (~WIFI_FW_AUTH_STATE); pstat->state &= ~WIFI_FW_AUTH_STATE;
pstat->state |= WIFI_FW_AUTH_SUCCESS; pstat->state |= WIFI_FW_AUTH_SUCCESS;
/* challenging txt is correct... */ /* challenging txt is correct... */
pstat->expire_to = pstapriv->assoc_to; pstat->expire_to = pstapriv->assoc_to;
...@@ -1000,7 +997,7 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter, ...@@ -1000,7 +997,7 @@ unsigned int OnAuth23a(struct rtw_adapter *padapter,
/* Now, we are going to issue_auth23a... */ /* Now, we are going to issue_auth23a... */
pstat->auth_seq = seq + 1; pstat->auth_seq = seq + 1;
issue_auth23a(padapter, pstat, (unsigned short)WLAN_STATUS_SUCCESS); issue_auth23a(padapter, pstat, WLAN_STATUS_SUCCESS);
if (pstat->state & WIFI_FW_AUTH_SUCCESS) if (pstat->state & WIFI_FW_AUTH_SUCCESS)
pstat->auth_seq = 0; pstat->auth_seq = 0;
......
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