iw: show age of last scan
PATCH 1/1 iw: show age of last scan
This shows how old a scan result entry is.
---
Example:
# ./iw eth1 scan trigger freq 2412
# sleep 1
# ./iw eth1 scan dump | grep seen
last seen: 832 ms ago
last seen: 852 ms ago
last seen: 852 ms ago
# sleep 1
# ./iw eth1 scan dump | grep seen
last seen: 1836 ms ago
last seen: 1856 ms ago
last seen: 1856 ms agoscan.c +5 -0
@@ -754,6 +754,7 @@ static int print_bss_handler(struct nl_m [NL80211_BSS_SIGNAL_MBM] = { .type = NLA_U32 }, [NL80211_BSS_SIGNAL_UNSPEC] = { .type = NLA_U8 }, [NL80211_BSS_STATUS] = { .type = NLA_U32 }, + [NL80211_BSS_AGE_MS] = { .type = NLA_U32 }, };struct scan_params *params = arg;
@@ -845,6 +846,10 @@ static int print_bss_handler(struct nl_munsigned char s =nla_get_u8 (bss[NL80211_BSS_SIGNAL_UNSPEC ]);printf ("\tsignal: %d/100\n" , s); } +if (bss[NL80211_BSS_AGE_MS ]) { +int age =nla_get_u32 (bss[NL80211_BSS_AGE_MS ]); +printf ("\tlast seen: %d ms ago\n" , age); + }if (bss[NL80211_BSS_INFORMATION_ELEMENTS ]) print_ies(nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]), nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]),
nl80211.h +2 -0
@@ -1261,6 +1261,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_AGE_MS: age of this BSS entry in ms * @__NL80211_BSS_AFTER_LAST: internal * @NL80211_BSS_MAX: highest BSS attribute */
@@ -1275,6 +1276,7 @@ enum nl80211_bss {NL80211_BSS_SIGNAL_MBM ,NL80211_BSS_SIGNAL_UNSPEC ,NL80211_BSS_STATUS , +NL80211_BSS_AGE_MS ,/* keep last */ __NL80211_BSS_AFTER_LAST,
Signature · 1 line
http://www.holgerschurig.de