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

staging: rtl8723au: ConstructProbeRsp(): Use struct ieee80211_mgmt

Use ieee80211_mgmt to construct the frame instead of relying on hard
coded offsets.
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e61fc7cf
...@@ -398,7 +398,7 @@ ConstructNullFunctionData(struct rtw_adapter *padapter, u8 *pframe, ...@@ -398,7 +398,7 @@ ConstructNullFunctionData(struct rtw_adapter *padapter, u8 *pframe,
static void ConstructProbeRsp(struct rtw_adapter *padapter, u8 *pframe, static void ConstructProbeRsp(struct rtw_adapter *padapter, u8 *pframe,
u32 *pLength, u8 *StaAddr, bool bHideSSID) u32 *pLength, u8 *StaAddr, bool bHideSSID)
{ {
struct ieee80211_hdr *pwlanhdr; struct ieee80211_mgmt *mgmt;
u8 *mac, *bssid; u8 *mac, *bssid;
u32 pktlen; u32 pktlen;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
...@@ -407,29 +407,36 @@ static void ConstructProbeRsp(struct rtw_adapter *padapter, u8 *pframe, ...@@ -407,29 +407,36 @@ static void ConstructProbeRsp(struct rtw_adapter *padapter, u8 *pframe,
/* DBG_8723A("%s\n", __func__); */ /* DBG_8723A("%s\n", __func__); */
pwlanhdr = (struct ieee80211_hdr *)pframe; mgmt = (struct ieee80211_mgmt *)pframe;
mac = myid(&padapter->eeprompriv); mac = myid(&padapter->eeprompriv);
bssid = cur_network->MacAddress; bssid = cur_network->MacAddress;
pwlanhdr->frame_control = mgmt->frame_control =
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
pwlanhdr->seq_ctrl = 0; mgmt->seq_ctrl = 0;
memcpy(mgmt->da, StaAddr, ETH_ALEN);
memcpy(mgmt->sa, mac, ETH_ALEN);
memcpy(mgmt->bssid, bssid, ETH_ALEN);
memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); put_unaligned_le64(cur_network->tsf,
memcpy(pwlanhdr->addr2, mac, ETH_ALEN); &mgmt->u.probe_resp.timestamp);
memcpy(pwlanhdr->addr3, bssid, ETH_ALEN); put_unaligned_le16(cur_network->beacon_interval,
&mgmt->u.probe_resp.beacon_int);
put_unaligned_le16(cur_network->capability,
&mgmt->u.probe_resp.capab_info);
pktlen = sizeof(struct ieee80211_hdr_3addr); pktlen = offsetof(struct ieee80211_mgmt, u.probe_resp.variable);
pframe += pktlen;
if (cur_network->IELength > MAX_IE_SZ) if (cur_network->IELength > MAX_IE_SZ)
return; return;
memcpy(pframe, cur_network->IEs, cur_network->IELength); memcpy(mgmt->u.probe_resp.variable,
pframe += cur_network->IELength; cur_network->IEs + _FIXED_IE_LENGTH_,
pktlen += cur_network->IELength; cur_network->IELength - _FIXED_IE_LENGTH_);
pktlen += (cur_network->IELength - _FIXED_IE_LENGTH_);
*pLength = pktlen; *pLength = pktlen;
} }
......
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