Determine whether Beacon frame information is newer in scan results
It can be helpful to know whether the information elements from the Beacon frame or the Probe Response frame are newer when using BSS table entries, so make this information known, if available. This allows the Beacon frame elements to be preferred over the Probe Response frame elements when desired. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
28c9f29a31
commit
284e3ad196
4 changed files with 9 additions and 1 deletions
|
@ -338,6 +338,7 @@ struct hostapd_hw_modes {
|
|||
* @parent_tsf: Time when the Beacon/Probe Response frame was received in terms
|
||||
* of TSF of the BSS specified by %tsf_bssid.
|
||||
* @tsf_bssid: The BSS that %parent_tsf TSF time refers to.
|
||||
* @beacon_newer: Whether the Beacon frame data is known to be newer
|
||||
* @ie_len: length of the following IE field in octets
|
||||
* @beacon_ie_len: length of the following Beacon IE field in octets
|
||||
*
|
||||
|
@ -370,6 +371,7 @@ struct wpa_scan_res {
|
|||
int snr;
|
||||
u64 parent_tsf;
|
||||
u8 tsf_bssid[ETH_ALEN];
|
||||
bool beacon_newer;
|
||||
size_t ie_len;
|
||||
size_t beacon_ie_len;
|
||||
/* Followed by ie_len + beacon_ie_len octets of IE data */
|
||||
|
|
|
@ -713,6 +713,7 @@ nl80211_parse_bss_info(struct wpa_driver_nl80211_data *drv,
|
|||
[NL80211_BSS_STATUS] = { .type = NLA_U32 },
|
||||
[NL80211_BSS_SEEN_MS_AGO] = { .type = NLA_U32 },
|
||||
[NL80211_BSS_BEACON_IES] = { .type = NLA_UNSPEC },
|
||||
[NL80211_BSS_BEACON_TSF] = { .type = NLA_U64 },
|
||||
[NL80211_BSS_PARENT_TSF] = { .type = NLA_U64 },
|
||||
[NL80211_BSS_PARENT_BSSID] = { .type = NLA_UNSPEC },
|
||||
[NL80211_BSS_LAST_SEEN_BOOTTIME] = { .type = NLA_U64 },
|
||||
|
@ -774,8 +775,10 @@ nl80211_parse_bss_info(struct wpa_driver_nl80211_data *drv,
|
|||
r->tsf = nla_get_u64(bss[NL80211_BSS_TSF]);
|
||||
if (bss[NL80211_BSS_BEACON_TSF]) {
|
||||
u64 tsf = nla_get_u64(bss[NL80211_BSS_BEACON_TSF]);
|
||||
if (tsf > r->tsf)
|
||||
if (tsf > r->tsf) {
|
||||
r->tsf = tsf;
|
||||
r->beacon_newer = true;
|
||||
}
|
||||
}
|
||||
if (bss[NL80211_BSS_SEEN_MS_AGO])
|
||||
r->age = nla_get_u32(bss[NL80211_BSS_SEEN_MS_AGO]);
|
||||
|
|
|
@ -291,6 +291,7 @@ static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
|
|||
dst->noise = src->noise;
|
||||
dst->level = src->level;
|
||||
dst->tsf = src->tsf;
|
||||
dst->beacon_newer = src->beacon_newer;
|
||||
dst->est_throughput = src->est_throughput;
|
||||
dst->snr = src->snr;
|
||||
|
||||
|
|
|
@ -108,6 +108,8 @@ struct wpa_bss {
|
|||
int level;
|
||||
/** Timestamp of last Beacon/Probe Response frame */
|
||||
u64 tsf;
|
||||
/** Whether the Beacon frame data is known to be newer */
|
||||
bool beacon_newer;
|
||||
/** Time of the last update (i.e., Beacon or Probe Response RX) */
|
||||
struct os_reltime last_update;
|
||||
/** Estimated throughput in kbps */
|
||||
|
|
Loading…
Reference in a new issue