]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: show age of last scan
authorHolger Schurig <hs4233@mail.mn-solutions.de>
Thu, 24 Sep 2009 09:20:47 +0000 (11:20 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Wed, 11 Nov 2009 14:19:34 +0000 (15:19 +0100)
This shows how old a scan result entry is.

[johannes: fixed to use NL80211_BSS_SEEN_MS_AGO]

scan.c

diff --git a/scan.c b/scan.c
index 9941775e5dc2e3a2e1a39fb94e4f6883724340ed..02437d109dda2cd6b5a29b4468b58d31a058c609 100644 (file)
--- a/scan.c
+++ b/scan.c
@@ -754,6 +754,7 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
                [NL80211_BSS_SIGNAL_MBM] = { .type = NLA_U32 },
                [NL80211_BSS_SIGNAL_UNSPEC] = { .type = NLA_U8 },
                [NL80211_BSS_STATUS] = { .type = NLA_U32 },
+               [NL80211_BSS_SEEN_MS_AGO] = { .type = NLA_U32 },
        };
        struct scan_params *params = arg;
 
@@ -845,6 +846,10 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
                unsigned char s = nla_get_u8(bss[NL80211_BSS_SIGNAL_UNSPEC]);
                printf("\tsignal: %d/100\n", s);
        }
+       if (bss[NL80211_BSS_SEEN_MS_AGO]) {
+               int age = nla_get_u32(bss[NL80211_BSS_SEEN_MS_AGO]);
+               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]),