[pkg-wpa-devel] r1358 - in /iw/trunk: debian/changelog info.c interface.c iw.c iw.h mesh.c mpath.c phy.c reg.c scan.c station.c util.c version.sh

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Sat Apr 18 12:27:10 UTC 2009


Author: kelmo-guest
Date: Sat Apr 18 12:27:10 2009
New Revision: 1358

URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1358
Log:
New upstream release.

Modified:
    iw/trunk/debian/changelog
    iw/trunk/info.c
    iw/trunk/interface.c
    iw/trunk/iw.c
    iw/trunk/iw.h
    iw/trunk/mesh.c
    iw/trunk/mpath.c
    iw/trunk/phy.c
    iw/trunk/reg.c
    iw/trunk/scan.c
    iw/trunk/station.c
    iw/trunk/util.c
    iw/trunk/version.sh

Modified: iw/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/debian/changelog?rev=1358&op=diff
==============================================================================
--- iw/trunk/debian/changelog (original)
+++ iw/trunk/debian/changelog Sat Apr 18 12:27:10 2009
@@ -1,3 +1,9 @@
+iw (0.9.12-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Kel Modderman <kel at otaku42.de>  Sat, 18 Apr 2009 22:25:58 +1000
+
 iw (0.9.11-1) unstable; urgency=low
 
   * New upstream release.

Modified: iw/trunk/info.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/info.c?rev=1358&op=diff
==============================================================================
--- iw/trunk/info.c (original)
+++ iw/trunk/info.c Sat Apr 18 12:27:10 2009
@@ -257,7 +257,8 @@
 	return NL_SKIP;
 }
 
-static int handle_info(struct nl_cb *cb,
+static int handle_info(struct nl80211_state *state,
+		       struct nl_cb *cb,
 		       struct nl_msg *msg,
 		       int argc, char **argv)
 {

Modified: iw/trunk/interface.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/interface.c?rev=1358&op=diff
==============================================================================
--- iw/trunk/interface.c (original)
+++ iw/trunk/interface.c Sat Apr 18 12:27:10 2009
@@ -123,7 +123,8 @@
 	return -1;
 }
 
-static int handle_interface_add(struct nl_cb *cb,
+static int handle_interface_add(struct nl80211_state *state,
+				struct nl_cb *cb,
 				struct nl_msg *msg,
 				int argc, char **argv)
 {
@@ -183,7 +184,8 @@
 COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [flags ...]",
 	NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add);
 
-static int handle_interface_del(struct nl_cb *cb,
+static int handle_interface_del(struct nl80211_state *state,
+				struct nl_cb *cb,
 				struct nl_msg *msg,
 				int argc, char **argv)
 {
@@ -210,7 +212,8 @@
 	return NL_SKIP;
 }
 
-static int handle_interface_info(struct nl_cb *cb,
+static int handle_interface_info(struct nl80211_state *state,
+				 struct nl_cb *cb,
 				 struct nl_msg *msg,
 				 int argc, char **argv)
 {
@@ -219,7 +222,8 @@
 }
 TOPLEVEL(info, NULL, NL80211_CMD_GET_INTERFACE, 0, CIB_NETDEV, handle_interface_info);
 
-static int handle_interface_set(struct nl_cb *cb,
+static int handle_interface_set(struct nl80211_state *state,
+				struct nl_cb *cb,
 				struct nl_msg *msg,
 				int argc, char **argv)
 {
@@ -246,7 +250,8 @@
 COMMAND(set, monitor, "<flag> [...]",
 	NL80211_CMD_SET_INTERFACE, 0, CIB_NETDEV, handle_interface_set);
 
-static int handle_interface_meshid(struct nl_cb *cb,
+static int handle_interface_meshid(struct nl80211_state *state,
+				   struct nl_cb *cb,
 				   struct nl_msg *msg,
 				   int argc, char **argv)
 {

Modified: iw/trunk/iw.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/iw.c?rev=1358&op=diff
==============================================================================
--- iw/trunk/iw.c (original)
+++ iw/trunk/iw.c Sat Apr 18 12:27:10 2009
@@ -117,22 +117,20 @@
 		switch (cmd->idby) {
 		case CIB_NONE:
 			fprintf(stderr, "\t");
-			/* fall through */
+			break;
 		case CIB_PHY:
-			if (cmd->idby == CIB_PHY)
-				fprintf(stderr, "\tphy <phyname> ");
-			/* fall through */
+			fprintf(stderr, "\tphy <phyname> ");
+			break;
 		case CIB_NETDEV:
-			if (cmd->idby == CIB_NETDEV)
-				fprintf(stderr, "\tdev <devname> ");
-			if (cmd->section)
-				fprintf(stderr, "%s ", cmd->section);
-			fprintf(stderr, "%s", cmd->name);
-			if (cmd->args)
-				fprintf(stderr, " %s", cmd->args);
-			fprintf(stderr, "\n");
+			fprintf(stderr, "\tdev <devname> ");
 			break;
 		}
+		if (cmd->section)
+			fprintf(stderr, "%s ", cmd->section);
+		fprintf(stderr, "%s", cmd->name);
+		if (cmd->args)
+			fprintf(stderr, " %s", cmd->args);
+		fprintf(stderr, "\n");
 	}
 }
 
@@ -180,28 +178,23 @@
 	return NL_STOP;
 }
 
-enum id_input {
-	II_NONE,
-	II_NETDEV,
-	II_PHY_NAME,
-	II_PHY_IDX,
-};
-
-static int handle_cmd(struct nl80211_state *state,
-		      enum id_input idby,
-		      int argc, char **argv)
-{
-	struct cmd *cmd;
-	struct nl_cb *cb = NULL;
+int handle_cmd(struct nl80211_state *state, enum id_input idby,
+	       int argc, char **argv)
+{
+	struct cmd *cmd, *match = NULL;
+	struct nl_cb *cb;
 	struct nl_msg *msg;
 	int devidx = 0;
-	int err;
+	int err, o_argc;
 	const char *command, *section;
-	char *tmp;
+	char *tmp, **o_argv;
 	enum command_identify_by command_idby = CIB_NONE;
 
 	if (argc <= 1 && idby != II_NONE)
 		return 1;
+
+	o_argc = argc;
+	o_argv = argv;
 
 	switch (idby) {
 	case II_PHY_IDX:
@@ -248,8 +241,11 @@
 				continue;
 			/* this is a bit icky ... */
 			if (command == section) {
-				if (argc <= 0)
+				if (argc <= 0) {
+					if (match)
+						break;
 					return 1;
+				}
 				command = *argv;
 				argc--;
 				argv++;
@@ -260,11 +256,20 @@
 			continue;
 		if (argc && !cmd->args)
 			continue;
-		break;
-	}
-
-	if (cmd >= &__stop___cmd)
+
+		match = cmd;
+	}
+
+	cmd = match;
+
+	if (!cmd)
 		return 1;
+
+	if (!cmd->cmd) {
+		argc = o_argc;
+		argv = o_argv;
+		return cmd->handler(state, NULL, NULL, argc, argv);
+	}
 
 	msg = nlmsg_alloc();
 	if (!msg) {
@@ -293,7 +298,7 @@
 		break;
 	}
 
-	err = cmd->handler(cb, msg, argc, argv);
+	err = cmd->handler(state, cb, msg, argc, argv);
 	if (err)
 		goto out;
 
@@ -394,11 +399,33 @@
 	return NL_SKIP;
 }
 
-static int listen_events(struct nl80211_state *state,
-			 int argc, char **argv)
+struct wait_event {
+	int n_cmds;
+	const __u32 *cmds;
+	__u32 cmd;
+};
+
+static int wait_event(struct nl_msg *msg, void *arg)
+{
+	struct wait_event *wait = arg;
+	struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+	int i;
+
+	for (i = 0; i < wait->n_cmds; i++) {
+		if (gnlh->cmd == wait->cmds[i]) {
+			wait->cmd = gnlh->cmd;
+		}
+	}
+
+	return NL_SKIP;
+}
+
+__u32 listen_events(struct nl80211_state *state,
+		    const int n_waits, const __u32 *waits)
 {
 	int mcid, ret;
 	struct nl_cb *cb = nl_cb_alloc(debug ? NL_CB_DEBUG : NL_CB_DEFAULT);
+	struct wait_event wait_ev;
 
 	if (!cb) {
 		fprintf(stderr, "failed to allocate netlink callbacks\n");
@@ -432,14 +459,23 @@
 
 	/* no sequence checking for multicast messages */
 	nl_cb_set(cb, NL_CB_SEQ_CHECK, NL_CB_CUSTOM, no_seq_check, NULL);
-	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_event, NULL);
-
-	while (1)
+
+	if (n_waits && waits) {
+		wait_ev.cmds = waits;
+		wait_ev.n_cmds = n_waits;
+		nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, wait_event, &wait_ev);
+	} else {
+		nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_event, NULL);
+	}
+
+	wait_ev.cmd = 0;
+
+	while (!wait_ev.cmd)
 		nl_recvmsgs(state->nl_sock, cb);
 
 	nl_cb_put(cb);
 
-	return 0;
+	return wait_ev.cmd;
 }
 
 int main(int argc, char **argv)
@@ -476,7 +512,10 @@
 		return 1;
 
 	if (strcmp(*argv, "event") == 0) {
-		err = listen_events(&nlstate, argc, argv);
+		if (argc != 1)
+			err = 1;
+		else
+			err = listen_events(&nlstate, 0, NULL);
 	} else if (strcmp(*argv, "dev") == 0) {
 		argc--;
 		argv++;

Modified: iw/trunk/iw.h
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/iw.h?rev=1358&op=diff
==============================================================================
--- iw/trunk/iw.h (original)
+++ iw/trunk/iw.h Sat Apr 18 12:27:10 2009
@@ -26,6 +26,13 @@
 	CIB_NETDEV,
 };
 
+enum id_input {
+	II_NONE,
+	II_NETDEV,
+	II_PHY_NAME,
+	II_PHY_IDX,
+};
+
 struct cmd {
 	const char *section;
 	const char *name;
@@ -39,7 +46,8 @@
 	 * zero on success, 1 if the arguments were wrong
 	 * and the usage message should and 2 otherwise.
 	 */
-	int (*handler)(struct nl_cb *cb,
+	int (*handler)(struct nl80211_state *state,
+		       struct nl_cb *cb,
 		       struct nl_msg *msg,
 		       int argc, char **argv);
 };
@@ -60,6 +68,13 @@
 extern struct cmd __start___cmd;
 extern struct cmd __stop___cmd;
 
+
+int handle_cmd(struct nl80211_state *state, enum id_input idby,
+	       int argc, char **argv);
+__u32 listen_events(struct nl80211_state *state,
+		    const int n_waits, const __u32 *waits);
+
+
 int mac_addr_a2n(unsigned char *mac_addr, char *arg);
 int mac_addr_n2a(char *mac_addr, unsigned char *arg);
 

Modified: iw/trunk/mesh.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/mesh.c?rev=1358&op=diff
==============================================================================
--- iw/trunk/mesh.c (original)
+++ iw/trunk/mesh.c Sat Apr 18 12:27:10 2009
@@ -205,9 +205,10 @@
 }
 
 /* Setter */
-static int set_interface_meshparam(struct nl_cb *cb,
-				struct nl_msg *msg,
-				int argc, char **argv)
+static int set_interface_meshparam(struct nl80211_state *state,
+				   struct nl_cb *cb,
+				   struct nl_msg *msg,
+				   int argc, char **argv)
 {
 	int err;
 	uint32_t ret;
@@ -272,9 +273,10 @@
 	return NL_SKIP;
 }
 
-static int get_interface_meshparam(struct nl_cb *cb,
-				struct nl_msg *msg,
-				int argc, char **argv)
+static int get_interface_meshparam(struct nl80211_state *state,
+				   struct nl_cb *cb,
+				   struct nl_msg *msg,
+				   int argc, char **argv)
 {
 	const struct mesh_param_descr *mdescr;
 

Modified: iw/trunk/mpath.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/mpath.c?rev=1358&op=diff
==============================================================================
--- iw/trunk/mpath.c (original)
+++ iw/trunk/mpath.c Sat Apr 18 12:27:10 2009
@@ -94,7 +94,8 @@
 	return NL_SKIP;
 }
 
-static int handle_mpath_get(struct nl_cb *cb,
+static int handle_mpath_get(struct nl80211_state *state,
+			    struct nl_cb *cb,
 			    struct nl_msg *msg,
 			    int argc, char **argv)
 {
@@ -126,7 +127,8 @@
 COMMAND(mpath, del, "<MAC address>",
 	NL80211_CMD_DEL_MPATH, 0, CIB_NETDEV, handle_mpath_get);
 
-static int handle_mpath_set(struct nl_cb *cb,
+static int handle_mpath_set(struct nl80211_state *state,
+			    struct nl_cb *cb,
 			    struct nl_msg *msg,
 			    int argc, char **argv)
 {
@@ -171,7 +173,8 @@
 COMMAND(mpath, set, "<destination MAC address> next_hop <next hop MAC address>",
 	NL80211_CMD_SET_MPATH, 0, CIB_NETDEV, handle_mpath_set);
 
-static int handle_mpath_dump(struct nl_cb *cb,
+static int handle_mpath_dump(struct nl80211_state *state,
+			     struct nl_cb *cb,
 			     struct nl_msg *msg,
 			     int argc, char **argv)
 {

Modified: iw/trunk/phy.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/phy.c?rev=1358&op=diff
==============================================================================
--- iw/trunk/phy.c (original)
+++ iw/trunk/phy.c Sat Apr 18 12:27:10 2009
@@ -11,7 +11,8 @@
 #include "nl80211.h"
 #include "iw.h"
 
-static int handle_name(struct nl_cb *cb,
+static int handle_name(struct nl80211_state *state,
+		       struct nl_cb *cb,
 		       struct nl_msg *msg,
 		       int argc, char **argv)
 {
@@ -67,7 +68,8 @@
 	return -ENOBUFS;
 }
 
-static int handle_freq(struct nl_cb *cb, struct nl_msg *msg,
+static int handle_freq(struct nl80211_state *state,
+		       struct nl_cb *cb, struct nl_msg *msg,
 		       int argc, char **argv)
 {
 	return handle_freqchan(msg, false, argc, argv);
@@ -77,7 +79,8 @@
 COMMAND(set, freq, "<freq> [HT20|HT40+|HT40-]",
 	NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_freq);
 
-static int handle_chan(struct nl_cb *cb, struct nl_msg *msg,
+static int handle_chan(struct nl80211_state *state,
+		       struct nl_cb *cb, struct nl_msg *msg,
 		       int argc, char **argv)
 {
 	return handle_freqchan(msg, true, argc, argv);

Modified: iw/trunk/reg.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/reg.c?rev=1358&op=diff
==============================================================================
--- iw/trunk/reg.c (original)
+++ iw/trunk/reg.c Sat Apr 18 12:27:10 2009
@@ -57,7 +57,8 @@
 	}
 }
 
-static int handle_reg_set(struct nl_cb *cb,
+static int handle_reg_set(struct nl80211_state *state,
+			  struct nl_cb *cb,
 			  struct nl_msg *msg,
 			  int argc, char **argv)
 {
@@ -175,7 +176,8 @@
 #undef PARSE_FLAG
 }
 
-static int handle_reg_get(struct nl_cb *cb,
+static int handle_reg_get(struct nl80211_state *state,
+			  struct nl_cb *cb,
 			  struct nl_msg *msg,
 			  int argc, char **argv)
 {

Modified: iw/trunk/scan.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/scan.c?rev=1358&op=diff
==============================================================================
--- iw/trunk/scan.c (original)
+++ iw/trunk/scan.c Sat Apr 18 12:27:10 2009
@@ -17,7 +17,8 @@
 	bool unknown;
 };
 
-static int handle_scan(struct nl_cb *cb,
+static int handle_scan(struct nl80211_state *state,
+		       struct nl_cb *cb,
 		       struct nl_msg *msg,
 		       int argc, char **argv)
 {
@@ -195,7 +196,8 @@
 
 static struct scan_params scan_params;
 
-static int handle_scan_dump(struct nl_cb *cb,
+static int handle_scan_dump(struct nl80211_state *state,
+			    struct nl_cb *cb,
 			    struct nl_msg *msg,
 			    int argc, char **argv)
 {
@@ -212,3 +214,40 @@
 }
 COMMAND(scan, dump, "[-u]",
 	NL80211_CMD_GET_SCAN, NLM_F_DUMP, CIB_NETDEV, handle_scan_dump);
+
+static int handle_scan_combined(struct nl80211_state *state,
+				struct nl_cb *cb,
+				struct nl_msg *msg,
+				int argc, char **argv)
+{
+	static char *trig_argv[] = {
+		NULL,
+		"scan",
+		"trigger",
+	};
+	static char *dump_argv[] = {
+		NULL,
+		"scan",
+		"dump",
+	};
+	static const __u32 cmds[] = {
+		NL80211_CMD_NEW_SCAN_RESULTS,
+		NL80211_CMD_SCAN_ABORTED,
+	};
+	int err;
+
+	trig_argv[0] = argv[0];
+	err = handle_cmd(state, II_NETDEV, ARRAY_SIZE(trig_argv), trig_argv);
+	if (err)
+		return err;
+
+	if (listen_events(state, ARRAY_SIZE(cmds), cmds) ==
+					NL80211_CMD_SCAN_ABORTED) {
+		printf("scan aborted!\n");
+		return 0;
+	}
+
+	dump_argv[0] = argv[0];
+	return handle_cmd(state, II_NETDEV, ARRAY_SIZE(dump_argv), dump_argv);
+}
+TOPLEVEL(scan, NULL, 0, 0, CIB_NETDEV, handle_scan_combined);

Modified: iw/trunk/station.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/station.c?rev=1358&op=diff
==============================================================================
--- iw/trunk/station.c (original)
+++ iw/trunk/station.c Sat Apr 18 12:27:10 2009
@@ -158,7 +158,8 @@
 	return NL_SKIP;
 }
 
-static int handle_station_get(struct nl_cb *cb,
+static int handle_station_get(struct nl80211_state *state,
+			      struct nl_cb *cb,
 			      struct nl_msg *msg,
 			      int argc, char **argv)
 {
@@ -191,7 +192,8 @@
 COMMAND(station, del, "<MAC address>",
 	NL80211_CMD_DEL_STATION, 0, CIB_NETDEV, handle_station_get);
 
-static int handle_station_set(struct nl_cb *cb,
+static int handle_station_set(struct nl80211_state *state,
+			      struct nl_cb *cb,
 			      struct nl_msg *msg,
 			      int argc, char **argv)
 {
@@ -237,7 +239,8 @@
 COMMAND(station, set, "<MAC address> plink_action <open|block>",
 	NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set);
 
-static int handle_station_dump(struct nl_cb *cb,
+static int handle_station_dump(struct nl80211_state *state,
+			       struct nl_cb *cb,
 			       struct nl_msg *msg,
 			       int argc, char **argv)
 {

Modified: iw/trunk/util.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/util.c?rev=1358&op=diff
==============================================================================
--- iw/trunk/util.c (original)
+++ iw/trunk/util.c Sat Apr 18 12:27:10 2009
@@ -1,5 +1,5 @@
+#include "iw.h"
 #include "nl80211.h"
-#include "iw.h"
 
 int mac_addr_n2a(char *mac_addr, unsigned char *arg)
 {

Modified: iw/trunk/version.sh
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/version.sh?rev=1358&op=diff
==============================================================================
--- iw/trunk/version.sh (original)
+++ iw/trunk/version.sh Sat Apr 18 12:27:10 2009
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-VERSION="0.9.11"
+VERSION="0.9.12"
 OUT="version.h"
 
 if head=`git rev-parse --verify HEAD 2>/dev/null`; then




More information about the Pkg-wpa-devel mailing list