@@ -3360,6 +3360,9 @@ enum nl80211_bss_scan_width {
* (not present if no beacon frame has been received yet)
* @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
* @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
+ * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
+ * was last updated by a received frame. The value is expected to be
+ * accurate to about 10ms. (u64, nanoseconds)
* @__NL80211_BSS_AFTER_LAST: internal
* @NL80211_BSS_MAX: highest BSS attribute
*/
@@ -3379,6 +3382,7 @@ enum nl80211_bss {
NL80211_BSS_CHAN_WIDTH,
NL80211_BSS_BEACON_TSF,
NL80211_BSS_PRESP_DATA,
+ NL80211_BSS_LAST_SEEN_BOOTTIME,
/* keep last */
__NL80211_BSS_AFTER_LAST,
@@ -1853,6 +1853,8 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
char mac_addr[20], dev[20];
static struct nla_policy bss_policy[NL80211_BSS_MAX + 1] = {
[NL80211_BSS_TSF] = { .type = NLA_U64 },
+ [NL80211_BSS_BEACON_TSF] = { .type = NLA_U64 },
+ [NL80211_BSS_LAST_SEEN_BOOTTIME] = { .type = NLA_U64 },
[NL80211_BSS_FREQUENCY] = { .type = NLA_U32 },
[NL80211_BSS_BSSID] = { },
[NL80211_BSS_BEACON_INTERVAL] = { .type = NLA_U16 },
@@ -1918,6 +1920,23 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
tsf, tsf/1000/1000/60/60/24, (tsf/1000/1000/60/60) % 24,
(tsf/1000/1000/60) % 60, (tsf/1000/1000) % 60);
}
+ if (bss[NL80211_BSS_BEACON_TSF]) {
+ unsigned long long tsf;
+ tsf = (unsigned long long)nla_get_u64(bss[NL80211_BSS_BEACON_TSF]);
+ printf("\tBeacon TSF: %llu usec (%llud, %.2lld:%.2llu:%.2llu)\n",
+ tsf, tsf/1000/1000/60/60/24, (tsf/1000/1000/60/60) % 24,
+ (tsf/1000/1000/60) % 60, (tsf/1000/1000) % 60);
+ }
+ if (bss[NL80211_BSS_LAST_SEEN_BOOTTIME]) {
+ unsigned long long last_seen_since_boot;
+ last_seen_since_boot =
+ (unsigned long long)nla_get_u64(bss[NL80211_BSS_LAST_SEEN_BOOTTIME]);
+ printf("\tlast seen since boot time: %llu usec (%llud, %.2lld:%.2llu:%.2llu)\n",
+ last_seen_since_boot, last_seen_since_boot /1000/1000/1000/60/60/24,
+ (last_seen_since_boot /1000/1000/1000/60/60) % 24,
+ (last_seen_since_boot/1000/1000/1000/60) % 60,
+ (last_seen_since_boot/1000/1000/1000) % 60);
+ }
if (bss[NL80211_BSS_FREQUENCY]) {
int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
printf("\tfreq: %d\n", freq);
This patch allows iw to print NL80211_BSS_LAST_SEEN_BOOTTIME values on scan results. Signed-off-by: Ningyuan Wang <nywang@google.com> --- nl80211.h | 4 ++++ scan.c | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+)