Hello community,

here is the log from the commit of package iw for openSUSE:Factory checked in 
at 2015-09-11 09:01:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/iw (Old)
 and      /work/SRC/openSUSE:Factory/.iw.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "iw"

Changes:
--------
--- /work/SRC/openSUSE:Factory/iw/iw.changes    2015-04-06 00:25:44.000000000 
+0200
+++ /work/SRC/openSUSE:Factory/.iw.new/iw.changes       2015-09-11 
09:01:25.000000000 +0200
@@ -1,0 +2,6 @@
+Sat Sep  5 09:12:33 UTC 2015 - [email protected]
+
+- Update to 4.1
+  * Support all new kernel features upto 4.1
+
+-------------------------------------------------------------------

Old:
----
  iw-4.0.tar.xz

New:
----
  iw-4.1.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ iw.spec ++++++
--- /var/tmp/diff_new_pack.hnEC5z/_old  2015-09-11 09:01:26.000000000 +0200
+++ /var/tmp/diff_new_pack.hnEC5z/_new  2015-09-11 09:01:26.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           iw
-Version:        4.0
+Version:        4.1
 Release:        0
 Summary:        Configuration utility for nl80211 based wireless drivers
 License:        ISC

++++++ iw-4.0.tar.xz -> iw-4.1.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iw-4.0/event.c new/iw-4.1/event.c
--- old/iw-4.0/event.c  2015-03-17 14:18:24.000000000 +0100
+++ new/iw-4.1/event.c  2015-05-05 14:15:14.000000000 +0200
@@ -359,6 +359,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: ");
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iw-4.0/info.c new/iw-4.1/info.c
--- old/iw-4.0/info.c   2015-03-17 14:18:24.000000000 +0100
+++ new/iw-4.1/info.c   2015-05-05 14:15:14.000000000 +0200
@@ -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");
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iw-4.0/iw.h new/iw-4.1/iw.h
--- old/iw-4.0/iw.h     2015-03-17 14:18:24.000000000 +0100
+++ new/iw-4.1/iw.h     2015-05-05 14:15:14.000000000 +0200
@@ -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);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iw-4.0/nl80211.h new/iw-4.1/nl80211.h
--- old/iw-4.0/nl80211.h        2015-03-17 14:18:24.000000000 +0100
+++ new/iw-4.1/nl80211.h        2015-05-05 14:15:14.000000000 +0200
@@ -25,6 +25,19 @@
  *
  */
 
+/*
+ * 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>
 
 #define NL80211_GENL_NAME "nl80211"
@@ -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
@@ -2107,6 +2128,8 @@
 
        NL80211_ATTR_SCHED_SCAN_DELAY,
 
+       NL80211_ATTR_REG_INDOOR,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,
@@ -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,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iw-4.0/scan.c new/iw-4.1/scan.c
--- old/iw-4.0/scan.c   2015-03-17 14:18:24.000000000 +0100
+++ new/iw-4.1/scan.c   2015-05-05 14:15:14.000000000 +0200
@@ -99,6 +99,243 @@
        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,
                       struct nl_cb *cb,
                       struct nl_msg *msg,
@@ -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);
+       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;
+               data += 2;
+               len -= 2;
+       }
 
        if (len < 4) {
                tab_on_first(&first);
@@ -627,6 +880,19 @@
        }
 }
 
+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)
 {
        print_rsn_ie("CCMP", "IEEE 802.1X", len, 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.");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iw-4.0/version.sh new/iw-4.1/version.sh
--- old/iw-4.0/version.sh       2015-03-17 14:18:24.000000000 +0100
+++ new/iw-4.1/version.sh       2015-05-05 14:15:14.000000000 +0200
@@ -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
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/iw-4.0/wowlan.c new/iw-4.1/wowlan.c
--- old/iw-4.0/wowlan.c 2015-03-17 14:18:24.000000000 +0100
+++ new/iw-4.1/wowlan.c 2015-05-05 14:15:14.000000000 +0200
@@ -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;
-                               }
+       if (!nd)
+               return -ENOBUFS;
 
-                               parse_state = ND_TOPLEVEL;
-                       }
+       err = parse_sched_scan(msg, argc, argv);
 
-                       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);
        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]) {


Reply via email to