]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: implement scheduled scan
authorLuciano Coelho <luciano.coelho@nokia.com>
Tue, 17 Mar 2015 14:11:48 +0000 (16:11 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 17 Mar 2015 15:09:52 +0000 (16:09 +0100)
Add sched_start, sched_stop and events parsing for scheduled scan.
For now, only passive scans are supported.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
event.c
info.c
scan.c

diff --git a/event.c b/event.c
index 71ab7f71f9d5ec51e204ad165f3c8719c52840a4..929854bd8354b7d7a80538fe4a6245ab711cbb5d 100644 (file)
--- a/event.c
+++ b/event.c
@@ -359,6 +359,15 @@ static int print_event(struct nl_msg *msg, void *arg)
                }
                printf("\n");
                break;
+       case NL80211_CMD_START_SCHED_SCAN:
+               printf("scheduled scan started\n");
+               break;
+       case NL80211_CMD_SCHED_SCAN_STOPPED:
+               printf("sched scan stopped\n");
+               break;
+       case NL80211_CMD_SCHED_SCAN_RESULTS:
+               printf("got scheduled scan results\n");
+               break;
        case NL80211_CMD_REG_CHANGE:
                printf("regulatory domain change: ");
 
diff --git a/info.c b/info.c
index 1df503ff1ed979b8c0bdcf742bbf4f97e6dbb06d..66887e38a81abc7d8e942dca72df13fadac53e47 100644 (file)
--- a/info.c
+++ b/info.c
@@ -232,6 +232,12 @@ next:
        if (tb_msg[NL80211_ATTR_MAX_SCAN_IE_LEN])
                printf("\tmax scan IEs length: %d bytes\n",
                       nla_get_u16(tb_msg[NL80211_ATTR_MAX_SCAN_IE_LEN]));
+       if (tb_msg[NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS])
+               printf("\tmax # sched scan SSIDs: %d\n",
+                      nla_get_u8(tb_msg[NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS]));
+       if (tb_msg[NL80211_ATTR_MAX_MATCH_SETS])
+               printf("\tmax # match sets: %d\n",
+                      nla_get_u8(tb_msg[NL80211_ATTR_MAX_MATCH_SETS]));
 
        if (tb_msg[NL80211_ATTR_WIPHY_FRAG_THRESHOLD]) {
                unsigned int frag;
diff --git a/scan.c b/scan.c
index d1c3bf21ce1c4542933e306f394400e360298b3e..e534fd48b4c6ed50b5c934a5256284ca2bfcf5f2 100644 (file)
--- a/scan.c
+++ b/scan.c
@@ -1980,3 +1980,32 @@ COMMAND(scan, trigger, "[freq <freq>*] [ies <hex as 00:11:..>] [meshid <meshid>]
        NL80211_CMD_TRIGGER_SCAN, 0, CIB_NETDEV, handle_scan,
         "Trigger a scan on the given frequencies with probing for the given\n"
         "SSIDs (or wildcard if not given) unless passive scanning is requested.");
+
+
+static int handle_start_sched_scan(struct nl80211_state *state,
+                                  struct nl_cb *cb, struct nl_msg *msg,
+                                  int argc, char **argv, enum id_input id)
+{
+       return parse_sched_scan(msg, &argc, &argv);
+}
+
+static int handle_stop_sched_scan(struct nl80211_state *state, struct nl_cb *cb,
+                                 struct nl_msg *msg, int argc, char **argv,
+                                 enum id_input id)
+{
+       if (argc != 0)
+               return 1;
+
+       return 0;
+}
+
+COMMAND(scan, sched_start,
+       SCHED_SCAN_OPTIONS,
+       NL80211_CMD_START_SCHED_SCAN, 0, CIB_NETDEV, handle_start_sched_scan,
+       "Start a scheduled scan at the specified interval on the given frequencies\n"
+       "with probing for the given SSIDs (or wildcard if not given) unless passive\n"
+       "scanning is requested.  If matches are specified, only matching results\n"
+       "will be returned.");
+COMMAND(scan, sched_stop, "",
+       NL80211_CMD_STOP_SCHED_SCAN, 0, CIB_NETDEV, handle_stop_sched_scan,
+       "Stop an ongoing scheduled scan.");