]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
support random for sched scan random-scan
authorJohannes Berg <johannes.berg@intel.com>
Wed, 19 Nov 2014 14:25:30 +0000 (15:25 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 19 Nov 2014 14:51:29 +0000 (15:51 +0100)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
scan.c

diff --git a/scan.c b/scan.c
index d2077e3883188b2d34461f72868fc3caf1f77689..891ec13bb9ec1d1b477a99968592795cdaf7dee7 100644 (file)
--- a/scan.c
+++ b/scan.c
@@ -1834,6 +1834,7 @@ static int handle_start_sched_scan(struct nl80211_state *state,
        bool have_matches = false;
        size_t tmp;
        unsigned char *ies;
+       uint32_t flags = 0;
 
        if (argc < 1)
                return 1;
@@ -1884,6 +1885,13 @@ static int handle_start_sched_scan(struct nl80211_state *state,
                                parse = MATCH;
                                have_matches = true;
                                break;
+                       } else if (strncmp(argv[i], "randomise", 9) == 0 ||
+                                  strncmp(argv[i], "randomize", 9) == 0) {
+                               flags |= NL80211_SCAN_FLAG_RANDOM_ADDR;
+                               err = parse_random_mac_addr(msg, argv[i]);
+                               if (err)
+                                       goto nla_put_failure;
+                               break;
                        } else if (strcmp(argv[i], "passive") == 0) {
                                parse = DONE;
                                passive = true;
@@ -1944,6 +1952,9 @@ static int handle_start_sched_scan(struct nl80211_state *state,
        if (have_freqs)
                nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs);
 
+       if (flags)
+               NLA_PUT_U32(msg, NL80211_ATTR_SCAN_FLAGS, flags);
+
        err = 0;
  nla_put_failure:
        nlmsg_free(ssids);