[pkg-wpa-devel] r1450 - in /iw/branches/upstream/current: Makefile info.c interface.c iw.c iw.h link.c mesh.c mpath.c nl80211.h phy.c scan.c station.c survey.c util.c version.sh

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Sun Nov 22 08:11:40 UTC 2009


Author: kelmo-guest
Date: Sun Nov 22 08:11:38 2009
New Revision: 1450

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

Added:
    iw/branches/upstream/current/survey.c
Modified:
    iw/branches/upstream/current/Makefile
    iw/branches/upstream/current/info.c
    iw/branches/upstream/current/interface.c
    iw/branches/upstream/current/iw.c
    iw/branches/upstream/current/iw.h
    iw/branches/upstream/current/link.c
    iw/branches/upstream/current/mesh.c
    iw/branches/upstream/current/mpath.c
    iw/branches/upstream/current/nl80211.h
    iw/branches/upstream/current/phy.c
    iw/branches/upstream/current/scan.c
    iw/branches/upstream/current/station.c
    iw/branches/upstream/current/util.c
    iw/branches/upstream/current/version.sh

Modified: iw/branches/upstream/current/Makefile
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/Makefile?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/Makefile (original)
+++ iw/branches/upstream/current/Makefile Sun Nov 22 08:11:38 2009
@@ -3,7 +3,7 @@
 MAKEFLAGS += --no-print-directory
 
 PREFIX ?= /usr
-BINDIR ?= $(PREFIX)/bin
+SBINDIR ?= $(PREFIX)/sbin
 MANDIR ?= $(PREFIX)/share/man
 PKG_CONFIG ?= pkg-config
 
@@ -15,7 +15,7 @@
 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 util.o \
+	interface.o ibss.o station.o survey.o util.o \
 	mesh.o mpath.o scan.o reg.o version.o \
 	reason.o status.o connect.o link.o
 OBJS += sections.o
@@ -38,8 +38,8 @@
 $(error Cannot find development files for any supported version of libnl)
 endif
 
-LIBS += $(shell pkg-config --libs $(NLLIBNAME))
-CFLAGS += $(shell pkg-config --cflags $(NLLIBNAME))
+LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME))
+CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
 
 ifeq ($(V),1)
 Q=
@@ -85,8 +85,8 @@
 
 install: iw iw.8.gz
 	@$(NQ) ' INST iw'
-	$(Q)$(MKDIR) $(DESTDIR)$(BINDIR)
-	$(Q)$(INSTALL) -m 755 -t $(DESTDIR)$(BINDIR) iw
+	$(Q)$(MKDIR) $(DESTDIR)$(SBINDIR)
+	$(Q)$(INSTALL) -m 755 -t $(DESTDIR)$(SBINDIR) iw
 	@$(NQ) ' INST iw.8'
 	$(Q)$(MKDIR) $(DESTDIR)$(MANDIR)/man8/
 	$(Q)$(INSTALL) -m 644 -t $(DESTDIR)$(MANDIR)/man8/ iw.8.gz

Modified: iw/branches/upstream/current/info.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/info.c?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/info.c (original)
+++ iw/branches/upstream/current/info.c Sun Nov 22 08:11:38 2009
@@ -66,8 +66,9 @@
 	struct nlattr *nl_freq;
 	struct nlattr *nl_rate;
 	struct nlattr *nl_mode;
+	struct nlattr *nl_cmd;
 	int bandidx = 1;
-	int rem_band, rem_freq, rem_rate, rem_mode;
+	int rem_band, rem_freq, rem_rate, rem_mode, rem_cmd;
 	int open;
 
 	nla_parse(tb_msg, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@@ -264,11 +265,19 @@
 	}
 
 	if (!tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES])
-		return NL_SKIP;
+		goto commands;
 
 	printf("\tSupported interface modes:\n");
 	nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES], rem_mode)
 		printf("\t\t * %s\n", iftype_name(nl_mode->nla_type));
+
+ commands:
+	if (!tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS])
+		return NL_SKIP;
+
+	printf("\tSupported commands:\n");
+	nla_for_each_nested(nl_cmd, tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS], rem_cmd)
+		printf("\t\t * %s\n", command_name(nla_get_u32(nl_cmd)));
 
 	return NL_SKIP;
 }

Modified: iw/branches/upstream/current/interface.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/interface.c?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/interface.c (original)
+++ iw/branches/upstream/current/interface.c Sun Nov 22 08:11:38 2009
@@ -137,6 +137,20 @@
 	return 2;
 }
 
+static int parse_4addr_flag(const char *value, struct nl_msg *msg)
+{
+	if (strcmp(value, "on") == 0)
+		NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, 1);
+	else if (strcmp(value, "off") == 0)
+		NLA_PUT_U8(msg, NL80211_ATTR_4ADDR, 0);
+	else
+		return 1;
+	return 0;
+
+nla_put_failure:
+	return 1;
+}
+
 static int handle_interface_add(struct nl80211_state *state,
 				struct nl_cb *cb,
 				struct nl_msg *msg,
@@ -166,6 +180,15 @@
 			if (!argc)
 				return 1;
 			mesh_id = argv[0];
+			argc--;
+			argv++;
+		} else if (strcmp(argv[0], "4addr") == 0) {
+			argc--;
+			argv++;
+			if (parse_4addr_flag(argv[0], msg)) {
+				fprintf(stderr, "4addr error\n");
+				return 2;
+			}
 			argc--;
 			argv++;
 		} else if (strcmp(argv[0], "flags") == 0) {
@@ -192,14 +215,14 @@
  nla_put_failure:
 	return -ENOBUFS;
 }
-COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [flags <flag>*]",
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]",
 	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>] [flags <flag>*]",
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]",
 	NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL);
 
 static int handle_interface_del(struct nl80211_state *state,

Modified: iw/branches/upstream/current/iw.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/iw.c?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/iw.c (original)
+++ iw/branches/upstream/current/iw.c Sun Nov 22 08:11:38 2009
@@ -223,9 +223,12 @@
 	if (fd < 0)
 		return -1;
 	pos = read(fd, buf, sizeof(buf) - 1);
-	if (pos < 0)
+	if (pos < 0) {
+		close(fd);
 		return -1;
+	}
 	buf[pos] = '\0';
+	close(fd);
 	return atoi(buf);
 }
 

Modified: iw/branches/upstream/current/iw.h
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/iw.h?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/iw.h (original)
+++ iw/branches/upstream/current/iw.h Sun Nov 22 08:11:38 2009
@@ -121,6 +121,7 @@
 int parse_keys(struct nl_msg *msg, char **argv, int argc);
 
 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_frequency_to_channel(int freq);
 

Modified: iw/branches/upstream/current/link.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/link.c?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/link.c (original)
+++ iw/branches/upstream/current/link.c Sun Nov 22 08:11:38 2009
@@ -44,13 +44,13 @@
 		  genlmsg_attrlen(gnlh, 0), NULL);
 
 	if (!tb[NL80211_ATTR_BSS]) {
-		fprintf(stderr, "bss info missing!");
+		fprintf(stderr, "bss info missing!\n");
 		return NL_SKIP;
 	}
 	if (nla_parse_nested(bss, NL80211_BSS_MAX,
 			     tb[NL80211_ATTR_BSS],
 			     bss_policy)) {
-		fprintf(stderr, "failed to parse nested attributes!");
+		fprintf(stderr, "failed to parse nested attributes!\n");
 		return NL_SKIP;
 	}
 
@@ -136,13 +136,13 @@
 		  genlmsg_attrlen(gnlh, 0), NULL);
 
 	if (!tb[NL80211_ATTR_STA_INFO]) {
-		fprintf(stderr, "sta stats missing!");
+		fprintf(stderr, "sta stats missing!\n");
 		return NL_SKIP;
 	}
 	if (nla_parse_nested(sinfo, NL80211_STA_INFO_MAX,
 			     tb[NL80211_ATTR_STA_INFO],
 			     stats_policy)) {
-		fprintf(stderr, "failed to parse nested attributes!");
+		fprintf(stderr, "failed to parse nested attributes!\n");
 		return NL_SKIP;
 	}
 
@@ -161,7 +161,7 @@
 	if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
 		if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX,
 				     sinfo[NL80211_STA_INFO_TX_BITRATE], rate_policy)) {
-			fprintf(stderr, "failed to parse nested rate attributes!");
+			fprintf(stderr, "failed to parse nested rate attributes!\n");
 		} else {
 			printf("\ttx bitrate: ");
 			if (rinfo[NL80211_RATE_INFO_BITRATE]) {

Modified: iw/branches/upstream/current/mesh.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/mesh.c?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/mesh.c (original)
+++ iw/branches/upstream/current/mesh.c Sun Nov 22 08:11:38 2009
@@ -165,6 +165,8 @@
 	{"mesh_hwmp_net_diameter_traversal_time",
 	NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
 	_my_nla_put_u16, _parse_u16, _print_u16_in_TUs},
+	{"mesh_hwmp_rootmode", NL80211_MESHCONF_HWMP_ROOTMODE,
+	_my_nla_put_u8, _parse_u8, _print_u8},
 };
 
 static void print_all_mesh_param_descr(void)

Modified: iw/branches/upstream/current/mpath.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/mpath.c?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/mpath.c (original)
+++ iw/branches/upstream/current/mpath.c Sun Nov 22 08:11:38 2009
@@ -38,7 +38,7 @@
 	char dst[20], next_hop[20], dev[20];
 	static struct nla_policy mpath_policy[NL80211_MPATH_INFO_MAX + 1] = {
 		[NL80211_MPATH_INFO_FRAME_QLEN] = { .type = NLA_U32 },
-		[NL80211_MPATH_INFO_DSN] = { .type = NLA_U32 },
+		[NL80211_MPATH_INFO_SN] = { .type = NLA_U32 },
 		[NL80211_MPATH_INFO_METRIC] = { .type = NLA_U32 },
 		[NL80211_MPATH_INFO_EXPTIME] = { .type = NLA_U32 },
 		[NL80211_MPATH_INFO_DISCOVERY_TIMEOUT] = { .type = NLA_U32 },
@@ -56,13 +56,13 @@
 	 */
 
 	if (!tb[NL80211_ATTR_MPATH_INFO]) {
-		fprintf(stderr, "mpath info missing!");
+		fprintf(stderr, "mpath info missing!\n");
 		return NL_SKIP;
 	}
 	if (nla_parse_nested(pinfo, NL80211_MPATH_INFO_MAX,
 			     tb[NL80211_ATTR_MPATH_INFO],
 			     mpath_policy)) {
-		fprintf(stderr, "failed to parse nested attributes!");
+		fprintf(stderr, "failed to parse nested attributes!\n");
 		return NL_SKIP;
 	}
 
@@ -70,9 +70,9 @@
 	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", dst, next_hop, dev);
-	if (pinfo[NL80211_MPATH_INFO_DSN])
+	if (pinfo[NL80211_MPATH_INFO_SN])
 		printf("\t%u",
-			nla_get_u32(pinfo[NL80211_MPATH_INFO_DSN]));
+			nla_get_u32(pinfo[NL80211_MPATH_INFO_SN]));
 	if (pinfo[NL80211_MPATH_INFO_METRIC])
 		printf("\t%u",
 			nla_get_u32(pinfo[NL80211_MPATH_INFO_METRIC]));
@@ -184,6 +184,8 @@
 			     struct nl_msg *msg,
 			     int argc, char **argv)
 {
+	printf("DEST ADDR         NEXT HOP          IFACE\tSN\tMETRIC\tQLEN\t"
+	       "EXPTIME\t\tDTIM\tDRET\tFLAGS\n");
 	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_mpath_handler, NULL);
 	return 0;
 }

Modified: iw/branches/upstream/current/nl80211.h
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/nl80211.h?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/nl80211.h (original)
+++ iw/branches/upstream/current/nl80211.h Sun Nov 22 08:11:38 2009
@@ -159,6 +159,11 @@
  *	NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
  *	partial scan results may be available
+ *
+ * @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation
+ *      or noise level
+ * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to
+ *	NL80211_CMD_GET_SURVEY and on the "scan" multicast group)
  *
  * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain
  * 	has been changed and provides details of the request information
@@ -262,6 +267,9 @@
  *	reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and
  *	%NL80211_ATTR_REASON_CODE attributes are used.
  *
+ * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices
+ *	associated with this wiphy must be down and will follow.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -335,6 +343,11 @@
 	NL80211_CMD_CONNECT,
 	NL80211_CMD_ROAM,
 	NL80211_CMD_DISCONNECT,
+
+	NL80211_CMD_SET_WIPHY_NETNS,
+
+	NL80211_CMD_GET_SURVEY,
+	NL80211_CMD_NEW_SURVEY_RESULTS,
 
 	/* add new commands above here */
 
@@ -475,10 +488,6 @@
  * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
  * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
  *	scanning and include a zero-length SSID (wildcard) for wildcard scan
- * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the
- *	scan result list changes (BSS expired or added) so that applications
- *	can verify that they got a single, consistent snapshot (when all dump
- *	messages carried the same generation number)
  * @NL80211_ATTR_BSS: scan result BSS
  *
  * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain
@@ -573,6 +582,22 @@
  *	and join_ibss(), key information is in a nested attribute each
  *	with %NL80211_KEY_* sub-attributes
  *
+ * @NL80211_ATTR_PID: Process ID of a network namespace.
+ *
+ * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for
+ *	dumps. This number increases whenever the object list being
+ *	dumped changes, and as such userspace can verify that it has
+ *	obtained a complete and consistent snapshot by verifying that
+ *	all dump messages contain the same generation number. If it
+ *	changed then the list changed and the dump should be repeated
+ *	completely from scratch.
+ *
+ * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface
+ *
+ * @NL80211_ATTR_SURVEY_INFO: survey information about a channel, part of
+ *      the survey response for %NL80211_CMD_GET_SURVEY, nested attribute
+ *      containing info as possible, see &enum survey_info.
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -644,7 +669,7 @@
 
 	NL80211_ATTR_SCAN_FREQUENCIES,
 	NL80211_ATTR_SCAN_SSIDS,
-	NL80211_ATTR_SCAN_GENERATION,
+	NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */
 	NL80211_ATTR_BSS,
 
 	NL80211_ATTR_REG_INITIATOR,
@@ -701,11 +726,20 @@
 	NL80211_ATTR_KEY,
 	NL80211_ATTR_KEYS,
 
+	NL80211_ATTR_PID,
+
+	NL80211_ATTR_4ADDR,
+
+	NL80211_ATTR_SURVEY_INFO,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
 	NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
 };
+
+/* source-level API compatibility */
+#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
 
 /*
  * Allow user space programs to use #ifdef on new attributes by defining them
@@ -879,14 +913,14 @@
  *
  * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active
  * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running
- * @NL80211_MPATH_FLAG_DSN_VALID: the mesh path contains a valid DSN
+ * @NL80211_MPATH_FLAG_SN_VALID: the mesh path contains a valid SN
  * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set
  * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded
  */
 enum nl80211_mpath_flags {
 	NL80211_MPATH_FLAG_ACTIVE =	1<<0,
 	NL80211_MPATH_FLAG_RESOLVING =	1<<1,
-	NL80211_MPATH_FLAG_DSN_VALID =	1<<2,
+	NL80211_MPATH_FLAG_SN_VALID =	1<<2,
 	NL80211_MPATH_FLAG_FIXED =	1<<3,
 	NL80211_MPATH_FLAG_RESOLVED =	1<<4,
 };
@@ -899,7 +933,7 @@
  *
  * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved
  * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination
- * @NL80211_ATTR_MPATH_DSN: destination sequence number
+ * @NL80211_ATTR_MPATH_SN: destination sequence number
  * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path
  * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now
  * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in
@@ -910,7 +944,7 @@
 enum nl80211_mpath_info {
 	__NL80211_MPATH_INFO_INVALID,
 	NL80211_MPATH_INFO_FRAME_QLEN,
-	NL80211_MPATH_INFO_DSN,
+	NL80211_MPATH_INFO_SN,
 	NL80211_MPATH_INFO_METRIC,
 	NL80211_MPATH_INFO_EXPTIME,
 	NL80211_MPATH_INFO_FLAGS,
@@ -1101,6 +1135,26 @@
 };
 
 /**
+ * enum nl80211_survey_info - survey information
+ *
+ * These attribute types are used with %NL80211_ATTR_SURVEY_INFO
+ * when getting information about a survey.
+ *
+ * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved
+ * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel
+ * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm)
+ */
+enum nl80211_survey_info {
+	__NL80211_SURVEY_INFO_INVALID,
+	NL80211_SURVEY_INFO_FREQUENCY,
+	NL80211_SURVEY_INFO_NOISE,
+
+	/* keep last */
+	__NL80211_SURVEY_INFO_AFTER_LAST,
+	NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1
+};
+
+/**
  * enum nl80211_mntr_flags - monitor configuration flags
  *
  * Monitor configuration flags.
@@ -1179,6 +1233,8 @@
  *
  * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs)
  * that it takes for an HWMP information element to propagate across the mesh
+ *
+ * @NL80211_MESHCONF_ROOTMODE: whether root mode is enabled or not
  *
  * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
  *
@@ -1199,6 +1255,7 @@
 	NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT,
 	NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
 	NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
+	NL80211_MESHCONF_HWMP_ROOTMODE,
 
 	/* keep last */
 	__NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -1261,6 +1318,7 @@
  * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
  *	in unspecified units, scaled to 0..100 (u8)
  * @NL80211_BSS_STATUS: status, if this BSS is "used"
+ * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms
  * @__NL80211_BSS_AFTER_LAST: internal
  * @NL80211_BSS_MAX: highest BSS attribute
  */
@@ -1275,6 +1333,7 @@
 	NL80211_BSS_SIGNAL_MBM,
 	NL80211_BSS_SIGNAL_UNSPEC,
 	NL80211_BSS_STATUS,
+	NL80211_BSS_SEEN_MS_AGO,
 
 	/* keep last */
 	__NL80211_BSS_AFTER_LAST,

Modified: iw/branches/upstream/current/phy.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/phy.c?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/phy.c (original)
+++ iw/branches/upstream/current/phy.c Sun Nov 22 08:11:38 2009
@@ -140,3 +140,27 @@
 COMMAND(set, rts, "<rts threshold|off>",
 	NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_rts,
 	"Set rts threshold.");
+
+static int handle_netns(struct nl80211_state *state,
+			struct nl_cb *cb,
+			struct nl_msg *msg,
+			int argc, char **argv)
+{
+	char *end;
+
+	if (argc != 1)
+		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>",
+	NL80211_CMD_SET_WIPHY_NETNS, 0, CIB_PHY, handle_netns,
+	"Put this wireless device into a different network namespace");

Modified: iw/branches/upstream/current/scan.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/scan.c?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/scan.c (original)
+++ iw/branches/upstream/current/scan.c Sun Nov 22 08:11:38 2009
@@ -754,6 +754,7 @@
 		[NL80211_BSS_SIGNAL_MBM] = { .type = NLA_U32 },
 		[NL80211_BSS_SIGNAL_UNSPEC] = { .type = NLA_U8 },
 		[NL80211_BSS_STATUS] = { .type = NLA_U32 },
+		[NL80211_BSS_SEEN_MS_AGO] = { .type = NLA_U32 },
 	};
 	struct scan_params *params = arg;
 
@@ -761,13 +762,13 @@
 		  genlmsg_attrlen(gnlh, 0), NULL);
 
 	if (!tb[NL80211_ATTR_BSS]) {
-		fprintf(stderr, "bss info missing!");
+		fprintf(stderr, "bss info missing!\n");
 		return NL_SKIP;
 	}
 	if (nla_parse_nested(bss, NL80211_BSS_MAX,
 			     tb[NL80211_ATTR_BSS],
 			     bss_policy)) {
-		fprintf(stderr, "failed to parse nested attributes!");
+		fprintf(stderr, "failed to parse nested attributes!\n");
 		return NL_SKIP;
 	}
 
@@ -845,6 +846,10 @@
 		unsigned char s = nla_get_u8(bss[NL80211_BSS_SIGNAL_UNSPEC]);
 		printf("\tsignal: %d/100\n", s);
 	}
+	if (bss[NL80211_BSS_SEEN_MS_AGO]) {
+		int age = nla_get_u32(bss[NL80211_BSS_SEEN_MS_AGO]);
+		printf("\tlast seen: %d ms ago\n", age);
+	}
 	if (bss[NL80211_BSS_INFORMATION_ELEMENTS])
 		print_ies(nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]),
 			  nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]),

Modified: iw/branches/upstream/current/station.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/station.c?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/station.c (original)
+++ iw/branches/upstream/current/station.c Sun Nov 22 08:11:38 2009
@@ -67,13 +67,13 @@
 	 */
 
 	if (!tb[NL80211_ATTR_STA_INFO]) {
-		fprintf(stderr, "sta stats missing!");
+		fprintf(stderr, "sta stats missing!\n");
 		return NL_SKIP;
 	}
 	if (nla_parse_nested(sinfo, NL80211_STA_INFO_MAX,
 			     tb[NL80211_ATTR_STA_INFO],
 			     stats_policy)) {
-		fprintf(stderr, "failed to parse nested attributes!");
+		fprintf(stderr, "failed to parse nested attributes!\n");
 		return NL_SKIP;
 	}
 
@@ -103,7 +103,7 @@
 	if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
 		if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX,
 				     sinfo[NL80211_STA_INFO_TX_BITRATE], rate_policy)) {
-			fprintf(stderr, "failed to parse nested rate attributes!");
+			fprintf(stderr, "failed to parse nested rate attributes!\n");
 		} else {
 			printf("\n\ttx bitrate:\t");
 			if (rinfo[NL80211_RATE_INFO_BITRATE]) {
@@ -127,7 +127,7 @@
 		printf("\n\tmesh plid:\t%d",
 			nla_get_u16(sinfo[NL80211_STA_INFO_PLID]));
 	if (sinfo[NL80211_STA_INFO_PLINK_STATE]) {
-		switch (nla_get_u16(sinfo[NL80211_STA_INFO_PLINK_STATE])) {
+		switch (nla_get_u8(sinfo[NL80211_STA_INFO_PLINK_STATE])) {
 		case LISTEN:
 			strcpy(state_name, "LISTEN");
 			break;
@@ -196,7 +196,7 @@
 	NL80211_CMD_DEL_STATION, 0, CIB_NETDEV, handle_station_get,
 	"Remove the given station entry (use with caution!)");
 
-static int handle_station_set(struct nl80211_state *state,
+static int handle_station_set_plink(struct nl80211_state *state,
 			      struct nl_cb *cb,
 			      struct nl_msg *msg,
 			      int argc, char **argv)
@@ -241,8 +241,55 @@
 	return -ENOBUFS;
 }
 COMMAND(station, set, "<MAC address> plink_action <open|block>",
-	NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set,
+	NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_plink,
 	"Set mesh peer link action for this station (peer).");
+
+static int handle_station_set_vlan(struct nl80211_state *state,
+			      struct nl_cb *cb,
+			      struct nl_msg *msg,
+			      int argc, char **argv)
+{
+	unsigned char mac_addr[ETH_ALEN];
+	unsigned long sta_vlan = 0;
+	char *err = NULL;
+
+	if (argc < 3)
+		return 1;
+
+	if (mac_addr_a2n(mac_addr, argv[0])) {
+		fprintf(stderr, "invalid mac address\n");
+		return 2;
+	}
+	argc--;
+	argv++;
+
+	if (strcmp("vlan", argv[0]) != 0)
+		return 1;
+	argc--;
+	argv++;
+
+	sta_vlan = strtoul(argv[0], &err, 0);
+	if (err && *err) {
+		fprintf(stderr, "invalid vlan id\n");
+		return 2;
+	}
+	argc--;
+	argv++;
+
+	if (argc)
+		return 1;
+
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+	NLA_PUT_U32(msg, NL80211_ATTR_STA_VLAN, sta_vlan);
+
+	return 0;
+ nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(station, set, "<MAC address> vlan <ifindex>",
+	NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_vlan,
+	"Set an AP VLAN for this station.");
+
 
 static int handle_station_dump(struct nl80211_state *state,
 			       struct nl_cb *cb,

Added: iw/branches/upstream/current/survey.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/survey.c?rev=1450&op=file
==============================================================================
--- iw/branches/upstream/current/survey.c (added)
+++ iw/branches/upstream/current/survey.c Sun Nov 22 08:11:38 2009
@@ -1,0 +1,66 @@
+#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(survey);
+
+static int print_survey_handler(struct nl_msg *msg, void *arg)
+{
+	struct nlattr *tb[NL80211_ATTR_MAX + 1];
+	struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+	struct nlattr *sinfo[NL80211_SURVEY_INFO_MAX + 1];
+	char dev[20];
+
+	static struct nla_policy survey_policy[NL80211_SURVEY_INFO_MAX + 1] = {
+		[NL80211_SURVEY_INFO_FREQUENCY] = { .type = NLA_U32 },
+		[NL80211_SURVEY_INFO_NOISE] = { .type = NLA_U8 },
+	};
+
+	nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+		  genlmsg_attrlen(gnlh, 0), NULL);
+
+	if_indextoname(nla_get_u32(tb[NL80211_ATTR_IFINDEX]), dev);
+	printf("Survey data from %s\n", dev);
+
+	if (!tb[NL80211_ATTR_SURVEY_INFO]) {
+		fprintf(stderr, "survey data missing!\n");
+		return NL_SKIP;
+	}
+
+	if (nla_parse_nested(sinfo, NL80211_SURVEY_INFO_MAX,
+			     tb[NL80211_ATTR_SURVEY_INFO],
+			     survey_policy)) {
+		fprintf(stderr, "failed to parse nested attributes!\n");
+		return NL_SKIP;
+	}
+
+	if (sinfo[NL80211_SURVEY_INFO_FREQUENCY])
+		printf("\tfrequency:\t%u MHz\n",
+			nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]));
+	if (sinfo[NL80211_SURVEY_INFO_NOISE])
+		printf("\tnoise:\t\t%d dBm\n",
+			(int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_NOISE]));
+	return NL_SKIP;
+}
+
+static int handle_survey_dump(struct nl80211_state *state,
+			       struct nl_cb *cb,
+			       struct nl_msg *msg,
+			       int argc, char **argv)
+{
+	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_survey_handler, NULL);
+	return 0;
+}
+COMMAND(survey, dump, NULL,
+	NL80211_CMD_GET_SURVEY, NLM_F_DUMP, CIB_NETDEV, handle_survey_dump,
+	"List all gathered channel survey data");
+

Modified: iw/branches/upstream/current/util.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/util.c?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/util.c (original)
+++ iw/branches/upstream/current/util.c Sun Nov 22 08:11:38 2009
@@ -67,6 +67,69 @@
 		return ifmodes[iftype];
 	sprintf(modebuf, "Unknown mode (%d)", iftype);
 	return modebuf;
+}
+
+static const char *commands[NL80211_CMD_MAX + 1] = {
+	"unspecified",
+	"get_wiphy",
+	"set_wiphy",
+	"new_wiphy",
+	"del_wiphy",
+	"get_interface",
+	"set_interface",
+	"new_interface",
+	"del_interface",
+	"get_key",
+	"set_key",
+	"new_key",
+	"del_key",
+	"get_beacon",
+	"set_beacon",
+	"new_beacon",
+	"del_beacon",
+	"get_station",
+	"set_station",
+	"new_station",
+	"del_station",
+	"get_mpath",
+	"set_mpath",
+	"new_mpath",
+	"del_mpath",
+	"set_bss",
+	"set_reg",
+	"reg_set_reg",
+	"get_mesh_params",
+	"set_mesh_params",
+	"set_mgmt_extra_ie",
+	"get_reg",
+	"get_scan",
+	"trigger_scan",
+	"new_scan_results",
+	"scan_aborted",
+	"reg_change",
+	"authenticate",
+	"associate",
+	"deauthenticate",
+	"disassociate",
+	"michael_mic_failure",
+	"reg_beacon_hint",
+	"join_ibss",
+	"leave_ibss",
+	"testmode",
+	"connect",
+	"roam",
+	"disconnect",
+	"set_wiphy_netns"
+};
+
+static char cmdbuf[100];
+
+const char *command_name(enum nl80211_commands cmd)
+{
+	if (cmd <= NL80211_CMD_MAX)
+		return commands[cmd];
+	sprintf(cmdbuf, "Unknown command (%d)", cmd);
+	return cmdbuf;
 }
 
 int ieee80211_channel_to_frequency(int chan)

Modified: iw/branches/upstream/current/version.sh
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/version.sh?rev=1450&op=diff
==============================================================================
--- iw/branches/upstream/current/version.sh (original)
+++ iw/branches/upstream/current/version.sh Sun Nov 22 08:11:38 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-VERSION="0.9.17"
+VERSION="0.9.18"
 OUT="$1"
 
 echo '#include "iw.h"' > "$OUT"




More information about the Pkg-wpa-devel mailing list