[pkg-wpa-devel] r1820 - in /iw/branches/upstream/current: event.c ibss.c info.c iw.h nl80211.h phy.c reg.c scan.c util.c version.sh

slh-guest at users.alioth.debian.org slh-guest at users.alioth.debian.org
Wed Dec 25 03:37:03 UTC 2013


Author: slh-guest
Date: Wed Dec 25 03:37:02 2013
New Revision: 1820

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

Modified:
    iw/branches/upstream/current/event.c
    iw/branches/upstream/current/ibss.c
    iw/branches/upstream/current/info.c
    iw/branches/upstream/current/iw.h
    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

Modified: iw/branches/upstream/current/event.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/event.c?rev=1820&op=diff
==============================================================================
--- iw/branches/upstream/current/event.c	(original)
+++ iw/branches/upstream/current/event.c	Wed Dec 25 03:37:02 2013
@@ -11,7 +11,7 @@
 
 struct ieee80211_beacon_channel {
 	__u16 center_freq;
-	bool passive_scan;
+	bool no_ir;
 	bool no_ibss;
 };
 
@@ -21,8 +21,8 @@
 	struct nlattr *tb_freq[NL80211_FREQUENCY_ATTR_MAX + 1];
 	static struct nla_policy beacon_freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
 		[NL80211_FREQUENCY_ATTR_FREQ] = { .type = NLA_U32 },
-		[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] = { .type = NLA_FLAG },
-		[NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
+		[NL80211_FREQUENCY_ATTR_NO_IR] = { .type = NLA_FLAG },
+		[__NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
 	};
 
 	if (nla_parse_nested(tb_freq,
@@ -33,9 +33,9 @@
 
 	chan->center_freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]);
 
-	if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN])
-		chan->passive_scan = true;
-	if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IBSS])
+	if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IR])
+		chan->no_ir = true;
+	if (tb_freq[__NL80211_FREQUENCY_ATTR_NO_IBSS])
 		chan->no_ibss = true;
 
 	return 0;
@@ -394,10 +394,14 @@
 		       chan_before_beacon.center_freq,
 		       ieee80211_frequency_to_channel(chan_before_beacon.center_freq));
 
-		if (chan_before_beacon.passive_scan && !chan_after_beacon.passive_scan)
-			printf("\to active scanning enabled\n");
-		if (chan_before_beacon.no_ibss && !chan_after_beacon.no_ibss)
-			printf("\to beaconing enabled\n");
+		if (chan_before_beacon.no_ir && !chan_after_beacon.no_ir) {
+			if (chan_before_beacon.no_ibss && !chan_after_beacon.no_ibss)
+				printf("\to Initiating radiation enabled\n");
+			else
+				printf("\to active scan enabled\n");
+		} else if (chan_before_beacon.no_ibss && !chan_after_beacon.no_ibss) {
+			printf("\to ibss enabled\n");
+		}
 
 		break;
 	case NL80211_CMD_NEW_STATION:

Modified: iw/branches/upstream/current/ibss.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/ibss.c?rev=1820&op=diff
==============================================================================
--- iw/branches/upstream/current/ibss.c	(original)
+++ iw/branches/upstream/current/ibss.c	Wed Dec 25 03:37:02 2013
@@ -30,16 +30,38 @@
 	float rate;
 	int bintval;
 	int i;
+	unsigned long freq;
 	static const struct {
 		const char *name;
-		unsigned int val;
-	} htmap[] = {
-		{ .name = "HT20", .val = NL80211_CHAN_HT20, },
-		{ .name = "HT40+", .val = NL80211_CHAN_HT40PLUS, },
-		{ .name = "HT40-", .val = NL80211_CHAN_HT40MINUS, },
-		{ .name = "NOHT", .val = NL80211_CHAN_NO_HT, },
+		unsigned int width;
+		int freq1_diff;
+		int chantype; /* for older kernel */
+	} *chanmode_selected = NULL, chanmode[] = {
+		{ .name = "HT20",
+		  .width = NL80211_CHAN_WIDTH_20,
+		  .freq1_diff = 0,
+		  .chantype = NL80211_CHAN_HT20 },
+		{ .name = "HT40+",
+		  .width = NL80211_CHAN_WIDTH_40,
+		  .freq1_diff = 10,
+		  .chantype = NL80211_CHAN_HT40PLUS },
+		{ .name = "HT40-",
+		  .width = NL80211_CHAN_WIDTH_40,
+		  .freq1_diff = -10,
+		  .chantype = NL80211_CHAN_HT40MINUS },
+		{ .name = "NOHT",
+		  .width = NL80211_CHAN_WIDTH_20_NOHT,
+		  .freq1_diff = 0,
+		  .chantype = NL80211_CHAN_NO_HT },
+		{ .name = "5MHZ",
+		  .width = NL80211_CHAN_WIDTH_5,
+		  .freq1_diff = 0,
+		  .chantype = -1 },
+		{ .name = "10MHZ",
+		  .width = NL80211_CHAN_WIDTH_10,
+		  .freq1_diff = 0,
+		  .chantype = -1 },
 	};
-	unsigned int htval;
 
 	if (argc < 2)
 		return 1;
@@ -50,23 +72,31 @@
 	argc--;
 
 	/* freq */
-	NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ,
-		    strtoul(argv[0], &end, 10));
+	freq = strtoul(argv[0], &end, 10);
 	if (*end != '\0')
 		return 1;
+
+	NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
 	argv++;
 	argc--;
 
 	if (argc) {
-		for (i = 0; i < ARRAY_SIZE(htmap); i++) {
-			if (strcasecmp(htmap[i].name, argv[0]) == 0) {
-				htval = htmap[i].val;
+		for (i = 0; i < ARRAY_SIZE(chanmode); i++) {
+			if (strcasecmp(chanmode[i].name, argv[0]) == 0) {
+				chanmode_selected = &chanmode[i];
 				break;
 			}
 		}
-		if (i != ARRAY_SIZE(htmap)) {
-			NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
-				    htval);
+		if (chanmode_selected) {
+			NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
+				    chanmode_selected->width);
+			NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
+				    freq + chanmode_selected->freq1_diff);
+			if (chanmode_selected->chantype != -1)
+				NLA_PUT_U32(msg,
+					    NL80211_ATTR_WIPHY_CHANNEL_TYPE,
+					    chanmode_selected->chantype);
+
 			argv++;
 			argc--;
 		}
@@ -164,7 +194,7 @@
 	NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss,
 	"Leave the current IBSS cell.");
 COMMAND(ibss, join,
-	"<SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
+	"<SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT|5MHZ|10MHZ] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
 	" [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] "
 	"[key d:0:abcde]",
 	NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss,

Modified: iw/branches/upstream/current/info.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/info.c?rev=1820&op=diff
==============================================================================
--- iw/branches/upstream/current/info.c	(original)
+++ iw/branches/upstream/current/info.c	Wed Dec 25 03:37:02 2013
@@ -74,8 +74,8 @@
 	static struct nla_policy freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
 		[NL80211_FREQUENCY_ATTR_FREQ] = { .type = NLA_U32 },
 		[NL80211_FREQUENCY_ATTR_DISABLED] = { .type = NLA_FLAG },
-		[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] = { .type = NLA_FLAG },
-		[NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
+		[NL80211_FREQUENCY_ATTR_NO_IR] = { .type = NLA_FLAG },
+		[__NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
 		[NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG },
 		[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
 	};
@@ -172,10 +172,16 @@
 						print_flag("disabled", &open);
 						goto next;
 					}
-					if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN])
-						print_flag("passive scanning", &open);
-					if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IBSS])
-						print_flag("no IBSS", &open);
+
+					/* If both flags are set assume an new kernel */
+					if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IR] && tb_freq[__NL80211_FREQUENCY_ATTR_NO_IBSS]) {
+						print_flag("no IR", &open);
+					} else if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN]) {
+						print_flag("passive scan", &open);
+					} else if (tb_freq[__NL80211_FREQUENCY_ATTR_NO_IBSS]){
+						print_flag("no ibss", &open);
+					}
+
 					if (tb_freq[NL80211_FREQUENCY_ATTR_RADAR])
 						print_flag("radar detection", &open);
 next:

Modified: iw/branches/upstream/current/iw.h
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/iw.h?rev=1820&op=diff
==============================================================================
--- iw/branches/upstream/current/iw.h	(original)
+++ iw/branches/upstream/current/iw.h	Wed Dec 25 03:37:02 2013
@@ -148,7 +148,7 @@
 char *channel_width_name(enum nl80211_chan_width width);
 const char *iftype_name(enum nl80211_iftype iftype);
 const char *command_name(enum nl80211_commands cmd);
-int ieee80211_channel_to_frequency(int chan);
+int ieee80211_channel_to_frequency(int chan, enum nl80211_band band);
 int ieee80211_frequency_to_channel(int freq);
 
 void print_ssid_escaped(const uint8_t len, const uint8_t *data);

Modified: iw/branches/upstream/current/nl80211.h
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/nl80211.h?rev=1820&op=diff
==============================================================================
--- iw/branches/upstream/current/nl80211.h	(original)
+++ iw/branches/upstream/current/nl80211.h	Wed Dec 25 03:37:02 2013
@@ -581,7 +581,14 @@
  *	operation, %NL80211_ATTR_MAC contains the peer MAC address, and
  *	%NL80211_ATTR_REASON_CODE the reason code to be used (only with
  *	%NL80211_TDLS_TEARDOWN).
- * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
+ * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. The
+ *	%NL80211_ATTR_TDLS_ACTION attribute determines the type of frame to be
+ *	sent. Public Action codes (802.11-2012 8.1.5.1) will be sent as
+ *	802.11 management frames, while TDLS action codes (802.11-2012
+ *	8.5.13.1) will be encapsulated and sent as data frames. The currently
+ *	supported Public Action code is %WLAN_PUB_ACTION_TDLS_DISCOVER_RES
+ *	and the currently supported TDLS actions codes are given in
+ *	&enum ieee80211_tdls_actioncode.
  *
  * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
  *	(or GO) interface (i.e. hostapd) to ask for unexpected frames to
@@ -676,6 +683,16 @@
  * @NL80211_CMD_GET_COALESCE: Get currently supported coalesce rules.
  * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules.
  *
+ * @NL80211_CMD_CHANNEL_SWITCH: Perform a channel switch by announcing the
+ *	the new channel information (Channel Switch Announcement - CSA)
+ *	in the beacon for some time (as defined in the
+ *	%NL80211_ATTR_CH_SWITCH_COUNT parameter) and then change to the
+ *	new channel. Userspace provides the new channel information (using
+ *	%NL80211_ATTR_WIPHY_FREQ and the attributes determining channel
+ *	width). %NL80211_ATTR_CH_SWITCH_BLOCK_TX may be supplied to inform
+ *	other station that transmission must be blocked until the channel
+ *	switch is complete.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -840,6 +857,8 @@
 
 	NL80211_CMD_GET_COALESCE,
 	NL80211_CMD_SET_COALESCE,
+
+	NL80211_CMD_CHANNEL_SWITCH,
 
 	/* add new commands above here */
 
@@ -976,7 +995,7 @@
  * 	to query the CRDA to retrieve one regulatory domain. This attribute can
  * 	also be used by userspace to query the kernel for the currently set
  * 	regulatory domain. We chose an alpha2 as that is also used by the
- * 	IEEE-802.11d country information element to identify a country.
+ * 	IEEE-802.11 country information element to identify a country.
  * 	Users can also simply ask the wireless core to set regulatory domain
  * 	to a specific alpha2.
  * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory
@@ -1469,6 +1488,36 @@
  *
  * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information.
  *
+ * @NL80211_ATTR_CH_SWITCH_COUNT: u32 attribute specifying the number of TBTT's
+ *	until the channel switch event.
+ * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: flag attribute specifying that transmission
+ *	must be blocked on the current channel (before the channel switch
+ *	operation).
+ * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information
+ *	for the time while performing a channel switch.
+ * @NL80211_ATTR_CSA_C_OFF_BEACON: Offset of the channel switch counter
+ *	field in the beacons tail (%NL80211_ATTR_BEACON_TAIL).
+ * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter
+ *	field in the probe response (%NL80211_ATTR_PROBE_RESP).
+ *
+ * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32.
+ *	As specified in the &enum nl80211_rxmgmt_flags.
+ *
+ * @NL80211_ATTR_STA_SUPPORTED_CHANNELS: array of supported channels.
+ *
+ * @NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES: array of supported
+ *      supported operating classes.
+ *
+ * @NL80211_ATTR_HANDLE_DFS: A flag indicating whether user space
+ *	controls DFS operation in IBSS mode. If the flag is included in
+ *	%NL80211_CMD_JOIN_IBSS request, the driver will allow use of DFS
+ *	channels and reports radar events to userspace. Userspace is required
+ *	to react to radar events, e.g. initiate a channel switch or leave the
+ *	IBSS network.
+ *
+ * @NL80211_ATTR_SUPPORT_5_10_MHZ: A flag indicating that the device supports
+ *	5 MHz and 10 MHz channel bandwidth.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -1770,6 +1819,22 @@
 	NL80211_ATTR_PEER_AID,
 
 	NL80211_ATTR_COALESCE_RULE,
+
+	NL80211_ATTR_CH_SWITCH_COUNT,
+	NL80211_ATTR_CH_SWITCH_BLOCK_TX,
+	NL80211_ATTR_CSA_IES,
+	NL80211_ATTR_CSA_C_OFF_BEACON,
+	NL80211_ATTR_CSA_C_OFF_PRESP,
+
+	NL80211_ATTR_RXMGMT_FLAGS,
+
+	NL80211_ATTR_STA_SUPPORTED_CHANNELS,
+
+	NL80211_ATTR_STA_SUPPORTED_OPER_CLASSES,
+
+	NL80211_ATTR_HANDLE_DFS,
+
+	NL80211_ATTR_SUPPORT_5_10_MHZ,
 
 	/* add attributes here, update the policy in nl80211.c */
 
@@ -2171,10 +2236,9 @@
  * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
  * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current
  *	regulatory domain.
- * @NL80211_FREQUENCY_ATTR_PASSIVE_SCAN: Only passive scanning is
- *	permitted on this channel in current regulatory domain.
- * @NL80211_FREQUENCY_ATTR_NO_IBSS: IBSS networks are not permitted
- *	on this channel in current regulatory domain.
+ * @NL80211_FREQUENCY_ATTR_NO_IR: no mechanisms that initiate radiation
+ * 	are permitted on this channel, this includes sending probe
+ * 	requests, or modes of operation that require beaconing.
  * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory
  *	on this channel in current regulatory domain.
  * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
@@ -2201,8 +2265,8 @@
 	__NL80211_FREQUENCY_ATTR_INVALID,
 	NL80211_FREQUENCY_ATTR_FREQ,
 	NL80211_FREQUENCY_ATTR_DISABLED,
-	NL80211_FREQUENCY_ATTR_PASSIVE_SCAN,
-	NL80211_FREQUENCY_ATTR_NO_IBSS,
+	NL80211_FREQUENCY_ATTR_NO_IR,
+	__NL80211_FREQUENCY_ATTR_NO_IBSS,
 	NL80211_FREQUENCY_ATTR_RADAR,
 	NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
 	NL80211_FREQUENCY_ATTR_DFS_STATE,
@@ -2218,6 +2282,9 @@
 };
 
 #define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER
+#define NL80211_FREQUENCY_ATTR_PASSIVE_SCAN	NL80211_FREQUENCY_ATTR_NO_IR
+#define NL80211_FREQUENCY_ATTR_NO_IBSS		NL80211_FREQUENCY_ATTR_NO_IR
+#define NL80211_FREQUENCY_ATTR_NO_IR		NL80211_FREQUENCY_ATTR_NO_IR
 
 /**
  * enum nl80211_bitrate_attr - bitrate attributes
@@ -2360,8 +2427,9 @@
  * @NL80211_RRF_DFS: DFS support is required to be used
  * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links
  * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links
- * @NL80211_RRF_PASSIVE_SCAN: passive scan is required
- * @NL80211_RRF_NO_IBSS: no IBSS is allowed
+ * @NL80211_RRF_NO_IR: no mechanisms that initiate radiation are allowed,
+ * 	this includes probe requests or modes of operation that require
+ * 	beaconing.
  */
 enum nl80211_reg_rule_flags {
 	NL80211_RRF_NO_OFDM		= 1<<0,
@@ -2371,9 +2439,16 @@
 	NL80211_RRF_DFS			= 1<<4,
 	NL80211_RRF_PTP_ONLY		= 1<<5,
 	NL80211_RRF_PTMP_ONLY		= 1<<6,
-	NL80211_RRF_PASSIVE_SCAN	= 1<<7,
-	NL80211_RRF_NO_IBSS		= 1<<8,
-};
+	NL80211_RRF_NO_IR		= 1<<7,
+	__NL80211_RRF_NO_IBSS		= 1<<8,
+};
+
+#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
+
+/* For backport compatibility with older userspace */
+#define NL80211_RRF_NO_IR_ALL		(NL80211_RRF_NO_IR | __NL80211_RRF_NO_IBSS)
 
 /**
  * enum nl80211_dfs_regions - regulatory DFS regions
@@ -2808,6 +2883,21 @@
 };
 
 /**
+ * enum nl80211_bss_scan_width - control channel width for a BSS
+ *
+ * These values are used with the %NL80211_BSS_CHAN_WIDTH attribute.
+ *
+ * @NL80211_BSS_CHAN_WIDTH_20: control channel is 20 MHz wide or compatible
+ * @NL80211_BSS_CHAN_WIDTH_10: control channel is 10 MHz wide
+ * @NL80211_BSS_CHAN_WIDTH_5: control channel is 5 MHz wide
+ */
+enum nl80211_bss_scan_width {
+	NL80211_BSS_CHAN_WIDTH_20,
+	NL80211_BSS_CHAN_WIDTH_10,
+	NL80211_BSS_CHAN_WIDTH_5,
+};
+
+/**
  * enum nl80211_bss - netlink attributes for a BSS
  *
  * @__NL80211_BSS_INVALID: invalid
@@ -2831,6 +2921,8 @@
  * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information
  *	elements from a Beacon frame (bin); not present if no Beacon frame has
  *	yet been received
+ * @NL80211_BSS_CHAN_WIDTH: channel width of the control channel
+ *	(u32, enum nl80211_bss_scan_width)
  * @__NL80211_BSS_AFTER_LAST: internal
  * @NL80211_BSS_MAX: highest BSS attribute
  */
@@ -2847,6 +2939,7 @@
 	NL80211_BSS_STATUS,
 	NL80211_BSS_SEEN_MS_AGO,
 	NL80211_BSS_BEACON_IES,
+	NL80211_BSS_CHAN_WIDTH,
 
 	/* keep last */
 	__NL80211_BSS_AFTER_LAST,
@@ -3807,13 +3900,12 @@
  *
  * Channel states used by the DFS code.
  *
- * @IEEE80211_DFS_USABLE: The channel can be used, but channel availability
+ * @NL80211_DFS_USABLE: The channel can be used, but channel availability
  *	check (CAC) must be performed before using it for AP or IBSS.
- * @IEEE80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it
+ * @NL80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it
  *	is therefore marked as not available.
- * @IEEE80211_DFS_AVAILABLE: The channel has been CAC checked and is available.
- */
-
+ * @NL80211_DFS_AVAILABLE: The channel has been CAC checked and is available.
+ */
 enum nl80211_dfs_state {
 	NL80211_DFS_USABLE,
 	NL80211_DFS_UNAVAILABLE,
@@ -3853,4 +3945,15 @@
 /* maximum duration for critical protocol measures */
 #define NL80211_CRIT_PROTO_MAX_DURATION		5000 /* msec */
 
+/**
+ * enum nl80211_rxmgmt_flags - flags for received management frame.
+ *
+ * Used by cfg80211_rx_mgmt()
+ *
+ * @NL80211_RXMGMT_FLAG_ANSWERED: frame was answered by device/driver.
+ */
+enum nl80211_rxmgmt_flags {
+	NL80211_RXMGMT_FLAG_ANSWERED = 1 << 0,
+};
+
 #endif /* __LINUX_NL80211_H */

Modified: iw/branches/upstream/current/phy.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/phy.c?rev=1820&op=diff
==============================================================================
--- iw/branches/upstream/current/phy.c	(original)
+++ iw/branches/upstream/current/phy.c	Wed Dec 25 03:37:02 2013
@@ -113,8 +113,11 @@
 	if (*end)
 		return 1;
 
-	if (chan)
-		freq = ieee80211_channel_to_frequency(freq);
+	if (chan) {
+		enum nl80211_band band;
+		band = freq <= 14 ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
+		freq = ieee80211_channel_to_frequency(freq, band);
+	}
 
 	NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
 

Modified: iw/branches/upstream/current/reg.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/reg.c?rev=1820&op=diff
==============================================================================
--- iw/branches/upstream/current/reg.c	(original)
+++ iw/branches/upstream/current/reg.c	Wed Dec 25 03:37:02 2013
@@ -193,8 +193,14 @@
 		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_PASSIVE_SCAN, "PASSIVE-SCAN");
-		PARSE_FLAG(NL80211_RRF_NO_IBSS, "NO-IBSS");
+
+		/* Kernels that support NO_IR always turn on both flags */
+		if ((flags & NL80211_RRF_NO_IR) && (flags & __NL80211_RRF_NO_IBSS)) {
+			printf(", NO-IR");
+		} else {
+			PARSE_FLAG(NL80211_RRF_PASSIVE_SCAN, "PASSIVE-SCAN");
+			PARSE_FLAG(__NL80211_RRF_NO_IBSS, "NO-IBSS");
+		}
 
 		printf("\n");
 	}

Modified: iw/branches/upstream/current/scan.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/scan.c?rev=1820&op=diff
==============================================================================
--- iw/branches/upstream/current/scan.c	(original)
+++ iw/branches/upstream/current/scan.c	Wed Dec 25 03:37:02 2013
@@ -606,6 +606,154 @@
 	print_ampdu_length(data[2] & 3);
 	print_ampdu_spacing((data[2] >> 2) & 7);
 	print_ht_mcs(data + 3);
+}
+
+static const char* ntype_11u(uint8_t t)
+{
+	switch (t) {
+	case 0: return "Private";
+	case 1: return "Private with Guest";
+	case 2: return "Chargeable Public";
+	case 3: return "Free Public";
+	case 4: return "Personal Device";
+	case 5: return "Emergency Services Only";
+	case 14: return "Test or Experimental";
+	case 15: return "Wildcard";
+	default: return "Reserved";
+	}
+}
+
+static const char* vgroup_11u(uint8_t t)
+{
+	switch (t) {
+	case 0: return "Unspecified";
+	case 1: return "Assembly";
+	case 2: return "Business";
+	case 3: return "Educational";
+	case 4: return "Factory and Industrial";
+	case 5: return "Institutional";
+	case 6: return "Mercantile";
+	case 7: return "Residential";
+	case 8: return "Storage";
+	case 9: return "Utility and Miscellaneous";
+	case 10: return "Vehicular";
+	case 11: return "Outdoor";
+	default: return "Reserved";
+	}
+}
+
+static void print_interworking(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+	/* See Section 7.3.2.92 in the 802.11u spec. */
+	printf("\n");
+	if (len >= 1) {
+		uint8_t ano = data[0];
+		printf("\t\tNetwork Options: 0x%hx\n", (unsigned short)(ano));
+		printf("\t\t\tNetwork Type: %i (%s)\n",
+		       (int)(ano & 0xf), ntype_11u(ano & 0xf));
+		if (ano & (1<<4))
+			printf("\t\t\tInternet\n");
+		if (ano & (1<<5))
+			printf("\t\t\tASRA\n");
+		if (ano & (1<<6))
+			printf("\t\t\tESR\n");
+		if (ano & (1<<7))
+			printf("\t\t\tUESA\n");
+	}
+	if ((len == 3) || (len == 9)) {
+		printf("\t\tVenue Group: %i (%s)\n",
+		       (int)(data[1]), vgroup_11u(data[1]));
+		printf("\t\tVenue Type: %i\n", (int)(data[2]));
+	}
+	if (len == 9)
+		printf("\t\tHESSID: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx\n",
+		       data[3], data[4], data[5], data[6], data[7], data[8]);
+	else if (len == 7)
+		printf("\t\tHESSID: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx\n",
+		       data[1], data[2], data[3], data[4], data[5], data[6]);
+}
+
+static void print_11u_advert(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+	/* See Section 7.3.2.93 in the 802.11u spec. */
+	/* TODO: This code below does not decode private protocol IDs */
+	int idx = 0;
+	printf("\n");
+	while (idx < (len - 1)) {
+		uint8_t qri = data[idx];
+		uint8_t proto_id = data[idx + 1];
+		printf("\t\tQuery Response Info: 0x%hx\n", (unsigned short)(qri));
+		printf("\t\t\tQuery Response Length Limit: %i\n",
+		       (qri & 0x7f));
+		if (qri & (1<<7))
+			printf("\t\t\tPAME-BI\n");
+		switch(proto_id) {
+		case 0:
+			printf("\t\t\tANQP\n"); break;
+		case 1:
+			printf("\t\t\tMIH Information Service\n"); break;
+		case 2:
+			printf("\t\t\tMIH Command and Event Services Capability Discovery\n"); break;
+		case 3:
+			printf("\t\t\tEmergency Alert System (EAS)\n"); break;
+		case 221:
+			printf("\t\t\tVendor Specific\n"); break;
+		default:
+			printf("\t\t\tReserved: %i\n", proto_id); break;
+		}
+		idx += 2;
+	}
+}
+
+static void print_11u_rcon(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+	/* See Section 7.3.2.96 in the 802.11u spec. */
+	int idx = 0;
+	int ln0 = data[1] & 0xf;
+	int ln1 = ((data[1] & 0xf0) >> 4);
+	int ln2 = 0;
+	printf("\n");
+
+	if (ln1)
+		ln2 = len - 2 - ln0 - ln1;
+
+	printf("\t\tANQP OIs: %i\n", data[0]);
+
+	if (ln0 > 0) {
+		printf("\t\tOI 1: ");
+		if (2 + ln0 > len) {
+			printf("Invalid IE length.\n");
+		} else {
+			for (idx = 0; idx < ln0; idx++) {
+				printf("%02hx", data[2 + idx]);
+			}
+			printf("\n");
+		}
+	}
+
+	if (ln1 > 0) {
+		printf("\t\tOI 2: ");
+		if (2 + ln0 + ln1 > len) {
+			printf("Invalid IE length.\n");
+		} else {
+			for (idx = 0; idx < ln1; idx++) {
+				printf("%02hx", data[2 + ln0 + idx]);
+			}
+			printf("\n");
+		}
+	}
+
+	if (ln2 > 0) {
+		printf("\t\tOI 3: ");
+		if (2 + ln0 + ln1 + ln2 > len) {
+			printf("Invalid IE length.\n");
+		} else {
+			for (idx = 0; idx < ln2; idx++) {
+				printf("%02hx", data[2 + ln0 + ln1 + idx]);
+			}
+			printf("\n");
+		}
+	}
 }
 
 static const char *ht_secondary_offset[4] = {
@@ -885,6 +1033,9 @@
 	[113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
 	[114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
 	[127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), },
+	[107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
+	[108] = { "802.11u Advertisement", print_11u_advert, 0, 255, BIT(PRINT_SCAN), },
+	[111] = { "802.11u Roaming Consortium", print_11u_rcon, 0, 255, BIT(PRINT_SCAN), },
 };
 
 static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data)
@@ -1232,8 +1383,19 @@
 	}
 }
 
+static inline void print_hs20_ind(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+	/* I can't find the spec for this...just going off what wireshark uses. */
+	printf("\n");
+	if (len > 0)
+		printf("\t\tDGAF: %i\n", (int)(data[0] & 0x1));
+	else
+		printf("\t\tUnexpected length: %i\n", len);
+}
+
 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), },
 };
 
 static void print_vendor(unsigned char len, unsigned char *data,

Modified: iw/branches/upstream/current/util.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/util.c?rev=1820&op=diff
==============================================================================
--- iw/branches/upstream/current/util.c	(original)
+++ iw/branches/upstream/current/util.c	Wed Dec 25 03:37:02 2013
@@ -260,34 +260,50 @@
 	return cmdbuf;
 }
 
-int ieee80211_channel_to_frequency(int chan)
-{
-	if (chan < 14)
-		return 2407 + chan * 5;
-
-	if (chan == 14)
-		return 2484;
-
-	/* FIXME: dot11ChannelStartingFactor (802.11-2007 17.3.8.3.2) */
-	return (chan + 1000) * 5;
+int ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
+{
+	/* see 802.11 17.3.8.3.2 and Annex J
+	 * there are overlapping channel numbers in 5GHz and 2GHz bands */
+	if (chan <= 0)
+		return 0; /* not supported */
+	switch (band) {
+	case NL80211_BAND_2GHZ:
+		if (chan == 14)
+			return 2484;
+		else if (chan < 14)
+			return 2407 + chan * 5;
+		break;
+	case NL80211_BAND_5GHZ:
+		if (chan >= 182 && chan <= 196)
+			return 4000 + chan * 5;
+		else
+			return 5000 + chan * 5;
+		break;
+	case NL80211_BAND_60GHZ:
+		if (chan < 5)
+			return 56160 + chan * 2160;
+		break;
+	default:
+		;
+	}
+	return 0; /* not supported */
 }
 
 int ieee80211_frequency_to_channel(int freq)
 {
+	/* see 802.11-2007 17.3.8.3.2 and Annex J */
 	if (freq == 2484)
 		return 14;
-
-	if (freq < 2484)
+	else if (freq < 2484)
 		return (freq - 2407) / 5;
-
-	/* FIXME: dot11ChannelStartingFactor (802.11-2007 17.3.8.3.2) */
-	if (freq < 45000)
-		return freq/5 - 1000;
-
-	if (freq >= 58320 && freq <= 64800)
+	else if (freq >= 4910 && freq <= 4980)
+		return (freq - 4000) / 5;
+	else if (freq <= 45000) /* DMG band lower limit */
+		return (freq - 5000) / 5;
+	else if (freq >= 58320 && freq <= 64800)
 		return (freq - 56160) / 2160;
-
-	return 0;
+	else
+		return 0;
 }
 
 void print_ssid_escaped(const uint8_t len, const uint8_t *data)

Modified: iw/branches/upstream/current/version.sh
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/version.sh?rev=1820&op=diff
==============================================================================
--- iw/branches/upstream/current/version.sh	(original)
+++ iw/branches/upstream/current/version.sh	Wed Dec 25 03:37:02 2013
@@ -1,9 +1,9 @@
 #!/bin/sh
 
-VERSION="3.11"
+VERSION="3.13"
 OUT="$1"
 
-if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then
 	git update-index --refresh --unmerged > /dev/null
 	descr=$(git describe)
 




More information about the Pkg-wpa-devel mailing list