staging: rtl8723au: rtw_check_bcn_info23a(): Use cfg80211_find_ie()
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c146551f1a
commit
3ffa4355a2
|
@ -857,10 +857,8 @@ void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta)
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
|
int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
|
||||||
struct ieee80211_mgmt *mgmt, u32 packet_len)
|
struct ieee80211_mgmt *mgmt, u32 pkt_len)
|
||||||
{
|
{
|
||||||
unsigned int len;
|
|
||||||
unsigned char *p;
|
|
||||||
unsigned short val16;
|
unsigned short val16;
|
||||||
struct wlan_network *cur_network = &Adapter->mlmepriv.cur_network;
|
struct wlan_network *cur_network = &Adapter->mlmepriv.cur_network;
|
||||||
u16 wpa_len = 0, rsn_len = 0;
|
u16 wpa_len = 0, rsn_len = 0;
|
||||||
|
@ -875,6 +873,9 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
|
||||||
u32 bcn_channel;
|
u32 bcn_channel;
|
||||||
unsigned short ht_cap_info;
|
unsigned short ht_cap_info;
|
||||||
unsigned char ht_info_infos_0;
|
unsigned char ht_info_infos_0;
|
||||||
|
int len, pie_len, ie_offset;
|
||||||
|
const u8 *p;
|
||||||
|
u8 *pie;
|
||||||
|
|
||||||
if (is_client_associated_to_ap23a(Adapter) == false)
|
if (is_client_associated_to_ap23a(Adapter) == false)
|
||||||
return true;
|
return true;
|
||||||
|
@ -885,7 +886,7 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = packet_len - sizeof(struct ieee80211_hdr_3addr);
|
len = pkt_len - sizeof(struct ieee80211_hdr_3addr);
|
||||||
|
|
||||||
if (len > MAX_IE_SZ) {
|
if (len > MAX_IE_SZ) {
|
||||||
DBG_8723A("%s IE too long for survey event\n", __func__);
|
DBG_8723A("%s IE too long for survey event\n", __func__);
|
||||||
|
@ -913,70 +914,76 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter,
|
||||||
|
|
||||||
/* check bw and channel offset */
|
/* check bw and channel offset */
|
||||||
/* parsing HT_CAP_IE */
|
/* parsing HT_CAP_IE */
|
||||||
p = rtw_get_ie23a(bssid->IEs + _FIXED_IE_LENGTH_,
|
ie_offset = offsetof(struct ieee80211_mgmt, u.beacon.variable) -
|
||||||
WLAN_EID_HT_CAPABILITY,
|
offsetof(struct ieee80211_mgmt, u);
|
||||||
&len, bssid->IELength - _FIXED_IE_LENGTH_);
|
pie = bssid->IEs + ie_offset;
|
||||||
if (p && len>0) {
|
pie_len = pkt_len - ie_offset;
|
||||||
pht_cap = (struct ieee80211_ht_cap *)(p + 2);
|
|
||||||
ht_cap_info = pht_cap->cap_info;
|
p = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, pie, pie_len);
|
||||||
} else {
|
if (p && p[1] > 0) {
|
||||||
ht_cap_info = 0;
|
pht_cap = (struct ieee80211_ht_cap *)(p + 2);
|
||||||
}
|
ht_cap_info = pht_cap->cap_info;
|
||||||
|
} else
|
||||||
|
ht_cap_info = 0;
|
||||||
|
|
||||||
/* parsing HT_INFO_IE */
|
/* parsing HT_INFO_IE */
|
||||||
p = rtw_get_ie23a(bssid->IEs + _FIXED_IE_LENGTH_, WLAN_EID_HT_OPERATION,
|
p = cfg80211_find_ie(WLAN_EID_HT_OPERATION, pie, pie_len);
|
||||||
&len, bssid->IELength - _FIXED_IE_LENGTH_);
|
if (p && p[1] > 0) {
|
||||||
if (p && len>0) {
|
pht_info = (struct HT_info_element *)(p + 2);
|
||||||
pht_info = (struct HT_info_element *)(p + 2);
|
ht_info_infos_0 = pht_info->infos[0];
|
||||||
ht_info_infos_0 = pht_info->infos[0];
|
} else
|
||||||
} else {
|
ht_info_infos_0 = 0;
|
||||||
ht_info_infos_0 = 0;
|
|
||||||
}
|
|
||||||
if (ht_cap_info != cur_network->BcnInfo.ht_cap_info ||
|
if (ht_cap_info != cur_network->BcnInfo.ht_cap_info ||
|
||||||
((ht_info_infos_0&0x03) != (cur_network->BcnInfo.ht_info_infos_0&0x03))) {
|
((ht_info_infos_0 & 0x03) !=
|
||||||
DBG_8723A("%s bcn now: ht_cap_info:%x ht_info_infos_0:%x\n", __func__,
|
(cur_network->BcnInfo.ht_info_infos_0 & 0x03))) {
|
||||||
ht_cap_info, ht_info_infos_0);
|
DBG_8723A("%s bcn now: ht_cap_info:%x ht_info_infos_0:%x\n",
|
||||||
DBG_8723A("%s bcn link: ht_cap_info:%x ht_info_infos_0:%x\n", __func__,
|
__func__, ht_cap_info, ht_info_infos_0);
|
||||||
cur_network->BcnInfo.ht_cap_info, cur_network->BcnInfo.ht_info_infos_0);
|
DBG_8723A("%s bcn link: ht_cap_info:%x ht_info_infos_0:%x\n",
|
||||||
DBG_8723A("%s bw mode change, disconnect\n", __func__);
|
__func__, cur_network->BcnInfo.ht_cap_info,
|
||||||
/* bcn_info_update */
|
cur_network->BcnInfo.ht_info_infos_0);
|
||||||
cur_network->BcnInfo.ht_cap_info = ht_cap_info;
|
DBG_8723A("%s bw mode change, disconnect\n", __func__);
|
||||||
cur_network->BcnInfo.ht_info_infos_0 = ht_info_infos_0;
|
/* bcn_info_update */
|
||||||
/* to do : need to check that whether modify related register of BB or not */
|
cur_network->BcnInfo.ht_cap_info = ht_cap_info;
|
||||||
|
cur_network->BcnInfo.ht_info_infos_0 = ht_info_infos_0;
|
||||||
|
/* to do : need to check that whether modify related
|
||||||
|
register of BB or not */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checking for channel */
|
/* Checking for channel */
|
||||||
p = rtw_get_ie23a(bssid->IEs + _FIXED_IE_LENGTH_, WLAN_EID_DS_PARAMS,
|
p = cfg80211_find_ie(WLAN_EID_DS_PARAMS, pie, pie_len);
|
||||||
&len, bssid->IELength - _FIXED_IE_LENGTH_);
|
if (p)
|
||||||
if (p) {
|
bcn_channel = p[2];
|
||||||
bcn_channel = *(p + 2);
|
else {
|
||||||
} else {/* In 5G, some ap do not have DSSET IE checking HT info for channel */
|
/* In 5G, some ap do not have DSSET IE checking HT
|
||||||
p = rtw_get_ie23a(bssid->IEs + _FIXED_IE_LENGTH_,
|
info for channel */
|
||||||
WLAN_EID_HT_OPERATION, &len,
|
p = cfg80211_find_ie(WLAN_EID_HT_OPERATION, pie, pie_len);
|
||||||
bssid->IELength - _FIXED_IE_LENGTH_);
|
|
||||||
if (pht_info) {
|
if (pht_info)
|
||||||
bcn_channel = pht_info->primary_channel;
|
bcn_channel = pht_info->primary_channel;
|
||||||
} else { /* we don't find channel IE, so don't check it */
|
else { /* we don't find channel IE, so don't check it */
|
||||||
DBG_8723A("Oops: %s we don't find channel IE, so don't check it\n", __func__);
|
DBG_8723A("Oops: %s we don't find channel IE, so don't "
|
||||||
bcn_channel = Adapter->mlmeextpriv.cur_channel;
|
"check it\n", __func__);
|
||||||
}
|
bcn_channel = Adapter->mlmeextpriv.cur_channel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (bcn_channel != Adapter->mlmeextpriv.cur_channel) {
|
if (bcn_channel != Adapter->mlmeextpriv.cur_channel) {
|
||||||
DBG_8723A("%s beacon channel:%d cur channel:%d disconnect\n", __func__,
|
DBG_8723A("%s beacon channel:%d cur channel:%d disconnect\n",
|
||||||
bcn_channel, Adapter->mlmeextpriv.cur_channel);
|
__func__, bcn_channel,
|
||||||
goto _mismatch;
|
Adapter->mlmeextpriv.cur_channel);
|
||||||
|
goto _mismatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* checking SSID */
|
/* checking SSID */
|
||||||
if ((p = rtw_get_ie23a(bssid->IEs + _FIXED_IE_LENGTH_, WLAN_EID_SSID,
|
p = cfg80211_find_ie(WLAN_EID_SSID, pie, pie_len);
|
||||||
&len, bssid->IELength - _FIXED_IE_LENGTH_)) ==
|
if (!p) {
|
||||||
NULL) {
|
DBG_8723A("%s marc: cannot find SSID for survey event\n",
|
||||||
DBG_8723A("%s marc: cannot find SSID for survey event\n", __func__);
|
__func__);
|
||||||
hidden_ssid = true;
|
hidden_ssid = true;
|
||||||
} else {
|
} else
|
||||||
hidden_ssid = false;
|
hidden_ssid = false;
|
||||||
}
|
|
||||||
|
|
||||||
if ((NULL != p) && (false == hidden_ssid && (*(p + 1)))) {
|
if (p && (hidden_ssid == false && *(p + 1))) {
|
||||||
memcpy(bssid->Ssid.ssid, (p + 2), *(p + 1));
|
memcpy(bssid->Ssid.ssid, (p + 2), *(p + 1));
|
||||||
bssid->Ssid.ssid_len = *(p + 1);
|
bssid->Ssid.ssid_len = *(p + 1);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue