Browse Source

nl80211: Add parsing of NL80211_BSS_SEEN_MS_AGO into scan results

Jouni Malinen 15 years ago
parent
commit
b3ad11bb80
3 changed files with 8 additions and 0 deletions
  1. 2 0
      src/common/nl80211_copy.h
  2. 3 0
      src/drivers/driver.h
  3. 3 0
      src/drivers/driver_nl80211.c

+ 2 - 0
src/common/nl80211_copy.h

@@ -1277,6 +1277,7 @@ enum nl80211_channel_type {
  * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
  *	in unspecified units, scaled to 0..100 (u8)
  * @NL80211_BSS_STATUS: status, if this BSS is "used"
+ * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms
  * @__NL80211_BSS_AFTER_LAST: internal
  * @NL80211_BSS_MAX: highest BSS attribute
  */
@@ -1291,6 +1292,7 @@ enum nl80211_bss {
 	NL80211_BSS_SIGNAL_MBM,
 	NL80211_BSS_SIGNAL_UNSPEC,
 	NL80211_BSS_STATUS,
+	NL80211_BSS_SEEN_MS_AGO,
 
 	/* keep last */
 	__NL80211_BSS_AFTER_LAST,

+ 3 - 0
src/drivers/driver.h

@@ -134,6 +134,8 @@ struct wpa_scan_result {
  * @noise: noise level
  * @level: signal level
  * @tsf: Timestamp
+ * @age: Age of the information in milliseconds (i.e., how many milliseconds
+ * ago the last Beacon or Probe Response frame was received)
  * @ie_len: length of the following IE field in octets
  *
  * This structure is used as a generic format for scan results from the
@@ -155,6 +157,7 @@ struct wpa_scan_res {
 	int noise;
 	int level;
 	u64 tsf;
+	unsigned int age;
 	size_t ie_len;
 	/* followed by ie_len octets of IEs */
 };

+ 3 - 0
src/drivers/driver_nl80211.c

@@ -1654,6 +1654,7 @@ static int bss_info_handler(struct nl_msg *msg, void *arg)
 		[NL80211_BSS_INFORMATION_ELEMENTS] = { .type = NLA_UNSPEC },
 		[NL80211_BSS_SIGNAL_MBM] = { .type = NLA_U32 },
 		[NL80211_BSS_SIGNAL_UNSPEC] = { .type = NLA_U8 },
+		[NL80211_BSS_SEEN_MS_AGO] = { .type = NLA_U32 },
 	};
 	struct wpa_scan_results *res = arg;
 	struct wpa_scan_res **tmp;
@@ -1700,6 +1701,8 @@ static int bss_info_handler(struct nl_msg *msg, void *arg)
 		r->flags |= WPA_SCAN_LEVEL_INVALID | WPA_SCAN_QUAL_INVALID;
 	if (bss[NL80211_BSS_TSF])
 		r->tsf = nla_get_u64(bss[NL80211_BSS_TSF]);
+	if (bss[NL80211_BSS_SEEN_MS_AGO])
+		r->age = nla_get_u32(bss[NL80211_BSS_SEEN_MS_AGO]);
 	r->ie_len = ie_len;
 	if (ie)
 		os_memcpy(r + 1, ie, ie_len);