]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
scan: print out "Information elements from Probe Response frame" only if certain
authorJohannes Berg <johannes.berg@intel.com>
Tue, 22 May 2018 20:15:32 +0000 (22:15 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 22 May 2018 20:18:27 +0000 (22:18 +0200)
If we can't be sure that the IEs were really from a probe
response, avoid printing out that they were, since that's
just confusing to the user.
After kernel commit 0e227084aee3 ("cfg80211: clarify BSS
probe response vs. beacon data") in 3.18 it will set the
NL80211_BSS_PRESP_DATA attribute, so we know for sure; we
can also know if the content is different from the beacon
content.

Reported-by: Denis Kenzior <denkenz@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
scan.c

diff --git a/scan.c b/scan.c
index 75495b0ba351e96da0536e3ff758f4a512c3fed7..ec4e1e6b9940c6d06a49401694ea3913572b374d 100644 (file)
--- a/scan.c
+++ b/scan.c
@@ -2182,11 +2182,15 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
        }
 
        if (bss[NL80211_BSS_INFORMATION_ELEMENTS] && show--) {
-               if (bss[NL80211_BSS_BEACON_IES])
+               struct nlattr *ies = bss[NL80211_BSS_INFORMATION_ELEMENTS];
+               struct nlattr *bcnies = bss[NL80211_BSS_BEACON_IES];
+
+               if (bss[NL80211_BSS_PRESP_DATA] ||
+                   nla_len(ies) != nla_len(bcnies) ||
+                   memcmp(nla_data(ies), nla_data(bcnies), nla_len(ies)))
                        printf("\tInformation elements from Probe Response "
                               "frame:\n");
-               print_ies(nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]),
-                         nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]),
+               print_ies(nla_data(ies), nla_len(ies),
                          params->unknown, params->type);
        }
        if (bss[NL80211_BSS_BEACON_IES] && show--) {