[pkg-wpa-devel] r1943 - in /iw/branches/upstream/current: Android.mk Makefile event.c info.c interface.c mpp.c nl80211.h ocb.c phy.c reg.c scan.c util.c vendor.c version.sh wowlan.c

slh-guest at users.alioth.debian.org slh-guest at users.alioth.debian.org
Tue Apr 28 01:51:52 UTC 2015


Author: slh-guest
Date: Tue Apr 28 01:51:52 2015
New Revision: 1943

URL: http://svn.debian.org/wsvn/?sc=1&rev=1943
Log:
[svn-upgrade] new version iw (4.0)

Added:
    iw/branches/upstream/current/mpp.c
    iw/branches/upstream/current/ocb.c
    iw/branches/upstream/current/vendor.c
Modified:
    iw/branches/upstream/current/Android.mk
    iw/branches/upstream/current/Makefile
    iw/branches/upstream/current/event.c
    iw/branches/upstream/current/info.c
    iw/branches/upstream/current/interface.c
    iw/branches/upstream/current/nl80211.h
    iw/branches/upstream/current/phy.c
    iw/branches/upstream/current/reg.c
    iw/branches/upstream/current/scan.c
    iw/branches/upstream/current/util.c
    iw/branches/upstream/current/version.sh
    iw/branches/upstream/current/wowlan.c

Modified: iw/branches/upstream/current/Android.mk
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/Android.mk?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/Android.mk	(original)
+++ iw/branches/upstream/current/Android.mk	Tue Apr 28 01:51:52 2015
@@ -3,6 +3,7 @@
 
 include $(CLEAR_VARS)
 
+IW_ANDROID_BUILD=y
 NO_PKG_CONFIG=y
 include $(LOCAL_PATH)/Makefile
 
@@ -16,7 +17,7 @@
 LOCAL_LDFLAGS := -Wl,--no-gc-sections
 #LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_TAGS := eng
-LOCAL_SHARED_LIBRARIES := libnl_2
+LOCAL_STATIC_LIBRARIES := libnl_2
 LOCAL_MODULE := iw
 
 $(IW_SOURCE_DIR)/version.c:

Modified: iw/branches/upstream/current/Makefile
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/Makefile?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/Makefile	(original)
+++ iw/branches/upstream/current/Makefile	Tue Apr 28 01:51:52 2015
@@ -13,10 +13,10 @@
 CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
 
 OBJS = iw.o genl.o event.o info.o phy.o \
-	interface.o ibss.o station.o survey.o util.o \
-	mesh.o mpath.o scan.o reg.o version.o \
+	interface.o ibss.o station.o survey.o util.o ocb.o \
+	mesh.o mpath.o mpp.o scan.o reg.o version.o \
 	reason.o status.o connect.o link.o offch.o ps.o cqm.o \
-	bitrate.o wowlan.o coalesce.o roc.o p2p.o
+	bitrate.o wowlan.o coalesce.o roc.o p2p.o vendor.o
 OBJS += sections.o
 
 OBJS-$(HWSIM) += hwsim.o
@@ -101,9 +101,11 @@
 	@$(NQ) ' CC  ' $@
 	$(Q)$(CC) $(CFLAGS) -c -o $@ $<
 
+ifeq ($(IW_ANDROID_BUILD),)
 iw:	$(OBJS)
 	@$(NQ) ' CC  ' iw
 	$(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o iw
+endif
 
 check:
 	$(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"

Modified: iw/branches/upstream/current/event.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/event.c?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/event.c	(original)
+++ iw/branches/upstream/current/event.c	Tue Apr 28 01:51:52 2015
@@ -200,7 +200,8 @@
 
 static void parse_wowlan_wake_event(struct nlattr **attrs)
 {
-	struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG];
+	struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG],
+		*tb_match[NUM_NL80211_ATTR];
 
 	printf("WoWLAN wakeup\n");
 	if (!attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) {
@@ -227,6 +228,31 @@
 		printf("\t* 4-way handshake\n");
 	if (tb[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
 		printf("\t* RF-kill released\n");
+	if (tb[NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS]) {
+		struct nlattr *match, *freq;
+		int rem_nst, rem_nst2;
+
+		printf("\t* network detected\n");
+		nla_for_each_nested(match,
+				    tb[NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS],
+				    rem_nst) {
+			nla_parse(tb_match, NUM_NL80211_ATTR, nla_data(match),
+				  nla_len(match),
+				  NULL);
+			printf("\t\tSSID: \"");
+			print_ssid_escaped(nla_len(tb_match[NL80211_ATTR_SSID]),
+					   nla_data(tb_match[NL80211_ATTR_SSID]));
+			printf("\"");
+			if (tb_match[NL80211_ATTR_SCAN_FREQUENCIES]) {
+				printf(" freq(s):");
+				nla_for_each_nested(freq,
+						    tb_match[NL80211_ATTR_SCAN_FREQUENCIES],
+						    rem_nst2)
+					printf(" %d", nla_get_u32(freq));
+			}
+			printf("\n");
+		}
+	}
 	if (tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]) {
 		uint8_t *d = nla_data(tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]);
 		int l = nla_len(tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]);
@@ -539,6 +565,31 @@
 				   nla_data(tb[NL80211_ATTR_VENDOR_DATA]),
 				   nla_len(tb[NL80211_ATTR_VENDOR_DATA]));
 		break;
+	case NL80211_CMD_RADAR_DETECT:
+		printf("radar event ");
+		if (tb[NL80211_ATTR_RADAR_EVENT]) {
+			switch (nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT])) {
+				case NL80211_RADAR_DETECTED:
+					printf("(radar detected)");
+					break;
+				case NL80211_RADAR_CAC_FINISHED:
+					printf("(cac finished)");
+					break;
+				case NL80211_RADAR_CAC_ABORTED:
+					printf("(cac aborted)");
+					break;
+				case NL80211_RADAR_NOP_FINISHED:
+					printf("(nop finished)");
+					break;
+				default:
+					printf("(unknown)");
+					break;
+			};
+		} else {
+			printf("(unknown)");
+		}
+		printf("\n");
+		break;
 	default:
 		printf("unknown event %d (%s)\n",
 		       gnlh->cmd, command_name(gnlh->cmd));

Modified: iw/branches/upstream/current/info.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/info.c?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/info.c	(original)
+++ iw/branches/upstream/current/info.c	Tue Apr 28 01:51:52 2015
@@ -455,6 +455,7 @@
 			[NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST] = { .type = NLA_FLAG },
 			[NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE] = { .type = NLA_FLAG },
 			[NL80211_WOWLAN_TRIG_RFKILL_RELEASE] = { .type = NLA_FLAG },
+			[NL80211_WOWLAN_TRIG_NET_DETECT] = { .type = NLA_U32 },
 			[NL80211_WOWLAN_TRIG_TCP_CONNECTION] = { .type = NLA_NESTED },
 		};
 		struct nl80211_pattern_support *pat;
@@ -492,6 +493,9 @@
 				printf("\t\t * wake up on 4-way handshake\n");
 			if (tb_wowlan[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
 				printf("\t\t * wake up on rfkill release\n");
+			if (tb_wowlan[NL80211_WOWLAN_TRIG_NET_DETECT])
+				printf("\t\t * wake up on network detection, up to %d match sets\n",
+				       nla_get_u32(tb_wowlan[NL80211_WOWLAN_TRIG_NET_DETECT]));
 			if (tb_wowlan[NL80211_WOWLAN_TRIG_TCP_CONNECTION])
 				printf("\t\t * wake up on TCP connection\n");
 		}
@@ -583,6 +587,12 @@
 			printf("\tDevice supports static SMPS\n");
 		if (features & NL80211_FEATURE_DYNAMIC_SMPS)
 			printf("\tDevice supports dynamic SMPS\n");
+		if (features & NL80211_FEATURE_SUPPORTS_WMM_ADMISSION)
+			printf("\tDevice supports WMM-AC admission (TSPECs)\n");
+		if (features & NL80211_FEATURE_MAC_ON_CREATE)
+			printf("\tDevice supports configuring vdev MAC-addr on create.\n");
+		if (features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH)
+			printf("\tDevice supports TDLS channel switching\n");
 	}
 
 	if (tb_msg[NL80211_ATTR_TDLS_SUPPORT])

Modified: iw/branches/upstream/current/interface.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/interface.c?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/interface.c	(original)
+++ iw/branches/upstream/current/interface.c	Tue Apr 28 01:51:52 2015
@@ -104,6 +104,9 @@
 	    strcmp(tpstr, "ibss") == 0) {
 		*type = NL80211_IFTYPE_ADHOC;
 		return 0;
+	} else if (strcmp(tpstr, "ocb") == 0) {
+		*type = NL80211_IFTYPE_OCB;
+		return 0;
 	} else if (strcmp(tpstr, "monitor") == 0) {
 		*type = NL80211_IFTYPE_MONITOR;
 		return 0;
@@ -171,6 +174,8 @@
 	char *mesh_id = NULL;
 	enum nl80211_iftype type;
 	int tpset;
+	unsigned char mac_addr[ETH_ALEN];
+	int found_mac = 0;
 
 	if (argc < 1)
 		return 1;
@@ -183,6 +188,7 @@
 	if (tpset)
 		return tpset;
 
+try_another:
 	if (argc) {
 		if (strcmp(argv[0], "mesh_id") == 0) {
 			argc--;
@@ -193,6 +199,17 @@
 			mesh_id = argv[0];
 			argc--;
 			argv++;
+		} else if (strcmp(argv[0], "addr") == 0) {
+			argc--;
+			argv++;
+			if (mac_addr_a2n(mac_addr, argv[0])) {
+				fprintf(stderr, "Invalid MAC address\n");
+				return 2;
+			}
+			argc--;
+			argv++;
+			found_mac = 1;
+			goto try_another;
 		} else if (strcmp(argv[0], "4addr") == 0) {
 			argc--;
 			argv++;
@@ -221,19 +238,21 @@
 	NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, type);
 	if (mesh_id)
 		NLA_PUT(msg, NL80211_ATTR_MESH_ID, strlen(mesh_id), mesh_id);
-
-	return 0;
- nla_put_failure:
-	return -ENOBUFS;
-}
-COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]",
+	if (found_mac)
+		NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+
+	return 0;
+ nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]",
 	NL80211_CMD_NEW_INTERFACE, 0, CIB_PHY, handle_interface_add,
 	"Add a new virtual interface with the given configuration.\n"
 	IFACE_TYPES "\n\n"
 	"The flags are only used for monitor interfaces, valid flags are:\n"
 	VALID_FLAGS "\n\n"
 	"The mesh_id is used only for mesh mode.");
-COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]",
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]",
 	NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL);
 
 static int handle_interface_del(struct nl80211_state *state,

Added: iw/branches/upstream/current/mpp.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/mpp.c?rev=1943&op=file
==============================================================================
--- iw/branches/upstream/current/mpp.c	(added)
+++ iw/branches/upstream/current/mpp.c	Tue Apr 28 01:51:52 2015
@@ -0,0 +1,84 @@
+#include <net/if.h>
+#include <errno.h>
+#include <string.h>
+
+#include <netlink/genl/genl.h>
+#include <netlink/genl/family.h>
+#include <netlink/genl/ctrl.h>
+#include <netlink/msg.h>
+#include <netlink/attr.h>
+
+#include "nl80211.h"
+#include "iw.h"
+
+SECTION(mpp);
+
+static int print_mpp_handler(struct nl_msg *msg, void *arg)
+{
+	struct nlattr *tb[NL80211_ATTR_MAX + 1];
+	struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+	char dst[20], next_hop[20], dev[20];
+
+	nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+		  genlmsg_attrlen(gnlh, 0), NULL);
+
+	/*
+	 * TODO: validate the interface and mac address!
+	 * Otherwise, there's a race condition as soon as
+	 * the kernel starts sending mpath notifications.
+	 */
+
+	mac_addr_n2a(dst, nla_data(tb[NL80211_ATTR_MAC]));
+	mac_addr_n2a(next_hop, nla_data(tb[NL80211_ATTR_MPATH_NEXT_HOP]));
+	if_indextoname(nla_get_u32(tb[NL80211_ATTR_IFINDEX]), dev);
+	printf("%s %s %s\n", dst, next_hop, dev);
+
+	return NL_SKIP;
+}
+
+static int handle_mpp_get(struct nl80211_state *state,
+			  struct nl_cb *cb,
+			  struct nl_msg *msg,
+			  int argc, char **argv,
+			  enum id_input id)
+{
+	unsigned char dst[ETH_ALEN];
+
+	if (argc < 1)
+		return 1;
+
+	if (mac_addr_a2n(dst, argv[0])) {
+		fprintf(stderr, "invalid mac address\n");
+		return 2;
+	}
+	argc--;
+	argv++;
+
+	if (argc)
+		return 1;
+
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, dst);
+
+	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_mpp_handler, NULL);
+
+	return 0;
+ nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(mpp, get, "<MAC address>",
+	NL80211_CMD_GET_MPP, 0, CIB_NETDEV, handle_mpp_get,
+	"Get information on mesh proxy path to the given node.");
+
+static int handle_mpp_dump(struct nl80211_state *state,
+			     struct nl_cb *cb,
+			     struct nl_msg *msg,
+			     int argc, char **argv,
+			     enum id_input id)
+{
+	printf("DEST ADDR         PROXY NODE        IFACE\n");
+	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_mpp_handler, NULL);
+	return 0;
+}
+COMMAND(mpp, dump, NULL,
+	NL80211_CMD_GET_MPP, NLM_F_DUMP, CIB_NETDEV, handle_mpp_dump,
+	"List known mesh proxy paths.");

Modified: iw/branches/upstream/current/nl80211.h
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/nl80211.h?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/nl80211.h	(original)
+++ iw/branches/upstream/current/nl80211.h	Tue Apr 28 01:51:52 2015
@@ -28,6 +28,13 @@
 #include <linux/types.h>
 
 #define NL80211_GENL_NAME "nl80211"
+
+#define NL80211_MULTICAST_GROUP_CONFIG		"config"
+#define NL80211_MULTICAST_GROUP_SCAN		"scan"
+#define NL80211_MULTICAST_GROUP_REG		"regulatory"
+#define NL80211_MULTICAST_GROUP_MLME		"mlme"
+#define NL80211_MULTICAST_GROUP_VENDOR		"vendor"
+#define NL80211_MULTICAST_GROUP_TESTMODE	"testmode"
 
 /**
  * DOC: Station handling
@@ -173,8 +180,8 @@
  *	%NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME.
  *
  * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration;
- *	either a dump request on a %NL80211_ATTR_WIPHY or a specific get
- *	on an %NL80211_ATTR_IFINDEX is supported.
+ *	either a dump request for all interfaces or a specific get with a
+ *	single %NL80211_ATTR_IFINDEX is supported.
  * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires
  *	%NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE.
  * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response
@@ -227,7 +234,11 @@
  *	the interface identified by %NL80211_ATTR_IFINDEX.
  * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
  *	or, if no MAC address given, all stations, on the interface identified
- *	by %NL80211_ATTR_IFINDEX.
+ *	by %NL80211_ATTR_IFINDEX. %NL80211_ATTR_MGMT_SUBTYPE and
+ *	%NL80211_ATTR_REASON_CODE can optionally be used to specify which type
+ *	of disconnection indication should be sent to the station
+ *	(Deauthentication or Disassociation frame and reason code for that
+ *	frame).
  *
  * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to
  * 	destination %NL80211_ATTR_MAC on the interface identified by
@@ -248,7 +259,18 @@
  *	%NL80211_ATTR_IFINDEX.
  *
  * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set
- * 	regulatory domain.
+ *	regulatory domain. If %NL80211_ATTR_WIPHY is specified and the device
+ *	has a private regulatory domain, it will be returned. Otherwise, the
+ *	global regdomain will be returned.
+ *	A device will have a private regulatory domain if it uses the
+ *	regulatory_hint() API. Even when a private regdomain is used the channel
+ *	information will still be mended according to further hints from
+ *	the regulatory core to help with compliance. A dump version of this API
+ *	is now available which will returns the global regdomain as well as
+ *	all private regdomains of present wiphys (for those that have it).
+ *	If a wiphy is self-managed (%NL80211_ATTR_WIPHY_SELF_MANAGED_REG), then
+ *	its private regdomain is the only valid one for it. The regulatory
+ *	core is not used to help with compliance in this case.
  * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
  *	after being queried by the kernel. CRDA replies by sending a regulatory
  *	domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
@@ -302,7 +324,9 @@
  *	if passed, define which channels should be scanned; if not
  *	passed, all channels allowed for the current regulatory domain
  *	are used.  Extra IEs can also be passed from the userspace by
- *	using the %NL80211_ATTR_IE attribute.
+ *	using the %NL80211_ATTR_IE attribute.  The first cycle of the
+ *	scheduled scan can be delayed by %NL80211_ATTR_SCHED_SCAN_DELAY
+ *	is supplied.
  * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if
  *	scheduled scan is not running. The caller may assume that as soon
  *	as the call returns, it is safe to start a new scheduled scan again.
@@ -639,7 +663,18 @@
  * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
  *	independently of the userspace SME, send this event indicating
  *	%NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
- *	attributes determining channel width.
+ *	attributes determining channel width.  This indication may also be
+ *	sent when a remotely-initiated switch (e.g., when a STA receives a CSA
+ *	from the remote AP) is completed;
+ *
+ * @NL80211_CMD_CH_SWITCH_STARTED_NOTIFY: Notify that a channel switch
+ *	has been started on an interface, regardless of the initiator
+ *	(ie. whether it was requested from a remote device or
+ *	initiated on our own).  It indicates that
+ *	%NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ
+ *	after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's.  The userspace may
+ *	decide to react to this indication by requesting other
+ *	interfaces to change channel as well.
  *
  * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by
  *	its %NL80211_ATTR_WDEV identifier. It must have been created with
@@ -738,6 +773,31 @@
  *	before removing a station entry entirely, or before disassociating
  *	or similar, cleanup will happen in the driver/device in this case.
  *
+ * @NL80211_CMD_GET_MPP: Get mesh path attributes for mesh proxy path to
+ *	destination %NL80211_ATTR_MAC on the interface identified by
+ *	%NL80211_ATTR_IFINDEX.
+ *
+ * @NL80211_CMD_JOIN_OCB: Join the OCB network. The center frequency and
+ *	bandwidth of a channel must be given.
+ * @NL80211_CMD_LEAVE_OCB: Leave the OCB network -- no special arguments, the
+ *	network is determined by the network interface.
+ *
+ * @NL80211_CMD_TDLS_CHANNEL_SWITCH: Start channel-switching with a TDLS peer,
+ *	identified by the %NL80211_ATTR_MAC parameter. A target channel is
+ *	provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining
+ *	channel width/type. The target operating class is given via
+ *	%NL80211_ATTR_OPER_CLASS.
+ *	The driver is responsible for continually initiating channel-switching
+ *	operations and returning to the base channel for communication with the
+ *	AP.
+ * @NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH: Stop channel-switching with a TDLS
+ *	peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel
+ *	when this command completes.
+ *
+ * @NL80211_CMD_WIPHY_REG_CHANGE: Similar to %NL80211_CMD_REG_CHANGE, but used
+ *	as an event to indicate changes for devices with wiphy-specific regdom
+ *	management.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -911,6 +971,18 @@
 
 	NL80211_CMD_ADD_TX_TS,
 	NL80211_CMD_DEL_TX_TS,
+
+	NL80211_CMD_GET_MPP,
+
+	NL80211_CMD_JOIN_OCB,
+	NL80211_CMD_LEAVE_OCB,
+
+	NL80211_CMD_CH_SWITCH_STARTED_NOTIFY,
+
+	NL80211_CMD_TDLS_CHANNEL_SWITCH,
+	NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH,
+
+	NL80211_CMD_WIPHY_REG_CHANGE,
 
 	/* add new commands above here */
 
@@ -1606,9 +1678,12 @@
  * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
  *	As specified in the &enum nl80211_tdls_peer_capability.
  *
- * @NL80211_ATTR_IFACE_SOCKET_OWNER: flag attribute, if set during interface
+ * @NL80211_ATTR_SOCKET_OWNER: Flag attribute, if set during interface
  *	creation then the new interface will be owned by the netlink socket
- *	that created it and will be destroyed when the socket is closed
+ *	that created it and will be destroyed when the socket is closed.
+ *	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.
  *
  * @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
  *	the TDLS link initiator.
@@ -1638,6 +1713,34 @@
  * @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see
  *	&enum nl80211_smps_mode.
  *
+ * @NL80211_ATTR_OPER_CLASS: operating class
+ *
+ * @NL80211_ATTR_MAC_MASK: MAC address mask
+ *
+ * @NL80211_ATTR_WIPHY_SELF_MANAGED_REG: flag attribute indicating this device
+ *	is self-managing its regulatory information and any regulatory domain
+ *	obtained from it is coming from the device's wiphy and not the global
+ *	cfg80211 regdomain.
+ *
+ * @NL80211_ATTR_EXT_FEATURES: extended feature flags contained in a byte
+ *	array. The feature flags are identified by their bit index (see &enum
+ *	nl80211_ext_feature_index). The bit index is ordered starting at the
+ *	least-significant bit of the first byte in the array, ie. bit index 0
+ *	is located at bit 0 of byte 0. bit index 25 would be located at bit 1
+ *	of byte 3 (u8 array).
+ *
+ * @NL80211_ATTR_SURVEY_RADIO_STATS: Request overall radio statistics to be
+ *	returned along with other survey data. If set, @NL80211_CMD_GET_SURVEY
+ *	may return a survey entry without a channel indicating global radio
+ *	statistics (only some values are valid and make sense.)
+ *	For devices that don't return such an entry even then, the information
+ *	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.
+ *
+ * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1973,7 +2076,7 @@
 
 	NL80211_ATTR_TDLS_PEER_CAPABILITY,
 
-	NL80211_ATTR_IFACE_SOCKET_OWNER,
+	NL80211_ATTR_SOCKET_OWNER,
 
 	NL80211_ATTR_CSA_C_OFFSETS_TX,
 	NL80211_ATTR_MAX_CSA_COUNTERS,
@@ -1990,15 +2093,31 @@
 
 	NL80211_ATTR_SMPS_MODE,
 
+	NL80211_ATTR_OPER_CLASS,
+
+	NL80211_ATTR_MAC_MASK,
+
+	NL80211_ATTR_WIPHY_SELF_MANAGED_REG,
+
+	NL80211_ATTR_EXT_FEATURES,
+
+	NL80211_ATTR_SURVEY_RADIO_STATS,
+
+	NL80211_ATTR_NETNS_FD,
+
+	NL80211_ATTR_SCHED_SCAN_DELAY,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
+	NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
 	NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
 };
 
 /* source-level API compatibility */
 #define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
 #define	NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
+#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
 
 /*
  * Allow user space programs to use #ifdef on new attributes by defining them
@@ -2028,7 +2147,7 @@
 
 #define NL80211_MAX_SUPP_RATES			32
 #define NL80211_MAX_SUPP_HT_RATES		77
-#define NL80211_MAX_SUPP_REG_RULES		32
+#define NL80211_MAX_SUPP_REG_RULES		64
 #define NL80211_TKIP_DATA_OFFSET_ENCR_KEY	0
 #define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY	16
 #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY	24
@@ -2064,6 +2183,8 @@
  *	and therefore can't be created in the normal ways, use the
  *	%NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE
  *	commands to create and destroy one
+ * @NL80211_IF_TYPE_OCB: Outside Context of a BSS
+ *	This mode corresponds to the MIB variable dot11OCBActivated=true
  * @NL80211_IFTYPE_MAX: highest interface type number currently defined
  * @NUM_NL80211_IFTYPES: number of defined interface types
  *
@@ -2083,6 +2204,7 @@
 	NL80211_IFTYPE_P2P_CLIENT,
 	NL80211_IFTYPE_P2P_GO,
 	NL80211_IFTYPE_P2P_DEVICE,
+	NL80211_IFTYPE_OCB,
 
 	/* keep last */
 	NUM_NL80211_IFTYPES,
@@ -2165,8 +2287,15 @@
  * @NL80211_RATE_INFO_VHT_MCS: MCS index for VHT (u8)
  * @NL80211_RATE_INFO_VHT_NSS: number of streams in VHT (u8)
  * @NL80211_RATE_INFO_80_MHZ_WIDTH: 80 MHz VHT rate
- * @NL80211_RATE_INFO_80P80_MHZ_WIDTH: 80+80 MHz VHT rate
+ * @NL80211_RATE_INFO_80P80_MHZ_WIDTH: unused - 80+80 is treated the
+ *	same as 160 for purposes of the bitrates
  * @NL80211_RATE_INFO_160_MHZ_WIDTH: 160 MHz VHT rate
+ * @NL80211_RATE_INFO_10_MHZ_WIDTH: 10 MHz width - note that this is
+ *	a legacy rate and will be reported as the actual bitrate, i.e.
+ *	half the base (20 MHz) rate
+ * @NL80211_RATE_INFO_5_MHZ_WIDTH: 5 MHz width - note that this is
+ *	a legacy rate and will be reported as the actual bitrate, i.e.
+ *	a quarter of the base (20 MHz) rate
  * @__NL80211_RATE_INFO_AFTER_LAST: internal use
  */
 enum nl80211_rate_info {
@@ -2181,6 +2310,8 @@
 	NL80211_RATE_INFO_80_MHZ_WIDTH,
 	NL80211_RATE_INFO_80P80_MHZ_WIDTH,
 	NL80211_RATE_INFO_160_MHZ_WIDTH,
+	NL80211_RATE_INFO_10_MHZ_WIDTH,
+	NL80211_RATE_INFO_5_MHZ_WIDTH,
 
 	/* keep last */
 	__NL80211_RATE_INFO_AFTER_LAST,
@@ -2225,18 +2356,24 @@
  *
  * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved
  * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs)
- * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station)
- * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
- * @NL80211_STA_INFO_RX_BYTES64: total received bytes (u64, from this station)
- * @NL80211_STA_INFO_TX_BYTES64: total transmitted bytes (u64, to this station)
+ * @NL80211_STA_INFO_RX_BYTES: total received bytes (MPDU length)
+ *	(u32, from this station)
+ * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (MPDU length)
+ *	(u32, to this station)
+ * @NL80211_STA_INFO_RX_BYTES64: total received bytes (MPDU length)
+ *	(u64, from this station)
+ * @NL80211_STA_INFO_TX_BYTES64: total transmitted bytes (MPDU length)
+ *	(u64, to this station)
  * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
  * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
  * 	containing info as possible, see &enum nl80211_rate_info
- * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station)
- * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this
- *	station)
- * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station)
- * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station)
+ * @NL80211_STA_INFO_RX_PACKETS: total received packet (MSDUs and MMPDUs)
+ *	(u32, from this station)
+ * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (MSDUs and MMPDUs)
+ *	(u32, to this station)
+ * @NL80211_STA_INFO_TX_RETRIES: total retries (MPDUs) (u32, to this station)
+ * @NL80211_STA_INFO_TX_FAILED: total failed packets (MPDUs)
+ *	(u32, to this station)
  * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm)
  * @NL80211_STA_INFO_LLID: the station's mesh LLID
  * @NL80211_STA_INFO_PLID: the station's mesh PLID
@@ -2260,6 +2397,16 @@
  *	Same format as NL80211_STA_INFO_CHAIN_SIGNAL.
  * @NL80211_STA_EXPECTED_THROUGHPUT: expected throughput considering also the
  *	802.11 header (u32, kbps)
+ * @NL80211_STA_INFO_RX_DROP_MISC: RX packets dropped for unspecified reasons
+ *	(u64)
+ * @NL80211_STA_INFO_BEACON_RX: number of beacons received from this peer (u64)
+ * @NL80211_STA_INFO_BEACON_SIGNAL_AVG: signal strength average
+ *	for beacons only (u8, dBm)
+ * @NL80211_STA_INFO_TID_STATS: per-TID statistics (see &enum nl80211_tid_stats)
+ *	This is a nested attribute where each the inner attribute number is the
+ *	TID+1 and the special TID 16 (i.e. value 17) is used for non-QoS frames;
+ *	each one of those is again nested with &enum nl80211_tid_stats
+ *	attributes carrying the actual values.
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
@@ -2292,10 +2439,39 @@
 	NL80211_STA_INFO_CHAIN_SIGNAL,
 	NL80211_STA_INFO_CHAIN_SIGNAL_AVG,
 	NL80211_STA_INFO_EXPECTED_THROUGHPUT,
+	NL80211_STA_INFO_RX_DROP_MISC,
+	NL80211_STA_INFO_BEACON_RX,
+	NL80211_STA_INFO_BEACON_SIGNAL_AVG,
+	NL80211_STA_INFO_TID_STATS,
 
 	/* keep last */
 	__NL80211_STA_INFO_AFTER_LAST,
 	NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_tid_stats - per TID statistics attributes
+ * @__NL80211_TID_STATS_INVALID: attribute number 0 is reserved
+ * @NL80211_TID_STATS_RX_MSDU: number of MSDUs received (u64)
+ * @NL80211_TID_STATS_TX_MSDU: number of MSDUs transmitted (or
+ *	attempted to transmit; u64)
+ * @NL80211_TID_STATS_TX_MSDU_RETRIES: number of retries for
+ *	transmitted MSDUs (not counting the first attempt; u64)
+ * @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
+ *	MSDUs (u64)
+ * @NUM_NL80211_TID_STATS: number of attributes here
+ * @NL80211_TID_STATS_MAX: highest numbered attribute here
+ */
+enum nl80211_tid_stats {
+	__NL80211_TID_STATS_INVALID,
+	NL80211_TID_STATS_RX_MSDU,
+	NL80211_TID_STATS_TX_MSDU,
+	NL80211_TID_STATS_TX_MSDU_RETRIES,
+	NL80211_TID_STATS_TX_MSDU_FAILED,
+
+	/* keep last */
+	NUM_NL80211_TID_STATS,
+	NL80211_TID_STATS_MAX = NUM_NL80211_TID_STATS - 1
 };
 
 /**
@@ -2631,6 +2807,11 @@
  * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated
  *	base on contiguous rules and wider channels will be allowed to cross
  *	multiple contiguous/overlapping frequency ranges.
+ * @NL80211_RRF_GO_CONCURRENT: See &NL80211_FREQUENCY_ATTR_GO_CONCURRENT
+ * @NL80211_RRF_NO_HT40MINUS: channels can't be used in HT40- operation
+ * @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation
+ * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed
+ * @NL80211_RRF_NO_160MHZ: 160MHz operation not allowed
  */
 enum nl80211_reg_rule_flags {
 	NL80211_RRF_NO_OFDM		= 1<<0,
@@ -2643,11 +2824,18 @@
 	NL80211_RRF_NO_IR		= 1<<7,
 	__NL80211_RRF_NO_IBSS		= 1<<8,
 	NL80211_RRF_AUTO_BW		= 1<<11,
+	NL80211_RRF_GO_CONCURRENT	= 1<<12,
+	NL80211_RRF_NO_HT40MINUS	= 1<<13,
+	NL80211_RRF_NO_HT40PLUS		= 1<<14,
+	NL80211_RRF_NO_80MHZ		= 1<<15,
+	NL80211_RRF_NO_160MHZ		= 1<<16,
 };
 
 #define NL80211_RRF_PASSIVE_SCAN	NL80211_RRF_NO_IR
 #define NL80211_RRF_NO_IBSS		NL80211_RRF_NO_IR
 #define NL80211_RRF_NO_IR		NL80211_RRF_NO_IR
+#define NL80211_RRF_NO_HT40		(NL80211_RRF_NO_HT40MINUS |\
+					 NL80211_RRF_NO_HT40PLUS)
 
 /* For backport compatibility with older userspace */
 #define NL80211_RRF_NO_IR_ALL		(NL80211_RRF_NO_IR | __NL80211_RRF_NO_IBSS)
@@ -2700,16 +2888,18 @@
  * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel
  * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm)
  * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used
- * @NL80211_SURVEY_INFO_CHANNEL_TIME: amount of time (in ms) that the radio
- *	spent on this channel
- * @NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY: amount of the time the primary
+ * @NL80211_SURVEY_INFO_TIME: amount of time (in ms) that the radio
+ *	was turned on (on channel or globally)
+ * @NL80211_SURVEY_INFO_TIME_BUSY: amount of the time the primary
  *	channel was sensed busy (either due to activity or energy detect)
- * @NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: amount of time the extension
+ * @NL80211_SURVEY_INFO_TIME_EXT_BUSY: amount of time the extension
  *	channel was sensed busy
- * @NL80211_SURVEY_INFO_CHANNEL_TIME_RX: amount of time the radio spent
- *	receiving data
- * @NL80211_SURVEY_INFO_CHANNEL_TIME_TX: amount of time the radio spent
- *	transmitting data
+ * @NL80211_SURVEY_INFO_TIME_RX: amount of time the radio spent
+ *	receiving data (on channel or globally)
+ * @NL80211_SURVEY_INFO_TIME_TX: amount of time the radio spent
+ *	transmitting data (on channel or globally)
+ * @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
+ *	(on this channel or globally)
  * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  *	currently defined
  * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
@@ -2719,16 +2909,24 @@
 	NL80211_SURVEY_INFO_FREQUENCY,
 	NL80211_SURVEY_INFO_NOISE,
 	NL80211_SURVEY_INFO_IN_USE,
-	NL80211_SURVEY_INFO_CHANNEL_TIME,
-	NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY,
-	NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY,
-	NL80211_SURVEY_INFO_CHANNEL_TIME_RX,
-	NL80211_SURVEY_INFO_CHANNEL_TIME_TX,
+	NL80211_SURVEY_INFO_TIME,
+	NL80211_SURVEY_INFO_TIME_BUSY,
+	NL80211_SURVEY_INFO_TIME_EXT_BUSY,
+	NL80211_SURVEY_INFO_TIME_RX,
+	NL80211_SURVEY_INFO_TIME_TX,
+	NL80211_SURVEY_INFO_TIME_SCAN,
 
 	/* keep last */
 	__NL80211_SURVEY_INFO_AFTER_LAST,
 	NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1
 };
+
+/* keep old names for compatibility */
+#define NL80211_SURVEY_INFO_CHANNEL_TIME		NL80211_SURVEY_INFO_TIME
+#define NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY		NL80211_SURVEY_INFO_TIME_BUSY
+#define NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY	NL80211_SURVEY_INFO_TIME_EXT_BUSY
+#define NL80211_SURVEY_INFO_CHANNEL_TIME_RX		NL80211_SURVEY_INFO_TIME_RX
+#define NL80211_SURVEY_INFO_CHANNEL_TIME_TX		NL80211_SURVEY_INFO_TIME_TX
 
 /**
  * enum nl80211_mntr_flags - monitor configuration flags
@@ -3166,6 +3364,9 @@
 /**
  * enum nl80211_bss_status - BSS "status"
  * @NL80211_BSS_STATUS_AUTHENTICATED: Authenticated with this BSS.
+ *	Note that this is no longer used since cfg80211 no longer
+ *	keeps track of whether or not authentication was done with
+ *	a given BSS.
  * @NL80211_BSS_STATUS_ASSOCIATED: Associated with this BSS.
  * @NL80211_BSS_STATUS_IBSS_JOINED: Joined to this IBSS.
  *
@@ -3379,6 +3580,8 @@
  *	interval in which %NL80211_ATTR_CQM_TXE_PKTS and
  *	%NL80211_ATTR_CQM_TXE_RATE must be satisfied before generating an
  *	%NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting.
+ * @NL80211_ATTR_CQM_BEACON_LOSS_EVENT: flag attribute that's set in a beacon
+ *	loss event
  * @__NL80211_ATTR_CQM_AFTER_LAST: internal
  * @NL80211_ATTR_CQM_MAX: highest key attribute
  */
@@ -3391,6 +3594,7 @@
 	NL80211_ATTR_CQM_TXE_RATE,
 	NL80211_ATTR_CQM_TXE_PKTS,
 	NL80211_ATTR_CQM_TXE_INTVL,
+	NL80211_ATTR_CQM_BEACON_LOSS_EVENT,
 
 	/* keep last */
 	__NL80211_ATTR_CQM_AFTER_LAST,
@@ -3403,9 +3607,7 @@
  *      configured threshold
  * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the
  *      configured threshold
- * @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: The device experienced beacon loss.
- *	(Note that deauth/disassoc will still follow if the AP is not
- *	available. This event might get used as roaming event, etc.)
+ * @NL80211_CQM_RSSI_BEACON_LOSS_EVENT: (reserved, never sent)
  */
 enum nl80211_cqm_rssi_threshold_event {
 	NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
@@ -3545,6 +3747,28 @@
  * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS: For wakeup reporting only,
  *	the TCP connection ran out of tokens to use for data to send to the
  *	service
+ * @NL80211_WOWLAN_TRIG_NET_DETECT: wake up when a configured network
+ *	is detected.  This is a nested attribute that contains the
+ *	same attributes used with @NL80211_CMD_START_SCHED_SCAN.  It
+ *	specifies how the scan is performed (e.g. the interval, the
+ *	channels to scan and the initial delay) as well as the scan
+ *	results that will trigger a wake (i.e. the matchsets).  This
+ *	attribute is also sent in a response to
+ *	@NL80211_CMD_GET_WIPHY, indicating the number of match sets
+ *	supported by the driver (u32).
+ * @NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS: nested attribute
+ *	containing an array with information about what triggered the
+ *	wake up.  If no elements are present in the array, it means
+ *	that the information is not available.  If more than one
+ *	element is present, it means that more than one match
+ *	occurred.
+ *	Each element in the array is a nested attribute that contains
+ *	one optional %NL80211_ATTR_SSID attribute and one optional
+ *	%NL80211_ATTR_SCAN_FREQUENCIES attribute.  At least one of
+ *	these attributes must be present.  If
+ *	%NL80211_ATTR_SCAN_FREQUENCIES contains more than one
+ *	frequency, it means that the match occurred in more than one
+ *	channel.
  * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
  * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
  *
@@ -3570,6 +3794,8 @@
 	NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH,
 	NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST,
 	NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS,
+	NL80211_WOWLAN_TRIG_NET_DETECT,
+	NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS,
 
 	/* keep last */
 	NUM_NL80211_WOWLAN_TRIG,
@@ -4042,6 +4268,27 @@
  *	multiplexing powersave, ie. can turn off all but one chain
  *	and then wake the rest up as required after, for example,
  *	rts/cts handshake.
+ * @NL80211_FEATURE_SUPPORTS_WMM_ADMISSION: the device supports setting up WMM
+ *	TSPEC sessions (TID aka TSID 0-7) with the %NL80211_CMD_ADD_TX_TS
+ *	command. Standard IEEE 802.11 TSPEC setup is not yet supported, it
+ *	needs to be able to handle Block-Ack agreements and other things.
+ * @NL80211_FEATURE_MAC_ON_CREATE: Device supports configuring
+ *	the vif's MAC address upon creation.
+ *	See 'macaddr' field in the vif_params (cfg80211.h).
+ * @NL80211_FEATURE_TDLS_CHANNEL_SWITCH: Driver supports channel switching when
+ *	operating as a TDLS peer.
+ * @NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR: This device/driver supports using a
+ *	random MAC address during scan (if the device is unassociated); the
+ *	%NL80211_SCAN_FLAG_RANDOM_ADDR flag may be set for scans and the MAC
+ *	address mask/value will be used.
+ * @NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR: This device/driver supports
+ *	using a random MAC address for every scan iteration during scheduled
+ *	scan (while not associated), the %NL80211_SCAN_FLAG_RANDOM_ADDR may
+ *	be set for scheduled scan and the MAC address mask/value will be used.
+ * @NL80211_FEATURE_ND_RANDOM_MAC_ADDR: This device/driver supports using a
+ *	random MAC address for every scan iteration during "net detect", i.e.
+ *	scan in unassociated WoWLAN, the %NL80211_SCAN_FLAG_RANDOM_ADDR may
+ *	be set for scheduled scan and the MAC address mask/value will be used.
  */
 enum nl80211_feature_flags {
 	NL80211_FEATURE_SK_TX_STATUS			= 1 << 0,
@@ -4070,6 +4317,25 @@
 	NL80211_FEATURE_ACKTO_ESTIMATION		= 1 << 23,
 	NL80211_FEATURE_STATIC_SMPS			= 1 << 24,
 	NL80211_FEATURE_DYNAMIC_SMPS			= 1 << 25,
+	NL80211_FEATURE_SUPPORTS_WMM_ADMISSION		= 1 << 26,
+	NL80211_FEATURE_MAC_ON_CREATE			= 1 << 27,
+	NL80211_FEATURE_TDLS_CHANNEL_SWITCH		= 1 << 28,
+	NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR		= 1 << 29,
+	NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR	= 1 << 30,
+	NL80211_FEATURE_ND_RANDOM_MAC_ADDR		= 1 << 31,
+};
+
+/**
+ * enum nl80211_ext_feature_index - bit index of extended features.
+ *
+ * @NUM_NL80211_EXT_FEATURES: number of extended features.
+ * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
+ */
+enum nl80211_ext_feature_index {
+
+	/* add new features before the definition below */
+	NUM_NL80211_EXT_FEATURES,
+	MAX_NL80211_EXT_FEATURES = NUM_NL80211_EXT_FEATURES - 1
 };
 
 /**
@@ -4118,11 +4384,21 @@
  *	dangerous because will destroy stations performance as a lot of frames
  *	will be lost while scanning off-channel, therefore it must be used only
  *	when really needed
+ * @NL80211_SCAN_FLAG_RANDOM_ADDR: use a random MAC address for this scan (or
+ *	for scheduled scan: a different one for every scan iteration). When the
+ *	flag is set, depending on device capabilities the @NL80211_ATTR_MAC and
+ *	@NL80211_ATTR_MAC_MASK attributes may also be given in which case only
+ *	the masked bits will be preserved from the MAC address and the remainder
+ *	randomised. If the attributes are not given full randomisation (46 bits,
+ *	locally administered 1, multicast 0) is assumed.
+ *	This flag must not be requested when the feature isn't supported, check
+ *	the nl80211 feature flags for the device.
  */
 enum nl80211_scan_flags {
 	NL80211_SCAN_FLAG_LOW_PRIORITY			= 1<<0,
 	NL80211_SCAN_FLAG_FLUSH				= 1<<1,
 	NL80211_SCAN_FLAG_AP				= 1<<2,
+	NL80211_SCAN_FLAG_RANDOM_ADDR			= 1<<3,
 };
 
 /**

Added: iw/branches/upstream/current/ocb.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/ocb.c?rev=1943&op=file
==============================================================================
--- iw/branches/upstream/current/ocb.c	(added)
+++ iw/branches/upstream/current/ocb.c	Tue Apr 28 01:51:52 2015
@@ -0,0 +1,76 @@
+#include <net/if.h>
+#include <errno.h>
+#include <string.h>
+
+#include "nl80211.h"
+#include "iw.h"
+
+SECTION(ocb);
+
+static int join_ocb(struct nl80211_state *state, struct nl_cb *cb,
+		    struct nl_msg *msg, int argc, char **argv,
+		    enum id_input id)
+{
+	unsigned long freq;
+	char *end;
+	int i;
+	static const struct {
+		const char *name;
+		unsigned int width;
+	} *chanmode_selected, chanmode[] = {
+		{ .name = "5MHZ",
+		  .width = NL80211_CHAN_WIDTH_5	},
+		{ .name = "10MHZ",
+		  .width = NL80211_CHAN_WIDTH_10 },
+	};
+
+	if (argc < 2)
+		return 1;
+
+	/* freq */
+	freq = strtoul(argv[0], &end, 10);
+	if (*end != '\0')
+		return 1;
+
+	NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
+	argv++;
+	argc--;
+
+	/* channel width */
+	for (i = 0; i < ARRAY_SIZE(chanmode); i++) {
+		if (strcasecmp(chanmode[i].name, argv[0]) == 0) {
+			chanmode_selected = &chanmode[i];
+			break;
+		}
+	}
+	if (chanmode_selected) {
+		NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
+			    chanmode_selected->width);
+		NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1, freq);
+
+		argv++;
+		argc--;
+	} else {
+		return 1;
+	}
+
+	return 0;
+
+nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(ocb, join, "<freq in MHz> <5MHZ|10MHZ>",
+	NL80211_CMD_JOIN_OCB, 0, CIB_NETDEV, join_ocb,
+	"Join the OCB mode network.");
+
+static int leave_ocb(struct nl80211_state *state, struct nl_cb *cb,
+		     struct nl_msg *msg, int argc, char **argv,
+		     enum id_input id)
+{
+	if (argc)
+		return 1;
+
+	return 0;
+}
+COMMAND(ocb, leave, NULL, NL80211_CMD_LEAVE_OCB, 0, CIB_NETDEV, leave_ocb,
+	"Leave the OCB mode network.");

Modified: iw/branches/upstream/current/phy.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/phy.c?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/phy.c	(original)
+++ iw/branches/upstream/current/phy.c	Tue Apr 28 01:51:52 2015
@@ -2,6 +2,9 @@
 #include <errno.h>
 #include <net/if.h>
 #include <strings.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 
 #include <netlink/genl/genl.h>
 #include <netlink/genl/family.h>
@@ -296,6 +299,24 @@
 	NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_retry,
 	"Set retry limit.");
 
+#ifndef NETNS_RUN_DIR
+#define NETNS_RUN_DIR "/var/run/netns"
+#endif
+int netns_get_fd(const char *name)
+{
+	char pathbuf[MAXPATHLEN];
+	const char *path, *ptr;
+
+	path = name;
+	ptr = strchr(name, '/');
+	if (!ptr) {
+		snprintf(pathbuf, sizeof(pathbuf), "%s/%s",
+			NETNS_RUN_DIR, name );
+		path = pathbuf;
+	}
+	return open(path, O_RDONLY);
+}
+
 static int handle_netns(struct nl80211_state *state,
 			struct nl_cb *cb,
 			struct nl_msg *msg,
@@ -303,26 +324,42 @@
 			enum id_input id)
 {
 	char *end;
-
-	if (argc != 1)
-		return 1;
-
-	if (!*argv[0])
-		return 1;
-
-	NLA_PUT_U32(msg, NL80211_ATTR_PID,
-		    strtoul(argv[0], &end, 10));
-
-	if (*end != '\0')
-		return 1;
-
-	return 0;
- nla_put_failure:
-	return -ENOBUFS;
-}
-COMMAND(set, netns, "<pid>",
+	int fd;
+
+	if (argc < 1 || !*argv[0])
+		return 1;
+
+	if (argc == 1) {
+		NLA_PUT_U32(msg, NL80211_ATTR_PID,
+				strtoul(argv[0], &end, 10));
+		if (*end != '\0') {
+			printf("Invalid parameter: pid(%s)\n", argv[0]);
+			return 1;
+		}
+		return 0;
+	}
+
+	if (argc != 2 || strcmp(argv[0], "name"))
+		return 1;
+
+	if ((fd = netns_get_fd(argv[1])) >= 0) {
+		NLA_PUT_U32(msg, NL80211_ATTR_NETNS_FD, fd);
+		return 0;
+	} else {
+		printf("Invalid parameter: nsname(%s)\n", argv[0]);
+	}
+
+	return 1;
+
+ nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(set, netns, "{ <pid> | name <nsname> }",
 	NL80211_CMD_SET_WIPHY_NETNS, 0, CIB_PHY, handle_netns,
-	"Put this wireless device into a different network namespace");
+	"Put this wireless device into a different network namespace:\n"
+	"    <pid>    - change network namespace by process id\n"
+	"    <nsname> - change network namespace by name from "NETNS_RUN_DIR"\n"
+	"               or by absolute path (man ip-netns)\n");
 
 static int handle_coverage(struct nl80211_state *state,
 			struct nl_cb *cb,

Modified: iw/branches/upstream/current/reg.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/reg.c?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/reg.c	(original)
+++ iw/branches/upstream/current/reg.c	Tue Apr 28 01:51:52 2015
@@ -114,7 +114,6 @@
 	"Notify the kernel about the current regulatory domain.");
 
 static int print_reg_handler(struct nl_msg *msg, void *arg)
-
 {
 #define PARSE_FLAG(nl_flag, string_value)  do { \
 		if ((flags & nl_flag)) { \
@@ -127,7 +126,7 @@
 	struct nlattr *nl_rule;
 	int rem_rule;
 	enum nl80211_dfs_regions dfs_domain;
-	static struct nla_policy reg_rule_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
+	static struct nla_policy reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = {
 		[NL80211_ATTR_REG_RULE_FLAGS]		= { .type = NLA_U32 },
 		[NL80211_ATTR_FREQ_RANGE_START]		= { .type = NLA_U32 },
 		[NL80211_ATTR_FREQ_RANGE_END]		= { .type = NLA_U32 },
@@ -150,6 +149,13 @@
 		return NL_SKIP;
 	}
 
+	if (tb_msg[NL80211_ATTR_WIPHY])
+		printf("phy#%d%s\n", nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]),
+		       tb_msg[NL80211_ATTR_WIPHY_SELF_MANAGED_REG] ?
+		       " (self-managed)" : "");
+	else
+		printf("global\n");
+
 	if (tb_msg[NL80211_ATTR_DFS_REGION])
 		dfs_domain = nla_get_u8(tb_msg[NL80211_ATTR_DFS_REGION]);
 	else
@@ -159,10 +165,10 @@
 	printf("country %c%c: %s\n", alpha2[0], alpha2[1], dfs_domain_name(dfs_domain));
 
 	nla_for_each_nested(nl_rule, tb_msg[NL80211_ATTR_REG_RULES], rem_rule) {
-		struct nlattr *tb_rule[NL80211_FREQUENCY_ATTR_MAX + 1];
+		struct nlattr *tb_rule[NL80211_REG_RULE_ATTR_MAX + 1];
 		__u32 flags, start_freq_khz, end_freq_khz, max_bw_khz, max_ant_gain_mbi, max_eirp_mbm;
 
-		nla_parse(tb_rule, NL80211_FREQUENCY_ATTR_MAX, nla_data(nl_rule), nla_len(nl_rule), reg_rule_policy);
+		nla_parse(tb_rule, NL80211_REG_RULE_ATTR_MAX, nla_data(nl_rule), nla_len(nl_rule), reg_rule_policy);
 
 		flags = nla_get_u32(tb_rule[NL80211_ATTR_REG_RULE_FLAGS]);
 		start_freq_khz = nla_get_u32(tb_rule[NL80211_ATTR_FREQ_RANGE_START]);
@@ -199,6 +205,12 @@
 		PARSE_FLAG(NL80211_RRF_NO_OUTDOOR, "NO-OUTDOOR");
 		PARSE_FLAG(NL80211_RRF_DFS, "DFS");
 		PARSE_FLAG(NL80211_RRF_PTP_ONLY, "PTP-ONLY");
+		PARSE_FLAG(NL80211_RRF_AUTO_BW, "AUTO-BW");
+		PARSE_FLAG(NL80211_RRF_GO_CONCURRENT, "GO-CONCURRENT");
+		PARSE_FLAG(NL80211_RRF_NO_HT40MINUS, "NO-HT40MINUS");
+		PARSE_FLAG(NL80211_RRF_NO_HT40PLUS, "NO-HT40PLUS");
+		PARSE_FLAG(NL80211_RRF_NO_80MHZ, "NO-80MHZ");
+		PARSE_FLAG(NL80211_RRF_NO_160MHZ, "NO-160MHZ");
 
 		/* Kernels that support NO_IR always turn on both flags */
 		if ((flags & NL80211_RRF_NO_IR) && (flags & __NL80211_RRF_NO_IBSS)) {
@@ -210,8 +222,20 @@
 
 		printf("\n");
 	}
-	return NL_OK;
+
+	printf("\n");
+	return NL_SKIP;
 #undef PARSE_FLAG
+}
+
+static int handle_reg_dump(struct nl80211_state *state,
+			   struct nl_cb *cb,
+			   struct nl_msg *msg,
+			   int argc, char **argv,
+			   enum id_input id)
+{
+	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_reg_handler, NULL);
+	return 0;
 }
 
 static int handle_reg_get(struct nl80211_state *state,
@@ -220,8 +244,22 @@
 			  int argc, char **argv,
 			  enum id_input id)
 {
-	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_reg_handler, NULL);
-	return 0;
+	char *dump_args[] = { "reg", "dump" };
+	int err;
+
+	err = handle_cmd(state, CIB_NONE, 2, dump_args);
+	/* dump might fail since it's not supported on older kernels */
+	if (err == -EOPNOTSUPP) {
+		nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_reg_handler,
+			  NULL);
+		return 0;
+	}
+
+	return err;
 }
 COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_NONE, handle_reg_get,
 	"Print out the kernel's current regulatory domain information.");
+COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_PHY, handle_reg_get,
+	"Print out the devices' current regulatory domain information.");
+HIDDEN(reg, dump, NULL, NL80211_CMD_GET_REG, NLM_F_DUMP, CIB_NONE,
+       handle_reg_dump);

Modified: iw/branches/upstream/current/scan.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/scan.c?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/scan.c	(original)
+++ iw/branches/upstream/current/scan.c	Tue Apr 28 01:51:52 2015
@@ -70,6 +70,35 @@
 	} __attribute__ ((packed)) ext;
 } __attribute__ ((packed));
 
+static int parse_random_mac_addr(struct nl_msg *msg, char *arg)
+{
+	char *a_addr, *a_mask, *sep;
+	unsigned char addr[ETH_ALEN], mask[ETH_ALEN];
+	char *addrs = arg + 9;
+
+	if (*addrs != '=')
+		return 0;
+
+	addrs++;
+	sep = strchr(addrs, '/');
+	a_addr = addrs;
+
+	if (!sep)
+		return 1;
+
+	*sep = 0;
+	a_mask = sep + 1;
+	if (mac_addr_a2n(addr, a_addr) || mac_addr_a2n(mask, a_mask))
+		return 1;
+
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
+	NLA_PUT(msg, NL80211_ATTR_MAC_MASK, ETH_ALEN, mask);
+
+	return 0;
+ nla_put_failure:
+	return -ENOBUFS;
+}
+
 static int handle_scan(struct nl80211_state *state,
 		       struct nl_cb *cb,
 		       struct nl_msg *msg,
@@ -92,7 +121,7 @@
 	bool passive = false, have_ssids = false, have_freqs = false;
 	size_t ies_len = 0, meshid_len = 0;
 	unsigned char *ies = NULL, *meshid = NULL, *tmpies;
-	int flags = 0;
+	unsigned int flags = 0;
 
 	ssids = nlmsg_alloc();
 	if (!ssids)
@@ -115,16 +144,20 @@
 				parse = IES;
 				break;
 			} else if (strcmp(argv[i], "lowpri") == 0) {
-				parse = NONE;
 				flags |= NL80211_SCAN_FLAG_LOW_PRIORITY;
 				break;
 			} else if (strcmp(argv[i], "flush") == 0) {
-				parse = NONE;
 				flags |= NL80211_SCAN_FLAG_FLUSH;
 				break;
 			} else if (strcmp(argv[i], "ap-force") == 0) {
-				parse = NONE;
 				flags |= NL80211_SCAN_FLAG_AP;
+				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], "ssid") == 0) {
 				parse = SSID;
@@ -1763,7 +1796,7 @@
 	dump_argv[0] = argv[0];
 	return handle_cmd(state, id, dump_argc, dump_argv);
 }
-TOPLEVEL(scan, "[-u] [freq <freq>*] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force] [ssid <ssid>*|passive]", 0, 0,
+TOPLEVEL(scan, "[-u] [freq <freq>*] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force] [randomise[=<addr>/<mask>]] [ssid <ssid>*|passive]", 0, 0,
 	 CIB_NETDEV, handle_scan_combined,
 	 "Scan on the given frequencies and probe for the given SSIDs\n"
 	 "(or wildcard if not given) unless passive scanning is requested.\n"
@@ -1773,7 +1806,7 @@
 	NL80211_CMD_GET_SCAN, NLM_F_DUMP, CIB_NETDEV, handle_scan_dump,
 	"Dump the current scan results. If -u is specified, print unknown\n"
 	"data in scan results.");
-COMMAND(scan, trigger, "[freq <freq>*] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force] [ssid <ssid>*|passive]",
+COMMAND(scan, trigger, "[freq <freq>*] [ies <hex as 00:11:..>] [meshid <meshid>] [lowpri,flush,ap-force] [randomise[=<addr>/<mask>]] [ssid <ssid>*|passive]",
 	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.");

Modified: iw/branches/upstream/current/util.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/util.c?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/util.c	(original)
+++ iw/branches/upstream/current/util.c	Tue Apr 28 01:51:52 2015
@@ -133,6 +133,7 @@
 	"P2P-client",
 	"P2P-GO",
 	"P2P-device",
+	"outside context of a BSS",
 };
 
 static char modebuf[100];
@@ -252,6 +253,13 @@
 	[NL80211_CMD_SET_COALESCE] = "set_coalesce",
 	[NL80211_CMD_CHANNEL_SWITCH] = "channel_switch",
 	[NL80211_CMD_VENDOR] = "vendor",
+	[NL80211_CMD_SET_QOS_MAP] = "set_qos_map",
+	[NL80211_CMD_ADD_TX_TS] = "add_tx_ts",
+	[NL80211_CMD_DEL_TX_TS] = "del_tx_ts",
+	[NL80211_CMD_GET_MPP] = "get_mpp",
+	[NL80211_CMD_JOIN_OCB] = "join_ocb",
+	[NL80211_CMD_LEAVE_OCB] = "leave_ocb",
+	[NL80211_CMD_CH_SWITCH_STARTED_NOTIFY] = "ch_switch_started_notify",
 };
 
 static char cmdbuf[100];
@@ -594,7 +602,7 @@
 	unsigned int tx_max_num_spatial_streams, max_rx_supp_data_rate;
 	bool tx_mcs_set_defined, tx_mcs_set_equal, tx_unequal_modulation;
 
-	max_rx_supp_data_rate = (mcs[10] & ((mcs[11] & 0x3) << 8));
+	max_rx_supp_data_rate = (mcs[10] | ((mcs[11] & 0x3) << 8));
 	tx_mcs_set_defined = !!(mcs[12] & (1 << 0));
 	tx_mcs_set_equal = !(mcs[12] & (1 << 1));
 	tx_max_num_spatial_streams = ((mcs[12] >> 2) & 3) + 1;

Added: iw/branches/upstream/current/vendor.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/vendor.c?rev=1943&op=file
==============================================================================
--- iw/branches/upstream/current/vendor.c	(added)
+++ iw/branches/upstream/current/vendor.c	Tue Apr 28 01:51:52 2015
@@ -0,0 +1,95 @@
+#include <net/if.h>
+#include <errno.h>
+#include <string.h>
+
+#include <netlink/genl/genl.h>
+#include <netlink/genl/family.h>
+#include <netlink/genl/ctrl.h>
+#include <netlink/msg.h>
+#include <netlink/attr.h>
+
+#include "nl80211.h"
+#include "iw.h"
+
+SECTION(vendor);
+
+static int read_file(FILE *file, char *buf, size_t size)
+{
+	int data, count = 0;
+
+	while ((data = fgetc(file)) != EOF) {
+		if (count >= size)
+			return -EINVAL;
+		buf[count] = data;
+		count++;
+	}
+
+	return count;
+}
+
+static int read_hex(int argc, char **argv, char *buf, size_t size)
+{
+	int i, res;
+	unsigned int data;
+
+	if (argc > size)
+		return -EINVAL;
+
+	for (i = 0; i < argc; i++) {
+		res = sscanf(argv[i], "0x%x", &data);
+		if (res != 1 || data > 0xff)
+			return -EINVAL;
+		buf[i] = data;
+	}
+
+	return argc;
+}
+
+static int handle_vendor(struct nl80211_state *state, struct nl_cb *cb,
+			 struct nl_msg *msg, int argc, char **argv,
+			 enum id_input id)
+{
+	unsigned int oui;
+	unsigned int subcmd;
+	char buf[2048] = {};
+	int res, count = 0;
+	FILE *file = NULL;
+
+	if (argc < 3)
+		return -EINVAL;
+
+	res = sscanf(argv[0], "0x%x", &oui);
+	if (res != 1)
+		return -EINVAL;
+
+	res = sscanf(argv[1], "0x%x", &subcmd);
+	if (res != 1)
+		return -EINVAL;
+
+	if (!strcmp(argv[2], "-"))
+		file = stdin;
+	else
+		file = fopen(argv[2], "r");
+
+	NLA_PUT_U32(msg, NL80211_ATTR_VENDOR_ID, oui);
+	NLA_PUT_U32(msg, NL80211_ATTR_VENDOR_SUBCMD, subcmd);
+
+	if (file) {
+		count = read_file(file, buf, sizeof(buf));
+		fclose(file);
+	} else
+		count = read_hex(argc - 2, &argv[2], buf, sizeof(buf));
+
+	if (count < 0)
+		return -EINVAL;
+
+	if (count > 0)
+		NLA_PUT(msg, NL80211_ATTR_VENDOR_DATA, count, buf);
+
+	return 0;
+
+nla_put_failure:
+	return -ENOBUFS;
+}
+
+COMMAND(vendor, send, "<oui> <subcmd> <filename|-|hex data>", NL80211_CMD_VENDOR, 0, CIB_NETDEV, handle_vendor, "");

Modified: iw/branches/upstream/current/version.sh
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/version.sh?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/version.sh	(original)
+++ iw/branches/upstream/current/version.sh	Tue Apr 28 01:51:52 2015
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-VERSION="3.17"
+VERSION="4.0"
 OUT="$1"
 
 if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then

Modified: iw/branches/upstream/current/wowlan.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/wowlan.c?rev=1943&op=diff
==============================================================================
--- iw/branches/upstream/current/wowlan.c	(original)
+++ iw/branches/upstream/current/wowlan.c	Tue Apr 28 01:51:52 2015
@@ -178,6 +178,182 @@
  close:
 	fclose(f);
 	nla_nest_end(msg, tcp);
+	return err;
+}
+
+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;
+
+	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);
+	nla_nest_end(msg, nd);
+out:
+	*argc = c;
+	*argv = v;
 	return err;
 }
 
@@ -235,6 +411,17 @@
 					err = -ENOMEM;
 					goto nla_put_failure;
 				}
+			} else if (strcmp(argv[0], "net-detect") == 0) {
+				argv++;
+				argc--;
+				if (!argc) {
+					err = 1;
+					goto nla_put_failure;
+				}
+				err = wowlan_parse_net_detect(msg, &argc, &argv);
+				if (err)
+					goto nla_put_failure;
+				continue;
 			} else {
 				err = 1;
 				goto nla_put_failure;
@@ -286,7 +473,8 @@
 	return err;
 }
 COMMAND(wowlan, enable, "[any] [disconnect] [magic-packet] [gtk-rekey-failure] [eap-identity-request]"
-	" [4way-handshake] [rfkill-release] [tcp <config-file>] [patterns [offset1+]<pattern1> ...]",
+	" [4way-handshake] [rfkill-release] [net-detect interval <in_msecs> [delay <in_secs>] [freqs <freq>+] [matches [ssid <ssid>]+]]"
+	" [tcp <config-file>] [patterns [offset1+]<pattern1> ...]",
 	NL80211_CMD_SET_WOWLAN, 0, CIB_PHY, handle_wowlan_enable,
 	"Enable WoWLAN with the given triggers.\n"
 	"Each pattern is given as a bytestring with '-' in places where any byte\n"
@@ -301,7 +489,9 @@
 	"  data.interval=seconds\n"
 	"  [wake=<hex packet with masked out bytes indicated by '-'>]\n"
 	"  [data.seq=len,offset[,start]]\n"
-	"  [data.tok=len,offset,<token stream>]");
+	"  [data.tok=len,offset,<token stream>]\n\n"
+	"Net-detect configuration example:\n"
+	" iw phy0 wowlan enable net-detect interval 5000 delay 30 freqs 2412 2422 matches ssid foo ssid bar");
 
 
 static int handle_wowlan_disable(struct nl80211_state *state, struct nl_cb *cb,
@@ -352,6 +542,49 @@
 		printf(" * wake up on 4-way handshake\n");
 	if (trig[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
 		printf(" * wake up on RF-kill release\n");
+	if (trig[NL80211_WOWLAN_TRIG_NET_DETECT]) {
+		struct nlattr *match, *freq,
+			*nd[NUM_NL80211_ATTR], *tb[NUM_NL80211_ATTR];
+		int rem_match;
+
+		printf(" * wake up on network detection\n");
+		nla_parse(nd, NUM_NL80211_ATTR,
+			  nla_data(trig[NL80211_WOWLAN_TRIG_NET_DETECT]),
+			  nla_len(trig[NL80211_WOWLAN_TRIG_NET_DETECT]), NULL);
+
+		if (nd[NL80211_ATTR_SCHED_SCAN_INTERVAL])
+			printf("\tscan interval: %u msecs\n",
+			       nla_get_u32(nd[NL80211_ATTR_SCHED_SCAN_INTERVAL]));
+
+		if (nd[NL80211_ATTR_SCHED_SCAN_DELAY])
+			printf("\tintial scan delay: %u secs\n",
+			       nla_get_u32(nd[NL80211_ATTR_SCHED_SCAN_DELAY]));
+
+		if (nd[NL80211_ATTR_SCHED_SCAN_MATCH]) {
+			printf("\tmatches:\n");
+			nla_for_each_nested(match,
+					    nd[NL80211_ATTR_SCHED_SCAN_MATCH],
+					    rem_match) {
+				nla_parse(tb, NUM_NL80211_ATTR, nla_data(match),
+					  nla_len(match),
+					  NULL);
+				printf("\t\tSSID: ");
+				print_ssid_escaped(
+					nla_len(tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID]),
+					nla_data(tb[NL80211_SCHED_SCAN_MATCH_ATTR_SSID]));
+				printf("\n");
+			}
+		}
+		if (nd[NL80211_ATTR_SCAN_FREQUENCIES]) {
+			printf("\tfrequencies:");
+			nla_for_each_nested(freq,
+					    nd[NL80211_ATTR_SCAN_FREQUENCIES],
+					    rem_match) {
+				printf(" %d", nla_get_u32(freq));
+			}
+			printf("\n");
+		}
+	}
 	if (trig[NL80211_WOWLAN_TRIG_PKT_PATTERN]) {
 		nla_for_each_nested(pattern,
 				    trig[NL80211_WOWLAN_TRIG_PKT_PATTERN],




More information about the Pkg-wpa-devel mailing list