]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - scan.c
update for new scan patch
[thirdparty/iw.git] / scan.c
diff --git a/scan.c b/scan.c
index ac2f48cb147b90fa7e8014118cf8221b072e9d92..a47ad81662ba3670a3b97e210a169fa4e51be3a2 100644 (file)
--- a/scan.c
+++ b/scan.c
@@ -93,12 +93,11 @@ static const printfn ieprinters[] = {
        [50] = print_supprates,
        [221] = print_vendor,
 };
-#define NUMPRINTERS (sizeof(ieprinters)/sizeof(ieprinters[0]))
 
 static void print_ies(unsigned char *ie, int ielen)
 {
        while (ielen >= 2 && ielen >= ie[1]) {
-               if (ie[0] < NUMPRINTERS && ieprinters[ie[0]]) {
+               if (ie[0] < ARRAY_SIZE(ieprinters) && ieprinters[ie[0]]) {
                        ieprinters[ie[0]](ie[0], ie[1], ie + 2);
                } else {
                        int i;
@@ -126,6 +125,8 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
                [NL80211_BSS_BEACON_INTERVAL] = { .type = NLA_U16 },
                [NL80211_BSS_CAPABILITY] = { .type = NLA_U16 },
                [NL80211_BSS_INFORMATION_ELEMENTS] = { },
+               [NL80211_BSS_SIGNAL_MBM] = { .type = NLA_U32 },
+               [NL80211_BSS_SIGNAL_UNSPEC] = { .type = NLA_U8 },
        };
 
        nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@@ -161,6 +162,14 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
        if (bss[NL80211_BSS_CAPABILITY])
                printf("\tcapability: 0x%.4x\n",
                        nla_get_u16(bss[NL80211_BSS_CAPABILITY]));
+       if (bss[NL80211_BSS_SIGNAL_MBM]) {
+               int s = nla_get_u32(bss[NL80211_BSS_SIGNAL_MBM]);
+               printf("\tsignal: %d.%.2d dBm\n", s/100, s%100);
+       }
+       if (bss[NL80211_BSS_SIGNAL_UNSPEC]) {
+               unsigned char s = nla_get_u8(bss[NL80211_BSS_SIGNAL_UNSPEC]);
+               printf("\tsignal: %d/100\n", s);
+       }
        if (bss[NL80211_BSS_INFORMATION_ELEMENTS])
                print_ies(nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]),
                          nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]));