[pkg-wpa-devel] r1949 - in /iw/trunk: debian/changelog debian/patches/iw_trivial-spelling-fix-initial.patch debian/patches/series event.c info.c iw.h nl80211.h scan.c version.sh wowlan.c
slh-guest at users.alioth.debian.org
slh-guest at users.alioth.debian.org
Wed May 27 01:42:02 UTC 2015
Author: slh-guest
Date: Wed May 27 01:42:02 2015
New Revision: 1949
URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1949
Log:
New upstream version.
Removed:
iw/trunk/debian/patches/iw_trivial-spelling-fix-initial.patch
Modified:
iw/trunk/debian/changelog
iw/trunk/debian/patches/series
iw/trunk/event.c
iw/trunk/info.c
iw/trunk/iw.h
iw/trunk/nl80211.h
iw/trunk/scan.c
iw/trunk/version.sh
iw/trunk/wowlan.c
Modified: iw/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/debian/changelog?rev=1949&op=diff
==============================================================================
--- iw/trunk/debian/changelog (original)
+++ iw/trunk/debian/changelog Wed May 27 01:42:02 2015
@@ -1,13 +1,12 @@
-iw (4.0-1) UNRELEASED; urgency=medium
+iw (4.1-1) UNRELEASED; urgency=medium
* NOT RELEASED YET
* New upstream release:
- refresh patches.
- make sure to use /run/netns directly, rather than using the indirection
via /var/run/.
- - add "iw: trivial spelling fix (initial)".
- -- Stefan Lippers-Hollmann <s.l-h at gmx.de> Tue, 28 Apr 2015 03:51:58 +0200
+ -- Stefan Lippers-Hollmann <s.l-h at gmx.de> Wed, 27 May 2015 03:40:42 +0200
iw (3.17-1) unstable; urgency=medium
Modified: iw/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/debian/patches/series?rev=1949&op=diff
==============================================================================
--- iw/trunk/debian/patches/series (original)
+++ iw/trunk/debian/patches/series Wed May 27 01:42:02 2015
@@ -1,2 +1 @@
append-cppflags.patch
-iw_trivial-spelling-fix-initial.patch
Modified: iw/trunk/event.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/event.c?rev=1949&op=diff
==============================================================================
--- iw/trunk/event.c (original)
+++ iw/trunk/event.c Wed May 27 01:42:02 2015
@@ -358,6 +358,15 @@
}
}
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: ");
Modified: iw/trunk/info.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/info.c?rev=1949&op=diff
==============================================================================
--- iw/trunk/info.c (original)
+++ iw/trunk/info.c Wed May 27 01:42:02 2015
@@ -63,6 +63,18 @@
}
}
+static int ext_feature_isset(const unsigned char *ext_features, int ext_features_len,
+ enum nl80211_ext_feature_index ftidx)
+{
+ unsigned char ft_byte;
+
+ if ((int) ftidx / 8 >= ext_features_len)
+ return 0;
+
+ ft_byte = ext_features[ftidx / 8];
+ return (ft_byte & BIT(ftidx % 8)) != 0;
+}
+
static int print_phy_handler(struct nl_msg *msg, void *arg)
{
struct nlattr *tb_msg[NL80211_ATTR_MAX + 1];
@@ -232,6 +244,12 @@
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;
@@ -595,6 +613,14 @@
printf("\tDevice supports TDLS channel switching\n");
}
+ if (tb_msg[NL80211_ATTR_EXT_FEATURES]) {
+ struct nlattr *tb = tb_msg[NL80211_ATTR_EXT_FEATURES];
+
+ if (ext_feature_isset(nla_data(tb), nla_len(tb),
+ NL80211_EXT_FEATURE_VHT_IBSS))
+ printf("\tDevice supports VHT-IBSS.\n");
+ }
+
if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])
printf("\tDevice supports T-DLS.\n");
Modified: iw/trunk/iw.h
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/iw.h?rev=1949&op=diff
==============================================================================
--- iw/trunk/iw.h (original)
+++ iw/trunk/iw.h Wed May 27 01:42:02 2015
@@ -173,6 +173,10 @@
void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
+#define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
+ "[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
+int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
+
DECLARE_SECTION(set);
DECLARE_SECTION(get);
Modified: iw/trunk/nl80211.h
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/nl80211.h?rev=1949&op=diff
==============================================================================
--- iw/trunk/nl80211.h (original)
+++ iw/trunk/nl80211.h Wed May 27 01:42:02 2015
@@ -23,6 +23,19 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
+ */
+
+/*
+ * This header file defines the userspace API to the wireless stack. Please
+ * be careful not to break things - i.e. don't move anything around or so
+ * unless you can demonstrate that it breaks neither API nor ABI.
+ *
+ * Additions to the API should be accompanied by actual implementations in
+ * an upstream driver, so that example implementations exist in case there
+ * are ever concerns about the precise semantics of the API or changes are
+ * needed, and to ensure that code for dead (no longer implemented) API
+ * can actually be identified and removed.
+ * Nonetheless, semantics should also be documented carefully in this file.
*/
#include <linux/types.h>
@@ -1684,6 +1697,10 @@
* If set during scheduled scan start then the new scan req will be
* owned by the netlink socket that created it and the scheduled scan will
* be stopped when the socket is closed.
+ * If set during configuration of regulatory indoor operation then the
+ * regulatory indoor configuration would be owned by the netlink socket
+ * that configured the indoor setting, and the indoor operation would be
+ * cleared when the socket is closed.
*
* @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
* the TDLS link initiator.
@@ -1737,8 +1754,12 @@
* should be contained in the result as the sum of the respective counters
* over all channels.
*
- * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before a scheduled scan (or a
- * WoWLAN net-detect scan) is started, u32 in seconds.
+ * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before the first cycle of a
+ * scheduled scan (or a WoWLAN net-detect scan) is started, u32
+ * in seconds.
+
+ * @NL80211_ATTR_REG_INDOOR: flag attribute, if set indicates that the device
+ * is operating in an indoor environment.
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2106,6 +2127,8 @@
NL80211_ATTR_NETNS_FD,
NL80211_ATTR_SCHED_SCAN_DELAY,
+
+ NL80211_ATTR_REG_INDOOR,
/* add attributes here, update the policy in nl80211.c */
@@ -3092,7 +3115,8 @@
*
* @NL80211_MESHCONF_PLINK_TIMEOUT: If no tx activity is seen from a STA we've
* established peering with for longer than this time (in seconds), then
- * remove it from the STA's list of peers. Default is 30 minutes.
+ * remove it from the STA's list of peers. You may set this to 0 to disable
+ * the removal of the STA. Default is 30 minutes.
*
* @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
*/
@@ -3694,6 +3718,8 @@
* @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put
* the chip into a special state -- works best with chips that have
* support for low-power operation already (flag)
+ * Note that this mode is incompatible with all of the others, if
+ * any others are even supported by the device.
* @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect
* is detected is implementation-specific (flag)
* @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed
@@ -4327,11 +4353,13 @@
/**
* enum nl80211_ext_feature_index - bit index of extended features.
+ * @NL80211_EXT_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
*
* @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
*/
enum nl80211_ext_feature_index {
+ NL80211_EXT_FEATURE_VHT_IBSS,
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
Modified: iw/trunk/scan.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/scan.c?rev=1949&op=diff
==============================================================================
--- iw/trunk/scan.c (original)
+++ iw/trunk/scan.c Wed May 27 01:42:02 2015
@@ -97,6 +97,243 @@
return 0;
nla_put_failure:
return -ENOBUFS;
+}
+
+int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv)
+{
+ struct nl_msg *matchset = NULL, *freqs = NULL, *ssids = NULL;
+ struct nlattr *match = NULL;
+ enum {
+ ND_TOPLEVEL,
+ ND_MATCH,
+ ND_FREQS,
+ ND_ACTIVE,
+ } parse_state = ND_TOPLEVEL;
+ int c = *argc;
+ char *end, **v = *argv;
+ int err = 0, i = 0;
+ unsigned int freq, interval = 0, delay = 0;
+ bool have_matchset = false, have_freqs = false, have_ssids = false;
+ bool have_active = false, have_passive = false;
+ uint32_t flags = 0;
+
+ matchset = nlmsg_alloc();
+ if (!matchset) {
+ err = -ENOBUFS;
+ goto out;
+ }
+
+ freqs = nlmsg_alloc();
+ if (!freqs) {
+ err = -ENOBUFS;
+ goto out;
+ }
+
+ ssids = nlmsg_alloc();
+ if (!ssids) {
+ err = -ENOMEM;
+ goto out;
+ }
+
+ while (c) {
+ switch (parse_state) {
+ case ND_TOPLEVEL:
+ if (!strcmp(v[0], "interval")) {
+ c--; v++;
+ if (c == 0) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ if (interval) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+ interval = strtoul(v[0], &end, 10);
+ if (*end || !interval) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+ NLA_PUT_U32(msg,
+ NL80211_ATTR_SCHED_SCAN_INTERVAL,
+ interval);
+ } else if (!strcmp(v[0], "delay")) {
+ c--; v++;
+ if (c == 0) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ if (delay) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+ delay = strtoul(v[0], &end, 10);
+ if (*end) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+ NLA_PUT_U32(msg,
+ NL80211_ATTR_SCHED_SCAN_DELAY,
+ delay);
+ } else if (!strcmp(v[0], "matches")) {
+ parse_state = ND_MATCH;
+ if (have_matchset) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ i = 0;
+ } else if (!strcmp(v[0], "freqs")) {
+ parse_state = ND_FREQS;
+ if (have_freqs) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ have_freqs = true;
+ i = 0;
+ } else if (!strcmp(v[0], "active")) {
+ parse_state = ND_ACTIVE;
+ if (have_active || have_passive) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ have_active = true;
+ i = 0;
+ } else if (!strcmp(v[0], "passive")) {
+ if (have_active || have_passive) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ have_passive = true;
+ } else if (!strncmp(v[0], "randomise", 9) ||
+ !strncmp(v[0], "randomize", 9)) {
+ flags |= NL80211_SCAN_FLAG_RANDOM_ADDR;
+ if (c > 0) {
+ err = parse_random_mac_addr(msg, v[0]);
+ if (err)
+ goto nla_put_failure;
+ }
+ } else {
+ /* this element is not for us, so
+ * return to continue parsing.
+ */
+ goto nla_put_failure;
+ }
+ c--; v++;
+
+ break;
+ case ND_MATCH:
+ if (!strcmp(v[0], "ssid")) {
+ c--; v++;
+ if (c == 0) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ /* TODO: for now we can only have an
+ * SSID in the match, so we can start
+ * the match nest here.
+ */
+ match = nla_nest_start(matchset, i);
+ if (!match) {
+ err = -ENOBUFS;
+ goto nla_put_failure;
+ }
+
+ NLA_PUT(matchset,
+ NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
+ strlen(v[0]), v[0]);
+ nla_nest_end(matchset, match);
+ match = NULL;
+
+ have_matchset = true;
+ i++;
+ c--; v++;
+ } else {
+ /* other element that cannot be part
+ * of a match indicates the end of the
+ * match. */
+ /* need at least one match in the matchset */
+ if (i == 0) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ parse_state = ND_TOPLEVEL;
+ }
+
+ break;
+ case ND_FREQS:
+ freq = strtoul(v[0], &end, 10);
+ if (*end) {
+ if (i == 0) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ parse_state = ND_TOPLEVEL;
+ } else {
+ NLA_PUT_U32(freqs, i, freq);
+ i++;
+ c--; v++;
+ }
+ break;
+ case ND_ACTIVE:
+ if (!strcmp(v[0], "ssid")) {
+ c--; v++;
+ if (c == 0) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ NLA_PUT(ssids,
+ NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
+ strlen(v[0]), v[0]);
+
+ have_ssids = true;
+ i++;
+ c--; v++;
+ } else {
+ /* other element that cannot be part
+ * of a match indicates the end of the
+ * active set. */
+ /* need at least one item in the set */
+ if (i == 0) {
+ err = -EINVAL;
+ goto nla_put_failure;
+ }
+
+ parse_state = ND_TOPLEVEL;
+ }
+ break;
+ }
+ }
+
+ if (!have_ssids)
+ NLA_PUT(ssids, 1, 0, "");
+ if (!have_passive)
+ nla_put_nested(msg, NL80211_ATTR_SCAN_SSIDS, ssids);
+ if (have_freqs)
+ nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs);
+ if (have_matchset)
+ nla_put_nested(msg, NL80211_ATTR_SCHED_SCAN_MATCH, matchset);
+ if (flags)
+ NLA_PUT_U32(msg, NL80211_ATTR_SCAN_FLAGS, flags);
+
+nla_put_failure:
+ if (match)
+ nla_nest_end(msg, match);
+ nlmsg_free(freqs);
+ nlmsg_free(matchset);
+
+out:
+ *argc = c;
+ *argv = v;
+ return err;
}
static int handle_scan(struct nl80211_state *state,
@@ -410,6 +647,9 @@
case 6:
printf("AES-128-CMAC");
break;
+ case 7:
+ printf("NO-GROUP");
+ break;
case 8:
printf("GCMP");
break;
@@ -466,24 +706,37 @@
data[0], data[1] ,data[2], data[3]);
break;
}
+ } else if (memcmp(data, wfa_oui, 3) == 0) {
+ switch (data[3]) {
+ case 1:
+ printf("OSEN");
+ break;
+ default:
+ printf("%.02x-%.02x-%.02x:%d",
+ data[0], data[1] ,data[2], data[3]);
+ break;
+ }
} else
printf("%.02x-%.02x-%.02x:%d",
data[0], data[1] ,data[2], data[3]);
}
-static void print_rsn_ie(const char *defcipher, const char *defauth,
- uint8_t len, const uint8_t *data)
+static void _print_rsn_ie(const char *defcipher, const char *defauth,
+ uint8_t len, const uint8_t *data, int is_osen)
{
bool first = true;
- __u16 version, count, capa;
+ __u16 count, capa;
int i;
- version = data[0] + (data[1] << 8);
- tab_on_first(&first);
- printf("\t * Version: %d\n", version);
-
- data += 2;
- len -= 2;
+ if (!is_osen) {
+ __u16 version;
+ version = data[0] + (data[1] << 8);
+ tab_on_first(&first);
+ printf("\t * Version: %d\n", version);
+
+ data += 2;
+ len -= 2;
+ }
if (len < 4) {
tab_on_first(&first);
@@ -625,6 +878,19 @@
}
printf("\n");
}
+}
+
+static void print_rsn_ie(const char *defcipher, const char *defauth,
+ uint8_t len, const uint8_t *data)
+{
+ _print_rsn_ie(defcipher, defauth, len, data, 0);
+}
+
+static void print_osen_ie(const char *defcipher, const char *defauth,
+ uint8_t len, const uint8_t *data)
+{
+ printf("\n\t");
+ _print_rsn_ie(defcipher, defauth, len, data, 1);
}
static void print_rsn(const uint8_t type, uint8_t len, const uint8_t *data)
@@ -1076,6 +1342,11 @@
print_rsn_ie("TKIP", "IEEE 802.1X", len, data);
}
+static void print_wifi_osen(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+ print_osen_ie("OSEN", "OSEN", len, data);
+}
+
static bool print_wifi_wmm_param(const uint8_t *data, uint8_t len)
{
int i;
@@ -1429,6 +1700,7 @@
static const struct ie_print wfa_printers[] = {
[9] = { "P2P", print_p2p, 2, 255, BIT(PRINT_SCAN), },
[16] = { "HotSpot 2.0 Indication", print_hs20_ind, 1, 255, BIT(PRINT_SCAN), },
+ [18] = { "HotSpot 2.0 OSEN", print_wifi_osen, 1, 255, BIT(PRINT_SCAN), },
};
static void print_vendor(unsigned char len, unsigned char *data,
@@ -1810,3 +2082,32 @@
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.");
Modified: iw/trunk/version.sh
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/version.sh?rev=1949&op=diff
==============================================================================
--- iw/trunk/version.sh (original)
+++ iw/trunk/version.sh Wed May 27 01:42:02 2015
@@ -1,6 +1,6 @@
#!/bin/sh
-VERSION="4.0"
+VERSION="4.1"
OUT="$1"
if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then
Modified: iw/trunk/wowlan.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/wowlan.c?rev=1949&op=diff
==============================================================================
--- iw/trunk/wowlan.c (original)
+++ iw/trunk/wowlan.c Wed May 27 01:42:02 2015
@@ -183,177 +183,17 @@
static int wowlan_parse_net_detect(struct nl_msg *msg, int *argc, char ***argv)
{
- struct nl_msg *matchset = NULL, *freqs = NULL;
- struct nlattr *nd, *match = NULL;
- enum {
- ND_TOPLEVEL,
- ND_MATCH,
- ND_FREQS,
- } parse_state = ND_TOPLEVEL;
- int c = *argc;
- char *end, **v = *argv;
- int err = 0, i = 0;
- unsigned int freq, interval = 0, delay = 0;
- bool have_matchset = false, have_freqs = false;
+ struct nlattr *nd;
+ int err = 0;
nd = nla_nest_start(msg, NL80211_WOWLAN_TRIG_NET_DETECT);
- if (!nd) {
- err = -ENOBUFS;
- goto out;
- }
-
- matchset = nlmsg_alloc();
- if (!matchset) {
- err = -ENOBUFS;
- goto out;
- }
-
- freqs = nlmsg_alloc();
- if (!freqs) {
- err = -ENOBUFS;
- goto out;
- }
-
- while (c) {
- switch (parse_state) {
- case ND_TOPLEVEL:
- if (!strcmp(v[0], "interval")) {
- c--; v++;
- if (c == 0) {
- err = -EINVAL;
- goto nla_put_failure;
- }
-
- if (interval) {
- err = -EINVAL;
- goto nla_put_failure;
- }
- interval = strtoul(v[0], &end, 10);
- if (*end || !interval) {
- err = -EINVAL;
- goto nla_put_failure;
- }
- NLA_PUT_U32(msg,
- NL80211_ATTR_SCHED_SCAN_INTERVAL,
- interval);
- } else if (!strcmp(v[0], "delay")) {
- c--; v++;
- if (c == 0) {
- err = -EINVAL;
- goto nla_put_failure;
- }
-
- if (delay) {
- err = -EINVAL;
- goto nla_put_failure;
- }
- delay = strtoul(v[0], &end, 10);
- if (*end) {
- err = -EINVAL;
- goto nla_put_failure;
- }
- NLA_PUT_U32(msg,
- NL80211_ATTR_SCHED_SCAN_DELAY,
- delay);
- } else if (!strcmp(v[0], "matches")) {
- parse_state = ND_MATCH;
- if (have_matchset) {
- err = -EINVAL;
- goto nla_put_failure;
- }
-
- i = 0;
- } else if (!strcmp(v[0], "freqs")) {
- parse_state = ND_FREQS;
- if (have_freqs) {
- err = -EINVAL;
- goto nla_put_failure;
- }
-
- have_freqs = true;
- i = 0;
- } else {
- /* this element is not for us, so
- * return to continue parsing.
- */
- goto nla_put_failure;
- }
- c--; v++;
-
- break;
- case ND_MATCH:
- if (!strcmp(v[0], "ssid")) {
- c--; v++;
- if (c == 0) {
- err = -EINVAL;
- goto nla_put_failure;
- }
-
- /* TODO: for now we can only have an
- * SSID in the match, so we can start
- * the match nest here.
- */
- match = nla_nest_start(matchset, i);
- if (!match) {
- err = -ENOBUFS;
- goto nla_put_failure;
- }
-
- NLA_PUT(matchset,
- NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
- strlen(v[0]), v[0]);
- nla_nest_end(matchset, match);
- match = NULL;
-
- have_matchset = true;
- i++;
- c--; v++;
- } else {
- /* other element that cannot be part
- * of a match indicates the end of the
- * match. */
- /* need at least one match in the matchset */
- if (i == 0) {
- err = -EINVAL;
- goto nla_put_failure;
- }
-
- parse_state = ND_TOPLEVEL;
- }
-
- break;
- case ND_FREQS:
- freq = strtoul(v[0], &end, 10);
- if (*end) {
- if (i == 0) {
- err = -EINVAL;
- goto nla_put_failure;
- }
-
- parse_state = ND_TOPLEVEL;
- } else {
- NLA_PUT_U32(freqs, i, freq);
- i++;
- c--; v++;
- }
- break;
- }
- }
-
- if (have_freqs)
- nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs);
- if (have_matchset)
- nla_put_nested(msg, NL80211_ATTR_SCHED_SCAN_MATCH, matchset);
-
-nla_put_failure:
- if (match)
- nla_nest_end(msg, match);
- nlmsg_free(freqs);
- nlmsg_free(matchset);
+ if (!nd)
+ return -ENOBUFS;
+
+ err = parse_sched_scan(msg, argc, argv);
+
nla_nest_end(msg, nd);
-out:
- *argc = c;
- *argv = v;
+
return err;
}
@@ -473,7 +313,7 @@
return err;
}
COMMAND(wowlan, enable, "[any] [disconnect] [magic-packet] [gtk-rekey-failure] [eap-identity-request]"
- " [4way-handshake] [rfkill-release] [net-detect interval <in_msecs> [delay <in_secs>] [freqs <freq>+] [matches [ssid <ssid>]+]]"
+ " [4way-handshake] [rfkill-release] [net-detect " SCHED_SCAN_OPTIONS "]"
" [tcp <config-file>] [patterns [offset1+]<pattern1> ...]",
NL80211_CMD_SET_WOWLAN, 0, CIB_PHY, handle_wowlan_enable,
"Enable WoWLAN with the given triggers.\n"
@@ -557,7 +397,7 @@
nla_get_u32(nd[NL80211_ATTR_SCHED_SCAN_INTERVAL]));
if (nd[NL80211_ATTR_SCHED_SCAN_DELAY])
- printf("\tintial scan delay: %u secs\n",
+ printf("\tinitial scan delay: %u secs\n",
nla_get_u32(nd[NL80211_ATTR_SCHED_SCAN_DELAY]));
if (nd[NL80211_ATTR_SCHED_SCAN_MATCH]) {
More information about the Pkg-wpa-devel
mailing list