staging: rtl8723au: Update bss beacon info in rtw_add_beacon()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Thu, 19 Jun 2014 09:37:24 +0000 (11:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2014 20:08:50 +0000 (13:08 -0700)
Pull out the core info beacon_interval, capability, and tsf and update
cur_network.network with the info in rtw_add_beacon() instead of
relying on it being in ->IEs.

This will help later when getting rid of the beacon struct info from
->IEs and only carrying the actual IEs there.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_ap.c
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c

index 73161b943b302b5a249592b2df5ed6e23ae6098d..e943b6be6496fb1c54f28c04f37c67e1ab388743 100644 (file)
@@ -798,7 +798,6 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf,
        u8 *pHT_caps_ie = NULL;
        u8 *pHT_info_ie = NULL;
        struct sta_info *psta = NULL;
-       __le16 *pbeacon;
        u16 cap, ht_cap = false;
        uint ie_len = 0;
        int group_cipher, pairwise_cipher;
@@ -844,11 +843,6 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf,
 
        memcpy(pbss_network->MacAddress, myid(&padapter->eeprompriv), ETH_ALEN);
 
-       /* beacon interval */
-       /* ie + 8;  8: TimeStamp, 2: Beacon Interval 2:Capability */
-       pbeacon = rtw_get_beacon_interval23a_from_ie(ie);
-       pbss_network->beacon_interval = get_unaligned_le16(pbeacon);
-
        /* capability */
        cap = get_unaligned_le16(ie);
 
index 80d5fe7bf00bbb482fa965af8a172940719b7942..6c06d5772cb42c0e002eea54417f323b6995a13a 100644 (file)
@@ -2915,6 +2915,8 @@ static int rtw_add_beacon(struct rtw_adapter *adapter, const u8 *head,
        u8 *pbuf;
        uint len, wps_ielen = 0;
        struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
+       struct wlan_bssid_ex *bss = &pmlmepriv->cur_network.network;
+       const struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)head;
        /* struct sta_priv *pstapriv = &padapter->stapriv; */
 
        DBG_8723A("%s beacon_head_len =%zu, beacon_tail_len =%zu\n",
@@ -2923,12 +2925,17 @@ static int rtw_add_beacon(struct rtw_adapter *adapter, const u8 *head,
        if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true)
                return -EINVAL;
 
-       if (head_len < sizeof(struct ieee80211_hdr_3addr))
+       if (head_len < offsetof(struct ieee80211_mgmt, u.beacon.variable))
                return -EINVAL;
 
        pbuf = kzalloc(head_len + tail_len, GFP_KERNEL);
        if (!pbuf)
                return -ENOMEM;
+
+       bss->beacon_interval = get_unaligned_le16(&mgmt->u.beacon.beacon_int);
+       bss->capability = get_unaligned_le16(&mgmt->u.beacon.capab_info);
+       bss->tsf = get_unaligned_le64(&mgmt->u.beacon.timestamp);
+
        /*  24 = beacon header len. */
        memcpy(pbuf, (void *)head + sizeof(struct ieee80211_hdr_3addr),
               head_len - sizeof(struct ieee80211_hdr_3addr));