[pkg-wpa-devel] r1424 - in /iw/trunk: Makefile connect.c debian/changelog debian/control event.c ibss.c info.c interface.c iw.c iw.h link.c mpath.c phy.c reg.c scan.c sections.c station.c util.c version.sh
kelmo-guest at users.alioth.debian.org
kelmo-guest at users.alioth.debian.org
Thu Sep 3 21:29:12 UTC 2009
Author: kelmo-guest
Date: Thu Sep 3 21:29:12 2009
New Revision: 1424
URL: http://svn.debian.org/wsvn/pkg-wpa/?sc=1&rev=1424
Log:
Bump S-V and import new upstream.
Added:
iw/trunk/link.c
- copied unchanged from r1423, iw/branches/upstream/current/link.c
iw/trunk/sections.c
- copied unchanged from r1423, iw/branches/upstream/current/sections.c
Modified:
iw/trunk/Makefile
iw/trunk/connect.c
iw/trunk/debian/changelog
iw/trunk/debian/control
iw/trunk/event.c
iw/trunk/ibss.c
iw/trunk/info.c
iw/trunk/interface.c
iw/trunk/iw.c
iw/trunk/iw.h
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/Makefile
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/Makefile?rev=1424&op=diff
==============================================================================
--- iw/trunk/Makefile (original)
+++ iw/trunk/Makefile Thu Sep 3 21:29:12 2009
@@ -14,7 +14,11 @@
CFLAGS ?= -O2 -g
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 mesh.o mpath.o scan.o reg.o version.o reason.o status.o connect.o
+OBJS = iw.o genl.o event.o info.o phy.o \
+ interface.o ibss.o station.o util.o \
+ mesh.o mpath.o scan.o reg.o version.o \
+ reason.o status.o connect.o link.o
+OBJS += sections.o
ALL = iw
NL1FOUND := $(shell $(PKG_CONFIG) --atleast-version=1 libnl-1 && echo Y)
Modified: iw/trunk/connect.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/connect.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/connect.c (original)
+++ iw/trunk/connect.c Thu Sep 3 21:29:12 2009
@@ -67,7 +67,6 @@
TOPLEVEL(disconnect, NULL,
NL80211_CMD_DISCONNECT, 0, CIB_NETDEV, disconnect,
"Disconnect from the current network.");
-HIDDEN(conn, establish, "", NL80211_CMD_CONNECT, 0, CIB_NETDEV, iw_conn);
static int iw_connect(struct nl80211_state *state, struct nl_cb *cb,
struct nl_msg *msg, int argc, char **argv)
@@ -97,7 +96,7 @@
if (!conn_argv)
return -ENOMEM;
conn_argv[0] = dev;
- conn_argv[1] = "conn";
+ conn_argv[1] = "connect";
conn_argv[2] = "establish";
for (i = 0; i < argc; i++)
conn_argv[i + 3] = argv[i];
@@ -138,3 +137,4 @@
0, 0, CIB_NETDEV, iw_connect,
"Join the network with the given SSID (and frequency, BSSID).\n"
"With -w, wait for the connect to finish or fail.");
+HIDDEN(connect, establish, "", NL80211_CMD_CONNECT, 0, CIB_NETDEV, iw_conn);
Modified: iw/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/debian/changelog?rev=1424&op=diff
==============================================================================
--- iw/trunk/debian/changelog (original)
+++ iw/trunk/debian/changelog Thu Sep 3 21:29:12 2009
@@ -1,9 +1,9 @@
-iw (0.9.15-1) UNRELEASED; urgency=low
+iw (0.9.17-1) UNRELEASED; urgency=low
- * New upstream release.
- * Bump Standards-Version to 3.8.2, no other changes required.
+ * New upstream release
+ * Bump Standards-Version to 3.8.3, no other changes required.
- -- Kel Modderman <kel at otaku42.de> Tue, 21 Jul 2009 20:01:47 +1000
+ -- Kel Modderman <kel at otaku42.de> Fri, 04 Sep 2009 07:28:37 +1000
iw (0.9.14-1) unstable; urgency=low
Modified: iw/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/debian/control?rev=1424&op=diff
==============================================================================
--- iw/trunk/debian/control (original)
+++ iw/trunk/debian/control Thu Sep 3 21:29:12 2009
@@ -8,7 +8,7 @@
Build-Depends: debhelper (>= 7),
libnl-dev (>= 1.1),
pkg-config (>= 0.22)
-Standards-Version: 3.8.2
+Standards-Version: 3.8.3
Vcs-Svn: svn://svn.debian.org/pkg-wpa/iw/trunk
Vcs-Browser: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/
Homepage: http://wireless.kernel.org/en/users/Documentation/iw
Modified: iw/trunk/event.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/event.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/event.c (original)
+++ iw/trunk/event.c Thu Sep 3 21:29:12 2009
@@ -7,6 +7,38 @@
static int no_seq_check(struct nl_msg *msg, void *arg)
{
return NL_OK;
+}
+
+struct ieee80211_beacon_channel {
+ __u16 center_freq;
+ bool passive_scan;
+ bool no_ibss;
+};
+
+static int parse_beacon_hint_chan(struct nlattr *tb,
+ struct ieee80211_beacon_channel *chan)
+{
+ 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 },
+ };
+
+ if (nla_parse_nested(tb_freq,
+ NL80211_FREQUENCY_ATTR_MAX,
+ tb,
+ beacon_freq_policy))
+ return -EINVAL;
+
+ 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])
+ chan->no_ibss = true;
+
+ return 0;
}
static void print_frame(struct print_event_args *args, struct nlattr *attr)
@@ -70,12 +102,21 @@
static int print_event(struct nl_msg *msg, void *arg)
{
+#define PARSE_BEACON_CHAN(_attr, _chan) do { \
+ r = parse_beacon_hint_chan(tb[_attr], \
+ &_chan); \
+ if (r) \
+ return NL_SKIP; \
+} while (0)
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
struct nlattr *tb[NL80211_ATTR_MAX + 1], *nst;
struct print_event_args *args = arg;
char ifname[100];
char macbuf[6*3];
__u8 reg_type;
+ struct ieee80211_beacon_channel chan_before_beacon, chan_after_beacon;
+ __u32 wiphy_idx = 0;
+ int r;
int rem_nst;
__u16 status;
@@ -159,6 +200,33 @@
printf("\n");
break;
+ case NL80211_CMD_REG_BEACON_HINT:
+
+ wiphy_idx = nla_get_u32(tb[NL80211_ATTR_WIPHY]);
+
+ memset(&chan_before_beacon, 0, sizeof(chan_before_beacon));
+ memset(&chan_after_beacon, 0, sizeof(chan_after_beacon));
+
+ PARSE_BEACON_CHAN(NL80211_ATTR_FREQ_BEFORE, chan_before_beacon);
+ PARSE_BEACON_CHAN(NL80211_ATTR_FREQ_AFTER, chan_after_beacon);
+
+ if (chan_before_beacon.center_freq != chan_after_beacon.center_freq)
+ break;
+
+ /* A beacon hint is sent _only_ if something _did_ change */
+ printf("beacon hint:\n");
+
+ printf("phy%d %d MHz [%d]:\n",
+ wiphy_idx,
+ 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");
+
+ break;
case NL80211_CMD_JOIN_IBSS:
mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
printf("IBSS %s joined\n", macbuf);
@@ -236,6 +304,7 @@
}
return NL_SKIP;
+#undef PARSE_BEACON_CHAN
}
struct wait_event {
Modified: iw/trunk/ibss.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/ibss.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/ibss.c (original)
+++ iw/trunk/ibss.c Thu Sep 3 21:29:12 2009
@@ -8,6 +8,8 @@
#include "nl80211.h"
#include "iw.h"
+
+SECTION(ibss);
static int join_ibss(struct nl80211_state *state,
struct nl_cb *cb,
Modified: iw/trunk/info.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/info.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/info.c (original)
+++ iw/trunk/info.c Thu Sep 3 21:29:12 2009
@@ -159,8 +159,8 @@
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 << 3) | (1 << 4))) + 1;
- tx_unequal_modulation = !!(mcs[12] & (1 << 5));
+ 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);
@@ -247,6 +247,22 @@
printf("\tmax # scan SSIDs: %d\n",
nla_get_u8(tb_msg[NL80211_ATTR_MAX_NUM_SCAN_SSIDS]));
+ if (tb_msg[NL80211_ATTR_WIPHY_FRAG_THRESHOLD]) {
+ unsigned int frag;
+
+ frag = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_FRAG_THRESHOLD]);
+ if (frag != (unsigned int)-1)
+ printf("\tFragmentation threshold: %d\n", frag);
+ }
+
+ if (tb_msg[NL80211_ATTR_WIPHY_RTS_THRESHOLD]) {
+ unsigned int rts;
+
+ rts = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_RTS_THRESHOLD]);
+ if (rts != (unsigned int)-1)
+ printf("\tRTS threshold: %d\n", rts);
+ }
+
if (!tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES])
return NL_SKIP;
@@ -266,7 +282,7 @@
return 0;
}
-TOPLEVEL(info, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_PHY, handle_info,
+__COMMAND(NULL, info, "info", NULL, NL80211_CMD_GET_WIPHY, 0, 0, CIB_PHY, handle_info,
"Show capabilities for the specified wireless device.");
TOPLEVEL(list, NULL, NL80211_CMD_GET_WIPHY, NLM_F_DUMP, CIB_NONE, handle_info,
"List all wireless devices and their capabilities.");
Modified: iw/trunk/interface.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/interface.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/interface.c (original)
+++ iw/trunk/interface.c Thu Sep 3 21:29:12 2009
@@ -17,6 +17,8 @@
"control: show control frames\n"\
"otherbss: show frames from other BSSes\n"\
"cook: use cooked mode"
+
+SECTION(interface);
static char *mntr_flags[NL80211_MNTR_FLAG_MAX + 1] = {
"none",
Modified: iw/trunk/iw.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/iw.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/iw.c (original)
+++ iw/trunk/iw.c Thu Sep 3 21:29:12 2009
@@ -94,33 +94,38 @@
nl_socket_free(state->nl_sock);
}
-__COMMAND(NULL, NULL, "", NULL, 0, 0, 0, CIB_NONE, NULL, NULL);
-__COMMAND(NULL, NULL, "", NULL, 1, 0, 0, CIB_NONE, NULL, NULL);
-
static int cmd_size;
-static void __usage_cmd(struct cmd *cmd, char *indent, bool full)
+extern struct cmd __start___cmd;
+extern struct cmd __stop___cmd;
+
+#define for_each_cmd(_cmd) \
+ for (_cmd = &__start___cmd; _cmd < &__stop___cmd; \
+ _cmd = (const struct cmd *)((char *)_cmd + cmd_size))
+
+
+static void __usage_cmd(const struct cmd *cmd, char *indent, bool full)
{
const char *start, *lend, *end;
- fprintf(stderr, "%s", indent);
+ printf("%s", indent);
switch (cmd->idby) {
case CIB_NONE:
break;
case CIB_PHY:
- fprintf(stderr, "phy <phyname> ");
+ printf("phy <phyname> ");
break;
case CIB_NETDEV:
- fprintf(stderr, "dev <devname> ");
- break;
- }
- if (cmd->section)
- fprintf(stderr, "%s ", cmd->section);
- fprintf(stderr, "%s", cmd->name);
+ printf("dev <devname> ");
+ break;
+ }
+ if (cmd->parent && cmd->parent->name)
+ printf("%s ", cmd->parent->name);
+ printf("%s", cmd->name);
if (cmd->args)
- fprintf(stderr, " %s", cmd->args);
- fprintf(stderr, "\n");
+ printf(" %s", cmd->args);
+ printf("\n");
if (!full || !cmd->help)
return;
@@ -129,7 +134,7 @@
if (strlen(indent))
indent = "\t\t";
else
- fprintf(stderr, "\n");
+ printf("\n");
/* print line by line */
start = cmd->help;
@@ -138,40 +143,51 @@
lend = strchr(start, '\n');
if (!lend)
lend = end;
- fprintf(stderr, "%s", indent);
- fprintf(stderr, "%.*s\n", (int)(lend - start), start);
+ printf("%s", indent);
+ printf("%.*s\n", (int)(lend - start), start);
start = lend + 1;
} while (end != lend);
- fprintf(stderr, "\n");
+ printf("\n");
}
static void usage_options(void)
{
- fprintf(stderr, "Options:\n");
- fprintf(stderr, "\t--debug\t\tenable netlink debugging\n");
+ printf("Options:\n");
+ printf("\t--debug\t\tenable netlink debugging\n");
}
static const char *argv0;
static void usage(bool full)
{
- struct cmd *cmd;
-
- fprintf(stderr, "Usage:\t%s [options] command\n", argv0);
+ const struct cmd *section, *cmd;
+
+ printf("Usage:\t%s [options] command\n", argv0);
usage_options();
- fprintf(stderr, "\t--version\tshow version (%s)\n", iw_version);
- fprintf(stderr, "Commands:\n");
- for (cmd = &__start___cmd; cmd < &__stop___cmd;
- cmd = (struct cmd *)((char *)cmd + cmd_size)) {
- if (!cmd->handler || cmd->hidden)
+ printf("\t--version\tshow version (%s)\n", iw_version);
+ printf("Commands:\n");
+ for_each_cmd(section) {
+ if (section->parent)
continue;
- __usage_cmd(cmd, "\t", full);
- }
- fprintf(stderr, "\nYou can omit the 'phy' or 'dev' if "
+
+ if (section->handler && !section->hidden)
+ __usage_cmd(section, "\t", full);
+
+ for_each_cmd(cmd) {
+ if (section != cmd->parent)
+ continue;
+ if (!cmd->handler || cmd->hidden)
+ continue;
+ __usage_cmd(cmd, "\t", full);
+ }
+ }
+ printf("\nYou can omit the 'phy' or 'dev' if "
"the identification is unique,\n"
"e.g. \"iw wlan0 info\" or \"iw phy0 info\". "
- "(Don't when scripting.)\n\n");
+ "(Don't when scripting.)\n\n"
+ "Do NOT screenscrape this tool, we don't "
+ "consider its output stable.\n\n");
}
static int print_help(struct nl80211_state *state,
@@ -184,9 +200,9 @@
TOPLEVEL(help, NULL, 0, 0, CIB_NONE, print_help,
"Print usage for each command.");
-static void usage_cmd(struct cmd *cmd)
-{
- fprintf(stderr, "Usage:\t%s [options] ", argv0);
+static void usage_cmd(const struct cmd *cmd)
+{
+ printf("Usage:\t%s [options] ", argv0);
__usage_cmd(cmd, "", true);
usage_options();
}
@@ -236,9 +252,9 @@
}
static int __handle_cmd(struct nl80211_state *state, enum id_input idby,
- int argc, char **argv, struct cmd **cmdout)
-{
- struct cmd *cmd, *match = NULL;
+ int argc, char **argv, const struct cmd **cmdout)
+{
+ const struct cmd *cmd, *match = NULL, *sectcmd;
struct nl_cb *cb;
struct nl_msg *msg;
int devidx = 0;
@@ -283,44 +299,61 @@
if (devidx < 0)
return -errno;
- section = command = *argv;
+ section = *argv;
argc--;
argv++;
- for (cmd = &__start___cmd; cmd < &__stop___cmd;
- cmd = (struct cmd *)((char *)cmd + cmd_size)) {
+ for_each_cmd(sectcmd) {
+ if (sectcmd->parent)
+ continue;
+ /* ok ... bit of a hack for the dupe 'info' section */
+ if (match && sectcmd->idby != command_idby)
+ continue;
+ if (strcmp(sectcmd->name, section) == 0)
+ match = sectcmd;
+ }
+
+ sectcmd = match;
+ match = NULL;
+ if (!sectcmd)
+ return 1;
+
+ if (argc > 0) {
+ command = *argv;
+
+ for_each_cmd(cmd) {
+ if (!cmd->handler)
+ continue;
+ if (cmd->parent != sectcmd)
+ continue;
+ if (cmd->idby != command_idby)
+ continue;
+ if (strcmp(cmd->name, command))
+ continue;
+ if (argc > 1 && !cmd->args)
+ continue;
+ match = cmd;
+ break;
+ }
+
+ if (match) {
+ argc--;
+ argv++;
+ }
+ }
+
+ if (match)
+ cmd = match;
+ else {
+ /* Use the section itself, if possible. */
+ cmd = sectcmd;
+ if (argc && !cmd->args)
+ return 1;
+ if (cmd->idby != command_idby)
+ return 1;
if (!cmd->handler)
- continue;
- if (cmd->idby != command_idby)
- continue;
- if (cmd->section) {
- if (strcmp(cmd->section, section))
- continue;
- /* this is a bit icky ... */
- if (command == section) {
- if (argc <= 0) {
- if (match)
- break;
- return 1;
- }
- command = *argv;
- argc--;
- argv++;
- }
- } else if (section != command)
- continue;
- if (strcmp(cmd->name, command))
- continue;
- if (argc && !cmd->args)
- continue;
-
- match = cmd;
- }
-
- cmd = match;
-
- if (!cmd)
- return 1;
+ return 1;
+ }
if (cmdout)
*cmdout = cmd;
@@ -394,11 +427,10 @@
{
struct nl80211_state nlstate;
int err;
- struct cmd *cmd = NULL;
+ const struct cmd *cmd = NULL;
/* calculate command size including padding */
- cmd_size = abs((long)&__cmd_NULL_NULL_1_CIB_NONE_0
- - (long)&__cmd_NULL_NULL_0_CIB_NONE_0);
+ cmd_size = abs((long)&__section_set - (long)&__section_get);
/* strip off self */
argc--;
argv0 = *argv++;
Modified: iw/trunk/iw.h
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/iw.h?rev=1424&op=diff
==============================================================================
--- iw/trunk/iw.h (original)
+++ iw/trunk/iw.h Thu Sep 3 21:29:12 2009
@@ -35,7 +35,6 @@
};
struct cmd {
- const char *section;
const char *name;
const char *args;
const char *help;
@@ -52,6 +51,7 @@
struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv);
+ const struct cmd *parent;
};
#define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
@@ -60,7 +60,6 @@
static const struct cmd \
__cmd ## _ ## _symname ## _ ## _handler ## _ ## _nlcmd ## _ ## _idby ## _ ## _hidden\
__attribute__((used)) __attribute__((section("__cmd"))) = { \
- .section = (_section), \
.name = (_name), \
.args = (_args), \
.cmd = (_nlcmd), \
@@ -69,15 +68,34 @@
.idby = (_idby), \
.handler = (_handler), \
.help = (_help), \
+ .parent = _section, \
}
#define COMMAND(section, name, args, cmd, flags, idby, handler, help) \
- __COMMAND(#section, name, #name, args, cmd, flags, 0, idby, handler, help)
+ __COMMAND(&(__section ## _ ## section), name, #name, args, cmd, flags, 0, idby, handler, help)
#define HIDDEN(section, name, args, cmd, flags, idby, handler) \
- __COMMAND(#section, name, #name, args, cmd, flags, 1, idby, handler, NULL)
-#define TOPLEVEL(name, args, cmd, flags, idby, handler, help) \
- __COMMAND(NULL, name, #name, args, cmd, flags, 0, idby, handler, help)
-extern struct cmd __start___cmd;
-extern struct cmd __stop___cmd;
+ __COMMAND(&(__section ## _ ## section), name, #name, args, cmd, flags, 1, idby, handler, NULL)
+
+#define TOPLEVEL(_name, _args, _nlcmd, _flags, _idby, _handler, _help) \
+ const struct cmd \
+ __section ## _ ## _name \
+ __attribute__((used)) __attribute__((section("__cmd"))) = { \
+ .name = (#_name), \
+ .args = (_args), \
+ .cmd = (_nlcmd), \
+ .nl_msg_flags = (_flags), \
+ .idby = (_idby), \
+ .handler = (_handler), \
+ .help = (_help), \
+ }
+#define SECTION(_name) \
+ const struct cmd __section ## _ ## _name \
+ __attribute__((used)) __attribute__((section("__cmd"))) = { \
+ .name = (#_name), \
+ .hidden = 1, \
+ }
+
+#define DECLARE_SECTION(_name) \
+ extern const struct cmd __section ## _ ## _name;
extern const char iw_version[];
@@ -98,7 +116,7 @@
int mac_addr_a2n(unsigned char *mac_addr, char *arg);
-int mac_addr_n2a(char *mac_addr, unsigned char *arg);
+void mac_addr_n2a(char *mac_addr, unsigned char *arg);
int parse_keys(struct nl_msg *msg, char **argv, int argc);
@@ -115,4 +133,18 @@
const char *get_reason_str(uint16_t reason);
const char *get_status_str(uint16_t status);
+enum print_ie_type {
+ PRINT_SCAN,
+ PRINT_LINK,
+};
+
+#define BIT(x) (1ULL<<(x))
+
+void print_ies(unsigned char *ie, int ielen, bool unknown,
+ enum print_ie_type ptype);
+
+
+DECLARE_SECTION(set);
+DECLARE_SECTION(get);
+
#endif /* __IW_H */
Modified: iw/trunk/mpath.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/mpath.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/mpath.c (original)
+++ iw/trunk/mpath.c Thu Sep 3 21:29:12 2009
@@ -10,6 +10,8 @@
#include "nl80211.h"
#include "iw.h"
+
+SECTION(mpath);
enum plink_state {
LISTEN,
Modified: iw/trunk/phy.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/phy.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/phy.c (original)
+++ iw/trunk/phy.c Thu Sep 3 21:29:12 2009
@@ -92,3 +92,51 @@
NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_chan, NULL);
COMMAND(set, channel, "<channel> [HT20|HT40+|HT40-]",
NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_chan, NULL);
+
+static int handle_fragmentation(struct nl80211_state *state,
+ struct nl_cb *cb, struct nl_msg *msg,
+ int argc, char **argv)
+{
+ unsigned int frag;
+
+ if (argc != 1)
+ return 1;
+
+ if (strcmp("off", argv[0]) == 0)
+ frag = -1;
+ else
+ frag = strtoul(argv[0], NULL, 10);
+
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, frag);
+
+ return 0;
+ nla_put_failure:
+ return -ENOBUFS;
+}
+COMMAND(set, frag, "<fragmentation threshold|off>",
+ NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_fragmentation,
+ "Set fragmentation threshold.");
+
+static int handle_rts(struct nl80211_state *state,
+ struct nl_cb *cb, struct nl_msg *msg,
+ int argc, char **argv)
+{
+ unsigned int rts;
+
+ if (argc != 1)
+ return 1;
+
+ if (strcmp("off", argv[0]) == 0)
+ rts = -1;
+ else
+ rts = strtoul(argv[0], NULL, 10);
+
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, rts);
+
+ return 0;
+ nla_put_failure:
+ return -ENOBUFS;
+}
+COMMAND(set, rts, "<rts threshold|off>",
+ NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_rts,
+ "Set rts threshold.");
Modified: iw/trunk/reg.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/reg.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/reg.c (original)
+++ iw/trunk/reg.c Thu Sep 3 21:29:12 2009
@@ -11,6 +11,8 @@
#include "nl80211.h"
#include "iw.h"
+
+SECTION(reg);
#define MHZ_TO_KHZ(freq) ((freq) * 1000)
#define KHZ_TO_MHZ(freq) ((freq) / 1000)
Modified: iw/trunk/scan.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/scan.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/scan.c (original)
+++ iw/trunk/scan.c Thu Sep 3 21:29:12 2009
@@ -32,6 +32,7 @@
struct scan_params {
bool unknown;
+ enum print_ie_type type;
};
static int handle_scan(struct nl80211_state *state,
@@ -107,10 +108,6 @@
nlmsg_free(freqs);
return err;
}
-COMMAND(scan, trigger, "[freq <freq>*] [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.");
static void tab_on_first(bool *first)
{
@@ -478,6 +475,7 @@
const char *name;
void (*print)(const uint8_t type, uint8_t len, const uint8_t *data);
uint8_t minlen, maxlen;
+ uint8_t flags;
};
static void print_ie(const struct ie_print *p, const uint8_t type,
@@ -513,21 +511,63 @@
}
static const struct ie_print ieprinters[] = {
- [0] = { "SSID", print_ssid, 0, 32, },
- [1] = { "Supported rates", print_supprates, 0, 255, },
- [3] = { "DS Paramater set", print_ds, 1, 1, },
+ [0] = { "SSID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
+ [1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
+ [3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
[5] = PRINT_IGN,
- [7] = { "Country", print_country, 3, 255, },
- [32] = { "Power constraint", print_powerconstraint, 1, 1, },
- [42] = { "ERP", print_erp, 1, 255, },
- [48] = { "RSN", print_rsn, 2, 255, },
- [50] = { "Extended supported rates", print_supprates, 0, 255, },
- [127] = { "Extended capabilities", print_capabilities, 0, 255, },
+ [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), },
+ [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), },
};
static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data)
{
print_rsn_ie("TKIP", "IEEE 802.1X", len, data);
+}
+
+static bool print_wifi_wmm_param(const uint8_t *data, uint8_t len)
+{
+ int i;
+ static const char *aci_tbl[] = { "BE", "BK", "VI", "VO" };
+
+ if (len < 19)
+ goto invalid;
+
+ if (data[0] != 1) {
+ printf("Parameter: not version 1: ");
+ return false;
+ }
+
+ printf("\t* Parameter version 1");
+
+ data++;
+
+ if (data[0] & 0x80)
+ 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]);
+ if (data[4] & 0x10)
+ printf(" acm");
+ printf(" CW %d-%d", (1 << (data[1] & 0xf)) - 1,
+ (1 << (data[1] >> 4)) - 1);
+ printf(", AIFSN %d", data[0] & 0xf);
+ if (data[2] | data[3])
+ printf(", TXOP %d usec", (data[2] + (data[3] << 8)) * 32);
+ data += 4;
+ }
+
+ printf("\n");
+ return true;
+
+ invalid:
+ printf("invalid: ");
+ return false;
}
static void print_wifi_wmm(const uint8_t type, uint8_t len, const uint8_t *data)
@@ -539,15 +579,16 @@
printf(" information:");
break;
case 0x01:
- printf(" parameter:");
+ if (print_wifi_wmm_param(data + 1, len - 1))
+ return;
break;
default:
printf(" type %d:", data[0]);
break;
}
- for(i = 0; i < len - 1; i++)
- printf(" %.02x", data[i + 1]);
+ for(i = 1; i < len; i++)
+ printf(" %.02x", data[i]);
printf("\n");
}
@@ -630,13 +671,13 @@
}
static const struct ie_print wifiprinters[] = {
- [1] = { "WPA", print_wifi_wpa, 2, 255, },
- [2] = { "WMM", print_wifi_wmm, 1, 255, },
- [4] = { "WPS", print_wifi_wps, 0, 255, },
+ [1] = { "WPA", print_wifi_wpa, 2, 255, BIT(PRINT_SCAN), },
+ [2] = { "WMM", print_wifi_wmm, 1, 255, BIT(PRINT_SCAN), },
+ [4] = { "WPS", print_wifi_wps, 0, 255, BIT(PRINT_SCAN), },
};
static void print_vendor(unsigned char len, unsigned char *data,
- struct scan_params *params)
+ bool unknown, enum print_ie_type ptype)
{
int i;
@@ -649,11 +690,13 @@
}
if (len >= 4 && memcmp(data, wifi_oui, 3) == 0) {
- if (data[3] < ARRAY_SIZE(wifiprinters) && wifiprinters[data[3]].name) {
+ if (data[3] < ARRAY_SIZE(wifiprinters) &&
+ wifiprinters[data[3]].name &&
+ wifiprinters[data[3]].flags & BIT(ptype)) {
print_ie(&wifiprinters[data[3]], data[3], len - 4, data + 4);
return;
}
- if (!params->unknown)
+ if (!unknown)
return;
printf("\tWiFi OUI %#.2x, data:", data[3]);
for(i = 0; i < len - 4; i++)
@@ -662,7 +705,7 @@
return;
}
- if (!params->unknown)
+ if (!unknown)
return;
printf("\tVendor specific: OUI %.2x:%.2x:%.2x, data:",
@@ -672,14 +715,17 @@
printf("\n");
}
-static void print_ies(unsigned char *ie, int ielen, struct scan_params *params)
+void print_ies(unsigned char *ie, int ielen, bool unknown,
+ enum print_ie_type ptype)
{
while (ielen >= 2 && ielen >= ie[1]) {
- if (ie[0] < ARRAY_SIZE(ieprinters) && ieprinters[ie[0]].name) {
+ if (ie[0] < ARRAY_SIZE(ieprinters) &&
+ ieprinters[ie[0]].name &&
+ ieprinters[ie[0]].flags & BIT(ptype)) {
print_ie(&ieprinters[ie[0]], ie[0], ie[1], ie + 2);
} else if (ie[0] == 221 /* vendor */) {
- print_vendor(ie[1], ie + 2, params);
- } else if (params->unknown) {
+ print_vendor(ie[1], ie + 2, unknown, ptype);
+ } else if (unknown) {
int i;
printf("\tUnknown IE (%d):", ie[0]);
@@ -709,6 +755,7 @@
[NL80211_BSS_SIGNAL_UNSPEC] = { .type = NLA_U8 },
[NL80211_BSS_STATUS] = { .type = NLA_U32 },
};
+ struct scan_params *params = arg;
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
genlmsg_attrlen(gnlh, 0), NULL);
@@ -801,7 +848,7 @@
if (bss[NL80211_BSS_INFORMATION_ELEMENTS])
print_ies(nla_data(bss[NL80211_BSS_INFORMATION_ELEMENTS]),
nla_len(bss[NL80211_BSS_INFORMATION_ELEMENTS]),
- arg);
+ params->unknown, params->type);
return NL_SKIP;
}
@@ -820,14 +867,12 @@
if (argc == 1 && !strcmp(argv[0], "-u"))
scan_params.unknown = true;
+ scan_params.type = PRINT_SCAN;
+
nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_bss_handler,
&scan_params);
return 0;
}
-COMMAND(scan, dump, "[-u]",
- 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.");
static int handle_scan_combined(struct nl80211_state *state,
struct nl_cb *cb,
@@ -906,3 +951,11 @@
"Scan on the given frequencies and probe for the given SSIDs\n"
"(or wildcard if not given) unless passive scanning is requested.\n"
"If -u is specified print unknown data in the scan results.");
+COMMAND(scan, dump, "[-u]",
+ 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>*] [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/trunk/station.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/station.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/station.c (original)
+++ iw/trunk/station.c Thu Sep 3 21:29:12 2009
@@ -10,6 +10,8 @@
#include "nl80211.h"
#include "iw.h"
+
+SECTION(station);
enum plink_state {
LISTEN,
@@ -80,19 +82,19 @@
printf("Station %s (on %s)", mac_addr, dev);
if (sinfo[NL80211_STA_INFO_INACTIVE_TIME])
- printf("\n\tinactive time:\t%d ms",
+ printf("\n\tinactive time:\t%u ms",
nla_get_u32(sinfo[NL80211_STA_INFO_INACTIVE_TIME]));
if (sinfo[NL80211_STA_INFO_RX_BYTES])
- printf("\n\trx bytes:\t%d",
+ printf("\n\trx bytes:\t%u",
nla_get_u32(sinfo[NL80211_STA_INFO_RX_BYTES]));
if (sinfo[NL80211_STA_INFO_RX_PACKETS])
- printf("\n\trx packets:\t%d",
+ printf("\n\trx packets:\t%u",
nla_get_u32(sinfo[NL80211_STA_INFO_RX_PACKETS]));
if (sinfo[NL80211_STA_INFO_TX_BYTES])
- printf("\n\ttx bytes:\t%d",
+ printf("\n\ttx bytes:\t%u",
nla_get_u32(sinfo[NL80211_STA_INFO_TX_BYTES]));
if (sinfo[NL80211_STA_INFO_TX_PACKETS])
- printf("\n\ttx packets:\t%d",
+ printf("\n\ttx packets:\t%u",
nla_get_u32(sinfo[NL80211_STA_INFO_TX_PACKETS]));
if (sinfo[NL80211_STA_INFO_SIGNAL])
printf("\n\tsignal: \t%d dBm",
Modified: iw/trunk/util.c
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/util.c?rev=1424&op=diff
==============================================================================
--- iw/trunk/util.c (original)
+++ iw/trunk/util.c Thu Sep 3 21:29:12 2009
@@ -5,7 +5,7 @@
#include "iw.h"
#include "nl80211.h"
-int mac_addr_n2a(char *mac_addr, unsigned char *arg)
+void mac_addr_n2a(char *mac_addr, unsigned char *arg)
{
int i, l;
@@ -19,7 +19,6 @@
l += 3;
}
}
- return 0;
}
int mac_addr_a2n(unsigned char *mac_addr, char *arg)
@@ -149,6 +148,7 @@
{
struct nlattr *keys;
int i = 0;
+ bool have_default = false;
char keybuf[13];
if (!argc)
@@ -174,6 +174,7 @@
pos++;
if (arg[pos] == ':')
pos++;
+ have_default = true;
}
if (!isdigit(arg[pos]))
@@ -204,9 +205,14 @@
NLA_PUT(msg, NL80211_KEY_DATA, keylen, keydata);
- nla_nest_end(msg, key);
argv++;
argc--;
+
+ /* one key should be TX key */
+ if (!have_default && !argc)
+ NLA_PUT_FLAG(msg, NL80211_KEY_DEFAULT);
+
+ nla_nest_end(msg, key);
} while (argc);
nla_nest_end(msg, keys);
Modified: iw/trunk/version.sh
URL: http://svn.debian.org/wsvn/pkg-wpa/iw/trunk/version.sh?rev=1424&op=diff
==============================================================================
--- iw/trunk/version.sh (original)
+++ iw/trunk/version.sh Thu Sep 3 21:29:12 2009
@@ -1,6 +1,6 @@
#!/bin/sh
-VERSION="0.9.15"
+VERSION="0.9.17"
OUT="$1"
echo '#include "iw.h"' > "$OUT"
More information about the Pkg-wpa-devel
mailing list