[pkg-wpa-devel] r1461 - in /iw/branches/upstream/current: event.c info.c iw.h scan.c util.c version.sh

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Thu Feb 11 00:32:03 UTC 2010


Author: kelmo-guest
Date: Thu Feb 11 00:32:02 2010
New Revision: 1461

URL: http://svn.debian.org/wsvn/?sc=1&rev=1461
Log:
[svn-upgrade] Integrating new upstream version, iw (0.9.19)

Modified:
    iw/branches/upstream/current/event.c
    iw/branches/upstream/current/info.c
    iw/branches/upstream/current/iw.h
    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=1461&op=diff
==============================================================================
--- iw/branches/upstream/current/event.c (original)
+++ iw/branches/upstream/current/event.c Thu Feb 11 00:32:02 2010
@@ -227,6 +227,10 @@
 			printf("\to beaconing enabled\n");
 
 		break;
+	case NL80211_CMD_NEW_STATION:
+		mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
+		printf("new station %s\n", macbuf);
+		break;
 	case NL80211_CMD_JOIN_IBSS:
 		mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
 		printf("IBSS %s joined\n", macbuf);

Modified: iw/branches/upstream/current/info.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/info.c?rev=1461&op=diff
==============================================================================
--- iw/branches/upstream/current/info.c (original)
+++ iw/branches/upstream/current/info.c Thu Feb 11 00:32:02 2010
@@ -19,24 +19,6 @@
 		printf(", ");
 	printf("%s", name);
 	*open = 1;
-}
-
-static void print_mcs_index(unsigned char *mcs)
-{
-	unsigned int mcs_bit;
-
-	for (mcs_bit = 0; mcs_bit <= 76; mcs_bit++) {
-		unsigned int mcs_octet = mcs_bit/8;
-		unsigned int MCS_RATE_BIT = 1 << mcs_bit % 8;
-		bool mcs_rate_idx_set;
-
-		mcs_rate_idx_set = !!(mcs[mcs_octet] & MCS_RATE_BIT);
-
-		if (!mcs_rate_idx_set)
-			continue;
-
-		printf("\t\t\tMCS index %d\n", mcs_bit);
-	}
 }
 
 static int print_phy_handler(struct nl_msg *msg, void *arg)
@@ -89,110 +71,20 @@
 
 #ifdef NL80211_BAND_ATTR_HT_CAPA
 		if (tb_band[NL80211_BAND_ATTR_HT_CAPA]) {
-			unsigned short cap = nla_get_u16(tb_band[NL80211_BAND_ATTR_HT_CAPA]);
-#define PCOM(fmt, args...) do { printf("\t\t\t* " fmt "\n", ##args); } while (0)
-#define PBCOM(bit, args...) if (cap & (bit)) PCOM(args)
-			printf("\t\tHT capabilities: 0x%.4x\n", cap);
-			PBCOM(0x0001, "LPDC coding");
-			if (cap & 0x0002)
-				PCOM("20/40 MHz operation");
-			else
-				PCOM("20 MHz operation");
-			switch ((cap & 0x000c) >> 2) {
-			case 0:
-				PCOM("static SM PS");
-				break;
-			case 1:
-				PCOM("dynamic SM PS");
-				break;
-			case 2:
-				PCOM("reserved SM PS");
-				break;
-			case 3:
-				PCOM("SM PS disabled");
-				break;
-			}
-			PBCOM(0x0010, "HT-greenfield");
-			PBCOM(0x0020, "20 MHz short GI");
-			PBCOM(0x0040, "40 MHz short GI");
-			PBCOM(0x0080, "TX STBC");
-			if (cap & 0x300)
-				PCOM("RX STBC %d streams", (cap & 0x0300) >> 8);
-			PBCOM(0x0400, "HT-delayed block-ack");
-			PCOM("max A-MSDU len %d", 0xeff + ((cap & 0x0800) << 1));
-			PBCOM(0x1000, "DSSS/CCK 40 MHz");
-			PBCOM(0x2000, "PSMP support");
-			PBCOM(0x4000, "40 MHz intolerant");
-			PBCOM(0x8000, "L-SIG TXOP protection support");
+			__u16 cap = nla_get_u16(tb_band[NL80211_BAND_ATTR_HT_CAPA]);
+			print_ht_capability(cap);
 		}
 		if (tb_band[NL80211_BAND_ATTR_HT_AMPDU_FACTOR]) {
-			unsigned char factor = nla_get_u8(tb_band[NL80211_BAND_ATTR_HT_AMPDU_FACTOR]);
-			printf("\t\tHT A-MPDU factor: 0x%.4x (%d bytes)\n", factor, (1<<(13+factor))-1);
+			__u8 exponent = nla_get_u8(tb_band[NL80211_BAND_ATTR_HT_AMPDU_FACTOR]);
+			print_ampdu_length(exponent);
 		}
 		if (tb_band[NL80211_BAND_ATTR_HT_AMPDU_DENSITY]) {
-			unsigned char dens = nla_get_u8(tb_band[NL80211_BAND_ATTR_HT_AMPDU_DENSITY]);
-			printf("\t\tHT A-MPDU density: 0x%.4x (", dens);
-			switch (dens) {
-			case 0:
-				printf("no restriction)\n");
-				break;
-			case 1:
-				printf("1/4 usec)\n");
-				break;
-			case 2:
-				printf("1/2 usec)\n");
-				break;
-			default:
-				printf("%d usec)\n", 1<<(dens - 3));
-			}
+			__u8 spacing = nla_get_u8(tb_band[NL80211_BAND_ATTR_HT_AMPDU_DENSITY]);
+			print_ampdu_spacing(spacing);
 		}
 		if (tb_band[NL80211_BAND_ATTR_HT_MCS_SET] &&
-		    nla_len(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]) == 16) {
-			/* As defined in 7.3.2.57.4 Supported MCS Set field */
-			unsigned int tx_max_num_spatial_streams, max_rx_supp_data_rate;
-			unsigned char *mcs = nla_data(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]);
-			bool tx_mcs_set_defined, tx_mcs_set_equal, tx_unequal_modulation;
-
-			printf("\t\tHT MCS set: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x\n",
-				mcs[0], mcs[1], mcs[2], mcs[3], mcs[4], mcs[5], mcs[6], mcs[7],
-				mcs[8], mcs[9], mcs[10], mcs[11], mcs[12], mcs[13], mcs[14], mcs[15]);
-
-			max_rx_supp_data_rate = ((mcs[10] >> 8) & ((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] & ((1 << 2) | (1 << 3))) + 1;
-			tx_unequal_modulation = !!(mcs[12] & (1 << 4));
-
-			if (max_rx_supp_data_rate)
-				printf("\t\tHT Max RX data rate: %d Mbps\n", max_rx_supp_data_rate);
-			/* XXX: else see 9.6.0e.5.3 how to get this I think */
-
-			if (tx_mcs_set_defined) {
-				if (tx_mcs_set_equal) {
-					printf("\t\tHT TX/RX MCS rate indexes supported:\n");
-					print_mcs_index(&mcs[0]);
-				} else {
-					printf("\t\tHT RX MCS rate indexes supported:\n");
-					print_mcs_index(&mcs[0]);
-
-					if (tx_unequal_modulation)
-						printf("TX unequal modulation supported\n");
-					else
-						printf("TX unequal modulation not supported\n");
-
-					printf("\t\tHT TX Max spatiel streams: %d\n",
-						tx_max_num_spatial_streams);
-
-					printf("\t\tHT TX MCS rate indexes supported may differ\n");
-				}
-			}
-			else {
-				printf("\t\tHT RX MCS rate indexes supported:\n");
-				print_mcs_index(&mcs[0]);
-				printf("\t\tHT TX MCS rates indexes are undefined\n");
-			}
-
-		}
+		    nla_len(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]) == 16)
+			print_ht_mcs(nla_data(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]));
 #endif
 
 		printf("\t\tFrequencies:\n");

Modified: iw/branches/upstream/current/iw.h
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/iw.h?rev=1461&op=diff
==============================================================================
--- iw/branches/upstream/current/iw.h (original)
+++ iw/branches/upstream/current/iw.h Thu Feb 11 00:32:02 2010
@@ -57,7 +57,7 @@
 #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
 
 #define __COMMAND(_section, _symname, _name, _args, _nlcmd, _flags, _hidden, _idby, _handler, _help)\
-	static const struct cmd						\
+	static struct cmd						\
 	__cmd ## _ ## _symname ## _ ## _handler ## _ ## _nlcmd ## _ ## _idby ## _ ## _hidden\
 	__attribute__((used)) __attribute__((section("__cmd")))	= {	\
 		.name = (_name),					\
@@ -76,7 +76,7 @@
 	__COMMAND(&(__section ## _ ## section), name, #name, args, cmd, flags, 1, idby, handler, NULL)
 
 #define TOPLEVEL(_name, _args, _nlcmd, _flags, _idby, _handler, _help)	\
-	const struct cmd						\
+	struct cmd							\
 	__section ## _ ## _name						\
 	__attribute__((used)) __attribute__((section("__cmd")))	= {	\
 		.name = (#_name),					\
@@ -88,14 +88,14 @@
 		.help = (_help),					\
 	 }
 #define SECTION(_name)							\
-	const struct cmd __section ## _ ## _name			\
+	struct cmd __section ## _ ## _name				\
 	__attribute__((used)) __attribute__((section("__cmd"))) = {	\
 		.name = (#_name),					\
 		.hidden = 1,						\
 	}
 
 #define DECLARE_SECTION(_name)						\
-	extern const struct cmd __section ## _ ## _name;
+	extern struct cmd __section ## _ ## _name;
 
 extern const char iw_version[];
 
@@ -119,6 +119,11 @@
 void mac_addr_n2a(char *mac_addr, unsigned char *arg);
 
 int parse_keys(struct nl_msg *msg, char **argv, int argc);
+
+void print_ht_mcs(const __u8 *mcs);
+void print_ampdu_length(__u8 exponent);
+void print_ampdu_spacing(__u8 spacing);
+void print_ht_capability(__u16 cap);
 
 const char *iftype_name(enum nl80211_iftype iftype);
 const char *command_name(enum nl80211_commands cmd);

Modified: iw/branches/upstream/current/scan.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/scan.c?rev=1461&op=diff
==============================================================================
--- iw/branches/upstream/current/scan.c (original)
+++ iw/branches/upstream/current/scan.c Thu Feb 11 00:32:02 2010
@@ -419,6 +419,19 @@
 static void print_rsn(const uint8_t type, uint8_t len, const uint8_t *data)
 {
 	print_rsn_ie("CCMP", "IEEE 802.1X", len, data);
+}
+
+static void print_ht_capa(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+	if (len != 26) {
+		printf("\n\t\tHT Capability IE len != expected 26 bytes, skipping parse\n");
+		return;
+	}
+	printf("\n");
+	print_ht_capability(data[0] | (data[1] << 8));
+	print_ampdu_length(data[2] & 3);
+	print_ampdu_spacing((data[2] >> 2) & 3);
+	print_ht_mcs(data + 3);
 }
 
 static void print_capabilities(const uint8_t type, uint8_t len, const uint8_t *data)
@@ -518,6 +531,7 @@
 	[7] = { "Country", print_country, 3, 255, BIT(PRINT_SCAN), },
 	[32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
 	[42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
+	[45] = { "HT capabilities", print_ht_capa, 1, 255, BIT(PRINT_SCAN), },
 	[48] = { "RSN", print_rsn, 2, 255, BIT(PRINT_SCAN), },
 	[50] = { "Extended supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
 	[127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), },
@@ -541,17 +555,17 @@
 		return false;
 	}
 
-	printf("\t* Parameter version 1");
+	printf("\t * Parameter version 1");
 
 	data++;
 
 	if (data[0] & 0x80)
-		printf("\n\t\t* u-APSD");
+		printf("\n\t\t * u-APSD");
 
 	data += 2;
 
 	for (i = 0; i < 4; i++) {
-		printf("\n\t\t* %s:", aci_tbl[(data[0] >> 5) & 3]);
+		printf("\n\t\t * %s:", aci_tbl[(data[0] >> 5) & 3]);
 		if (data[4] & 0x10)
 			printf(" acm");
 		printf(" CW %d-%d", (1 << (data[1] & 0xf)) - 1,

Modified: iw/branches/upstream/current/util.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/util.c?rev=1461&op=diff
==============================================================================
--- iw/branches/upstream/current/util.c (original)
+++ iw/branches/upstream/current/util.c Thu Feb 11 00:32:02 2010
@@ -292,3 +292,182 @@
 			"for example: d:2:6162636465 is the same as d:2:abcde\n");
 	return 2;
 }
+
+static void print_mcs_index(const __u8 *mcs)
+{
+	unsigned int mcs_bit, prev_bit = -2, prev_cont = 0;
+
+	for (mcs_bit = 0; mcs_bit <= 76; mcs_bit++) {
+		unsigned int mcs_octet = mcs_bit/8;
+		unsigned int MCS_RATE_BIT = 1 << mcs_bit % 8;
+		bool mcs_rate_idx_set;
+
+		mcs_rate_idx_set = !!(mcs[mcs_octet] & MCS_RATE_BIT);
+
+		if (!mcs_rate_idx_set)
+			continue;
+
+		if (prev_bit != mcs_bit - 1) {
+			if (prev_bit != -2)
+				printf("%d, ", prev_bit);
+			else
+				printf(" ");
+			printf("%d", mcs_bit);
+			prev_cont = 0;
+		} else if (!prev_cont) {
+			printf("-");
+			prev_cont = 1;
+		}
+
+		prev_bit = mcs_bit;
+	}
+
+	if (prev_cont)
+		printf("%d", prev_bit);
+	printf("\n");
+}
+
+/*
+ * There are only 4 possible values, we just use a case instead of computing it,
+ * but technically this can also be computed through the formula:
+ *
+ * Max AMPDU length = (2 ^ (13 + exponent)) - 1 bytes
+ */
+static __u32 compute_ampdu_length(__u8 exponent)
+{
+	switch (exponent) {
+	case 0: return 8191;  /* (2 ^(13 + 0)) -1 */
+	case 1: return 16383; /* (2 ^(13 + 1)) -1 */
+	case 2: return 32767; /* (2 ^(13 + 2)) -1 */
+	case 3: return 65535; /* (2 ^(13 + 3)) -1 */
+	default: return 0;
+	}
+}
+
+static const char *print_ampdu_space(__u8 space)
+{
+	switch (space) {
+	case 0: return "No restriction";
+	case 1: return "1/4 usec";
+	case 2: return "1/2 usec";
+	case 3: return "1 usec";
+	case 4: return "2 usec";
+	case 5: return "4 usec";
+	case 6: return "8 usec";
+	case 7: return "16 usec";
+	default:
+		return "BUG (spacing more than 3 bits!)";
+	}
+}
+
+void print_ampdu_length(__u8 exponent)
+{
+	__u32 max_ampdu_length;
+
+	max_ampdu_length = compute_ampdu_length(exponent);
+
+	if (max_ampdu_length) {
+		printf("\t\tMaximum RX AMPDU length %d bytes (exponent: 0x0%02x)\n",
+		       max_ampdu_length, exponent);
+        } else {
+		printf("\t\tMaximum RX AMPDU length: unrecognized bytes "
+		       "(exponent: %d)\n", exponent);
+	}
+}
+
+void print_ampdu_spacing(__u8 spacing)
+{
+        printf("\t\tMinimum RX AMPDU time spacing: %s (0x%02x)\n",
+               print_ampdu_space(spacing), spacing);
+}
+
+void print_ht_capability(__u16 cap)
+{
+#define PRINT_HT_CAP(_cond, _str) \
+	do { \
+		if (_cond) \
+			printf("\t\t\t" _str "\n"); \
+	} while (0)
+
+	printf("\t\tCapabilities: 0x%02x\n", cap);
+
+	PRINT_HT_CAP((cap & BIT(0)), "RX LDCP");
+	PRINT_HT_CAP((cap & BIT(1)), "HT20/HT40");
+	PRINT_HT_CAP(!(cap & BIT(1)), "HT20");
+
+	PRINT_HT_CAP(((cap >> 2) & 0x3) == 0, "Static SM Power Save");
+	PRINT_HT_CAP(((cap >> 2) & 0x3) == 1, "Dynamic SM Power Save");
+	PRINT_HT_CAP(((cap >> 2) & 0x3) == 3, "SM Power Save disabled");
+
+	PRINT_HT_CAP((cap & BIT(4)), "RX Greenfield");
+	PRINT_HT_CAP((cap & BIT(5)), "RX HT20 SGI");
+	PRINT_HT_CAP((cap & BIT(6)), "RX HT40 SGI");
+	PRINT_HT_CAP((cap & BIT(7)), "TX STBC");
+
+	PRINT_HT_CAP(((cap >> 8) & 0x3) == 0, "No RX STBC");
+	PRINT_HT_CAP(((cap >> 8) & 0x3) == 1, "RX STBC 1-stream");
+	PRINT_HT_CAP(((cap >> 8) & 0x3) == 2, "RX STBC 2-streams");
+	PRINT_HT_CAP(((cap >> 8) & 0x3) == 3, "RX STBC 3-streams");
+
+	PRINT_HT_CAP((cap & BIT(10)), "HT Delayed Block Ack");
+
+	PRINT_HT_CAP((cap & BIT(11)), "Max AMSDU length: 3839 bytes");
+        PRINT_HT_CAP(!(cap & BIT(11)), "Max AMSDU length: 7935 bytes");
+
+	/*
+	 * For beacons and probe response this would mean the BSS
+	 * does or does not allow the usage of DSSS/CCK HT40.
+	 * Otherwise it means the STA does or does not use
+	 * DSSS/CCK HT40.
+	 */
+	PRINT_HT_CAP((cap & BIT(12)), "DSSS/CCK HT40");
+	PRINT_HT_CAP(!(cap & BIT(12)), "No DSSS/CCK HT40");
+
+	/* BIT(13) is reserved */
+
+	PRINT_HT_CAP((cap & BIT(14)), "40 MHz Intolerant");
+
+	PRINT_HT_CAP((cap & BIT(15)), "L-SIG TXOP protection");
+#undef PRINT_HT_CAP
+}
+
+void print_ht_mcs(const __u8 *mcs)
+{
+	/* As defined in 7.3.2.57.4 Supported MCS Set field */
+	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] >> 8) & ((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;
+	tx_unequal_modulation = !!(mcs[12] & (1 << 4));
+
+	if (max_rx_supp_data_rate)
+		printf("\t\tHT Max RX data rate: %d Mbps\n", max_rx_supp_data_rate);
+	/* XXX: else see 9.6.0e.5.3 how to get this I think */
+
+	if (tx_mcs_set_defined) {
+		if (tx_mcs_set_equal) {
+			printf("\t\tHT TX/RX MCS rate indexes supported:");
+			print_mcs_index(mcs);
+		} else {
+			printf("\t\tHT RX MCS rate indexes supported:");
+			print_mcs_index(mcs);
+
+			if (tx_unequal_modulation)
+				printf("\t\tTX unequal modulation supported\n");
+			else
+				printf("\t\tTX unequal modulation not supported\n");
+
+			printf("\t\tHT TX Max spatial streams: %d\n",
+				tx_max_num_spatial_streams);
+
+			printf("\t\tHT TX MCS rate indexes supported may differ\n");
+		}
+	} else {
+		printf("\t\tHT RX MCS rate indexes supported:");
+		print_mcs_index(mcs);
+		printf("\t\tHT TX MCS rate indexes are undefined\n");
+	}
+}

Modified: iw/branches/upstream/current/version.sh
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/version.sh?rev=1461&op=diff
==============================================================================
--- iw/branches/upstream/current/version.sh (original)
+++ iw/branches/upstream/current/version.sh Thu Feb 11 00:32:02 2010
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-VERSION="0.9.18"
+VERSION="0.9.19"
 OUT="$1"
 
 echo '#include "iw.h"' > "$OUT"




More information about the Pkg-wpa-devel mailing list