[pkg-wpa-devel] r1593 - in /iw/branches/upstream/current: Makefile bitrate.c event.c ibss.c info.c iw.c iw.h link.c nl80211.h phy.c scan.c util.c version.sh wowlan.c
slh-guest at users.alioth.debian.org
slh-guest at users.alioth.debian.org
Mon Jul 25 11:08:46 UTC 2011
Author: slh-guest
Date: Mon Jul 25 11:08:40 2011
New Revision: 1593
URL: http://svn.debian.org/wsvn/?sc=1&rev=1593
Log:
[svn-upgrade] new version iw (3.0)
Added:
iw/branches/upstream/current/wowlan.c
Modified:
iw/branches/upstream/current/Makefile
iw/branches/upstream/current/bitrate.c
iw/branches/upstream/current/event.c
iw/branches/upstream/current/ibss.c
iw/branches/upstream/current/info.c
iw/branches/upstream/current/iw.c
iw/branches/upstream/current/iw.h
iw/branches/upstream/current/link.c
iw/branches/upstream/current/nl80211.h
iw/branches/upstream/current/phy.c
iw/branches/upstream/current/scan.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=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/Makefile (original)
+++ iw/branches/upstream/current/Makefile Mon Jul 25 11:08:40 2011
@@ -18,7 +18,7 @@
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 offch.o ps.o cqm.o \
- bitrate.o
+ bitrate.o wowlan.o
OBJS += sections.o
ALL = iw
Modified: iw/branches/upstream/current/bitrate.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/bitrate.c?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/bitrate.c (original)
+++ iw/branches/upstream/current/bitrate.c Mon Jul 25 11:08:40 2011
@@ -137,4 +137,6 @@
#endif
COMMAND(set, bitrates, DESCR, NL80211_CMD_SET_TX_BITRATE_MASK, 0, CIB_NETDEV,
- handle_bitrates, "Sets up the specified rate masks.");
+ handle_bitrates,
+ "Sets up the specified rate masks.\n"
+ "Not passing any arguments would clear the existing mask (if any).");
Modified: iw/branches/upstream/current/event.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/event.c?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/event.c (original)
+++ iw/branches/upstream/current/event.c Mon Jul 25 11:08:40 2011
@@ -419,6 +419,11 @@
case NL80211_CMD_MICHAEL_MIC_FAILURE:
parse_mic_failure(tb);
break;
+ case NL80211_CMD_FRAME_TX_STATUS:
+ printf("mgmt TX status (cookie %llx): %s\n",
+ (unsigned long long)nla_get_u64(tb[NL80211_ATTR_COOKIE]),
+ tb[NL80211_ATTR_ACK] ? "acked" : "no ack");
+ break;
default:
printf("unknown event %d\n", gnlh->cmd);
break;
Modified: iw/branches/upstream/current/ibss.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/ibss.c?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/ibss.c (original)
+++ iw/branches/upstream/current/ibss.c Mon Jul 25 11:08:40 2011
@@ -104,7 +104,7 @@
if (*end != '\0')
return 1;
- NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, (int) rate * 10);
+ NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, (int)(rate * 10));
argv++;
argc--;
}
Modified: iw/branches/upstream/current/info.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/info.c?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/info.c (original)
+++ iw/branches/upstream/current/info.c Mon Jul 25 11:08:40 2011
@@ -183,7 +183,88 @@
if (tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES]) {
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));
+ printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
+ }
+
+ if (tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES]) {
+ printf("\tsoftware interface modes (can always be added):\n");
+ nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SOFTWARE_IFTYPES], rem_mode)
+ printf("\t\t * %s\n", iftype_name(nla_type(nl_mode)));
+ }
+
+ if (tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS]) {
+ struct nlattr *nl_combi;
+ int rem_combi;
+ bool have_combinations = false;
+
+ nla_for_each_nested(nl_combi, tb_msg[NL80211_ATTR_INTERFACE_COMBINATIONS], rem_combi) {
+ static struct nla_policy iface_combination_policy[NUM_NL80211_IFACE_COMB] = {
+ [NL80211_IFACE_COMB_LIMITS] = { .type = NLA_NESTED },
+ [NL80211_IFACE_COMB_MAXNUM] = { .type = NLA_U32 },
+ [NL80211_IFACE_COMB_STA_AP_BI_MATCH] = { .type = NLA_FLAG },
+ [NL80211_IFACE_COMB_NUM_CHANNELS] = { .type = NLA_U32 },
+ };
+ struct nlattr *tb_comb[NUM_NL80211_IFACE_COMB];
+ static struct nla_policy iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = {
+ [NL80211_IFACE_LIMIT_TYPES] = { .type = NLA_NESTED },
+ [NL80211_IFACE_LIMIT_MAX] = { .type = NLA_U32 },
+ };
+ struct nlattr *tb_limit[NUM_NL80211_IFACE_LIMIT];
+ struct nlattr *nl_limit;
+ int err, rem_limit;
+ bool comma = false;
+
+ if (!have_combinations) {
+ printf("\tvalid interface combinations:\n");
+ have_combinations = true;
+ }
+
+ printf("\t\t * ");
+
+ err = nla_parse_nested(tb_comb, MAX_NL80211_IFACE_COMB,
+ nl_combi, iface_combination_policy);
+ if (err || !tb_comb[NL80211_IFACE_COMB_LIMITS] ||
+ !tb_comb[NL80211_IFACE_COMB_MAXNUM] ||
+ !tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]) {
+ printf(" <failed to parse>\n");
+ goto broken_combination;
+ }
+
+ nla_for_each_nested(nl_limit, tb_comb[NL80211_IFACE_COMB_LIMITS], rem_limit) {
+ bool ift_comma = false;
+
+ err = nla_parse_nested(tb_limit, MAX_NL80211_IFACE_LIMIT,
+ nl_limit, iface_limit_policy);
+ if (err || !tb_limit[NL80211_IFACE_LIMIT_TYPES]) {
+ printf("<failed to parse>\n");
+ goto broken_combination;
+ }
+
+ if (comma)
+ printf(", ");
+ comma = true;
+ printf("#{");
+
+ nla_for_each_nested(nl_mode, tb_limit[NL80211_IFACE_LIMIT_TYPES], rem_mode) {
+ printf("%s %s", ift_comma ? "," : "",
+ iftype_name(nla_type(nl_mode)));
+ ift_comma = true;
+ }
+ printf(" } <= %u", nla_get_u32(tb_limit[NL80211_IFACE_LIMIT_MAX]));
+ }
+ printf(",\n\t\t ");
+
+ printf("total <= %d, #channels <= %d%s\n",
+ nla_get_u32(tb_comb[NL80211_IFACE_COMB_MAXNUM]),
+ nla_get_u32(tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]),
+ tb_comb[NL80211_IFACE_COMB_STA_AP_BI_MATCH] ?
+ ", STA/AP BI must match" : "");
+broken_combination:
+ ;
+ }
+
+ if (!have_combinations)
+ printf("\tinterface combinations are not supported\n");
}
if (tb_msg[NL80211_ATTR_SUPPORTED_COMMANDS]) {
@@ -222,6 +303,44 @@
}
}
+ if (tb_msg[NL80211_ATTR_SUPPORT_IBSS_RSN])
+ printf("\tDevice supports RSN-IBSS.\n");
+
+ if (tb_msg[NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED]) {
+ struct nlattr *tb_wowlan[NUM_NL80211_WOWLAN_TRIG];
+ static struct nla_policy wowlan_policy[NUM_NL80211_WOWLAN_TRIG] = {
+ [NL80211_WOWLAN_TRIG_ANY] = { .type = NLA_FLAG },
+ [NL80211_WOWLAN_TRIG_DISCONNECT] = { .type = NLA_FLAG },
+ [NL80211_WOWLAN_TRIG_MAGIC_PKT] = { .type = NLA_FLAG },
+ [NL80211_WOWLAN_TRIG_PKT_PATTERN] = {
+ .minlen = sizeof(struct nl80211_wowlan_pattern_support),
+ },
+ };
+ struct nl80211_wowlan_pattern_support *pat;
+ int err;
+
+ err = nla_parse_nested(tb_wowlan, MAX_NL80211_WOWLAN_TRIG,
+ tb_msg[NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED],
+ wowlan_policy);
+ printf("\tWoWLAN support:");
+ if (err) {
+ printf(" <failed to parse>\n");
+ } else {
+ printf("\n");
+ if (tb_wowlan[NL80211_WOWLAN_TRIG_ANY])
+ printf("\t\t * any (device continues operating)\n");
+ if (tb_wowlan[NL80211_WOWLAN_TRIG_DISCONNECT])
+ printf("\t\t * disconnect\n");
+ if (tb_wowlan[NL80211_WOWLAN_TRIG_MAGIC_PKT])
+ printf("\t\t * magic packet\n");
+ if (tb_wowlan[NL80211_WOWLAN_TRIG_PKT_PATTERN]) {
+ pat = nla_data(tb_wowlan[NL80211_WOWLAN_TRIG_PKT_PATTERN]);
+ printf("\t\t * up to %u patterns of %u-%u bytes\n",
+ pat->max_patterns, pat->min_pattern_len, pat->max_pattern_len);
+ }
+ }
+ }
+
return NL_SKIP;
}
Modified: iw/branches/upstream/current/iw.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/iw.c?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/iw.c (original)
+++ iw/branches/upstream/current/iw.c Mon Jul 25 11:08:40 2011
@@ -259,6 +259,7 @@
{
const struct cmd *cmd, *match = NULL, *sectcmd;
struct nl_cb *cb;
+ struct nl_cb *s_cb;
struct nl_msg *msg;
int devidx = 0;
int err, o_argc;
@@ -380,7 +381,8 @@
}
cb = nl_cb_alloc(iw_debug ? NL_CB_DEBUG : NL_CB_DEFAULT);
- if (!cb) {
+ s_cb = nl_cb_alloc(iw_debug ? NL_CB_DEBUG : NL_CB_DEFAULT);
+ if (!cb || !s_cb) {
fprintf(stderr, "failed to allocate netlink callbacks\n");
err = 2;
goto out_free_msg;
@@ -403,6 +405,8 @@
err = cmd->handler(state, cb, msg, argc, argv);
if (err)
goto out;
+
+ nl_socket_set_cb(state->nl_sock, s_cb);
err = nl_send_auto_complete(state->nl_sock, msg);
if (err < 0)
Modified: iw/branches/upstream/current/iw.h
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/iw.h?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/iw.h (original)
+++ iw/branches/upstream/current/iw.h Mon Jul 25 11:08:40 2011
@@ -56,6 +56,7 @@
};
#define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
+#define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
#define __COMMAND(_section, _symname, _name, _args, _nlcmd, _flags, _hidden, _idby, _handler, _help, _sel)\
static struct cmd \
@@ -127,6 +128,8 @@
int mac_addr_a2n(unsigned char *mac_addr, char *arg);
void mac_addr_n2a(char *mac_addr, unsigned char *arg);
+int parse_hex_mask(char *hexmask, unsigned char **result, size_t *result_len,
+ unsigned char **mask);
unsigned char *parse_hex(char *hex, size_t *outlen);
int parse_keys(struct nl_msg *msg, char **argv, int argc);
Modified: iw/branches/upstream/current/link.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/link.c?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/link.c (original)
+++ iw/branches/upstream/current/link.c Mon Jul 25 11:08:40 2011
@@ -115,6 +115,7 @@
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
struct nlattr *sinfo[NL80211_STA_INFO_MAX + 1];
struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1];
+ struct nlattr *binfo[NL80211_STA_BSS_PARAM_MAX + 1];
static struct nla_policy stats_policy[NL80211_STA_INFO_MAX + 1] = {
[NL80211_STA_INFO_INACTIVE_TIME] = { .type = NLA_U32 },
[NL80211_STA_INFO_RX_BYTES] = { .type = NLA_U32 },
@@ -134,6 +135,13 @@
[NL80211_RATE_INFO_40_MHZ_WIDTH] = { .type = NLA_FLAG },
[NL80211_RATE_INFO_SHORT_GI] = { .type = NLA_FLAG },
};
+ static struct nla_policy bss_policy[NL80211_STA_BSS_PARAM_MAX + 1] = {
+ [NL80211_STA_BSS_PARAM_CTS_PROT] = { .type = NLA_FLAG },
+ [NL80211_STA_BSS_PARAM_SHORT_PREAMBLE] = { .type = NLA_FLAG },
+ [NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME] = { .type = NLA_FLAG },
+ [NL80211_STA_BSS_PARAM_DTIM_PERIOD] = { .type = NLA_U8 },
+ [NL80211_STA_BSS_PARAM_BEACON_INTERVAL] = { .type = NLA_U16 },
+ };
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
genlmsg_attrlen(gnlh, 0), NULL);
@@ -182,6 +190,32 @@
}
}
+ if (sinfo[NL80211_STA_INFO_BSS_PARAM]) {
+ if (nla_parse_nested(binfo, NL80211_STA_BSS_PARAM_MAX,
+ sinfo[NL80211_STA_INFO_BSS_PARAM],
+ bss_policy)) {
+ fprintf(stderr, "failed to parse nested bss parameters!\n");
+ } else {
+ char *delim = "";
+ printf("\n\tbss flags:\t");
+ if (binfo[NL80211_STA_BSS_PARAM_CTS_PROT]) {
+ printf("CTS-protection");
+ delim = " ";
+ }
+ if (binfo[NL80211_STA_BSS_PARAM_SHORT_PREAMBLE]) {
+ printf("%sshort-preamble", delim);
+ delim = " ";
+ }
+ if (binfo[NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME])
+ printf("%sshort-slot-time", delim);
+ printf("\n\tdtim period:\t%d",
+ nla_get_u8(binfo[NL80211_STA_BSS_PARAM_DTIM_PERIOD]));
+ printf("\n\tbeacon int:\t%d",
+ nla_get_u16(binfo[NL80211_STA_BSS_PARAM_BEACON_INTERVAL]));
+ printf("\n");
+ }
+ }
+
return NL_SKIP;
}
Modified: iw/branches/upstream/current/nl80211.h
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/nl80211.h?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/nl80211.h (original)
+++ iw/branches/upstream/current/nl80211.h Mon Jul 25 11:08:40 2011
@@ -74,6 +74,39 @@
*
* For more technical details, see the corresponding command descriptions
* below.
+ */
+
+/**
+ * DOC: Virtual interface / concurrency capabilities
+ *
+ * Some devices are able to operate with virtual MACs, they can have
+ * more than one virtual interface. The capability handling for this
+ * is a bit complex though, as there may be a number of restrictions
+ * on the types of concurrency that are supported.
+ *
+ * To start with, each device supports the interface types listed in
+ * the %NL80211_ATTR_SUPPORTED_IFTYPES attribute, but by listing the
+ * types there no concurrency is implied.
+ *
+ * Once concurrency is desired, more attributes must be observed:
+ * To start with, since some interface types are purely managed in
+ * software, like the AP-VLAN type in mac80211 for example, there's
+ * an additional list of these, they can be added at any time and
+ * are only restricted by some semantic restrictions (e.g. AP-VLAN
+ * cannot be added without a corresponding AP interface). This list
+ * is exported in the %NL80211_ATTR_SOFTWARE_IFTYPES attribute.
+ *
+ * Further, the list of supported combinations is exported. This is
+ * in the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute. Basically,
+ * it exports a list of "groups", and at any point in time the
+ * interfaces that are currently active must fall into any one of
+ * the advertised groups. Within each group, there are restrictions
+ * on the number of interfaces of different types that are supported
+ * and also the number of different channels, along with potentially
+ * some other restrictions. See &enum nl80211_if_combination_attrs.
+ *
+ * All together, these attributes define the concurrency of virtual
+ * interfaces that a given device supports.
*/
/**
@@ -148,6 +181,10 @@
* @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to
* destination %NL80211_ATTR_MAC on the interface identified by
* %NL80211_ATTR_IFINDEX.
+ * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by
+ * %NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP.
+ * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by
+ * %NL80211_ATTR_MAC.
* @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the
* the interface identified by %NL80211_ATTR_IFINDEX.
* @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
@@ -198,6 +235,28 @@
* 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_START_SCHED_SCAN: start a scheduled scan at certain
+ * intervals, as specified by %NL80211_ATTR_SCHED_SCAN_INTERVAL.
+ * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
+ * are passed, they are used in the probe requests. For
+ * broadcast, a broadcast SSID must be passed (ie. an empty
+ * string). If no SSID is passed, no probe requests are sent and
+ * a passive scan is performed. %NL80211_ATTR_SCAN_FREQUENCIES,
+ * if passed, define which channels should be scanned; if not
+ * passed, all channels allowed for the current regulatory domain
+ * are used. Extra IEs can also be passed from the userspace by
+ * using the %NL80211_ATTR_IE attribute.
+ * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan
+ * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
+ * results available.
+ * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has
+ * stopped. The driver may issue this event at any time during a
+ * scheduled scan. One reason for stopping the scan is if the hardware
+ * does not support starting an association or a normal scan while running
+ * a scheduled scan. This event is also sent when the
+ * %NL80211_CMD_STOP_SCHED_SCAN command is received or when the interface
+ * is brought down while a scheduled scan was running.
*
* @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation
* or noise level
@@ -406,11 +465,29 @@
* notification. This event is used to indicate that an unprotected
* disassociation frame was dropped when MFP is in use.
*
+ * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a
+ * beacon or probe response from a compatible mesh peer. This is only
+ * sent while no station information (sta_info) exists for the new peer
+ * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH is set. On
+ * reception of this notification, userspace may decide to create a new
+ * station (@NL80211_CMD_NEW_STATION). To stop this notification from
+ * reoccurring, the userspace authentication daemon may want to create the
+ * new station with the AUTHENTICATED flag unset and maybe change it later
+ * depending on the authentication result.
+ *
+ * @NL80211_CMD_GET_WOWLAN: get Wake-on-Wireless-LAN (WoWLAN) settings.
+ * @NL80211_CMD_SET_WOWLAN: set Wake-on-Wireless-LAN (WoWLAN) settings.
+ * Since wireless is more complex than wired ethernet, it supports
+ * various triggers. These triggers can be configured through this
+ * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
+ * more background information, see
+ * http://wireless.kernel.org/en/users/Documentation/WoWLAN.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
enum nl80211_commands {
-/* don't change the order or add anything inbetween, this is ABI! */
+/* don't change the order or add anything between, this is ABI! */
NL80211_CMD_UNSPEC,
NL80211_CMD_GET_WIPHY, /* can dump */
@@ -517,6 +594,16 @@
NL80211_CMD_UNPROT_DEAUTHENTICATE,
NL80211_CMD_UNPROT_DISASSOCIATE,
+
+ NL80211_CMD_NEW_PEER_CANDIDATE,
+
+ NL80211_CMD_GET_WOWLAN,
+ NL80211_CMD_SET_WOWLAN,
+
+ NL80211_CMD_START_SCHED_SCAN,
+ NL80211_CMD_STOP_SCHED_SCAN,
+ NL80211_CMD_SCHED_SCAN_RESULTS,
+ NL80211_CMD_SCHED_SCAN_STOPPED,
/* add new commands above here */
@@ -541,6 +628,7 @@
/* source-level API compatibility */
#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG
#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG
+#define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE
/**
* enum nl80211_attrs - nl80211 netlink attributes
@@ -612,7 +700,7 @@
* consisting of a nested array.
*
* @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes).
- * @NL80211_ATTR_PLINK_ACTION: action to perform on the mesh peer link.
+ * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link.
* @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path.
* @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path
* info given for %NL80211_CMD_GET_MPATH, nested attribute described at
@@ -856,7 +944,7 @@
* This can be used to mask out antennas which are not attached or should
* not be used for receiving. If an antenna is not selected in this bitmap
* the hardware should not be configured to receive on this antenna.
- * For a more detailed descripton see @NL80211_ATTR_WIPHY_ANTENNA_TX.
+ * For a more detailed description see @NL80211_ATTR_WIPHY_ANTENNA_TX.
*
* @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX: Bitmap of antennas which are available
* for configuration as TX antennas via the above parameters.
@@ -879,13 +967,40 @@
* See &enum nl80211_key_default_types.
*
* @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters. These cannot be
- * changed once the mesh is active.
+ * changed once the mesh is active.
+ * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute
+ * containing attributes from &enum nl80211_meshconf_params.
+ * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver
+ * allows auth frames in a mesh to be passed to userspace for processing via
+ * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag.
+ * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as
+ * defined in &enum nl80211_plink_state. Used when userspace is
+ * driving the peer link management state machine.
+ * @NL80211_MESH_SETUP_USERSPACE_AMPE must be enabled.
+ *
+ * @NL80211_ATTR_WOWLAN_SUPPORTED: indicates, as part of the wiphy capabilities,
+ * the supported WoWLAN triggers
+ * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to
+ * indicate which WoW triggers should be enabled. This is also
+ * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN
+ * triggers.
+
+ * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan
+ * cycles, in msecs.
+ *
+ * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported
+ * interface combinations. In each nested item, it contains attributes
+ * defined in &enum nl80211_if_combination_attrs.
+ * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like
+ * %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that
+ * are managed in software: interfaces of these types aren't subject to
+ * any restrictions in their number or combinations.
*
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
enum nl80211_attrs {
-/* don't change the order or add anything inbetween, this is ABI! */
+/* don't change the order or add anything between, this is ABI! */
NL80211_ATTR_UNSPEC,
NL80211_ATTR_WIPHY,
@@ -1067,6 +1182,17 @@
NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX,
NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX,
+
+ NL80211_ATTR_SUPPORT_MESH_AUTH,
+ NL80211_ATTR_STA_PLINK_STATE,
+
+ NL80211_ATTR_WOWLAN_TRIGGERS,
+ NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED,
+
+ NL80211_ATTR_SCHED_SCAN_INTERVAL,
+
+ NL80211_ATTR_INTERFACE_COMBINATIONS,
+ NL80211_ATTR_SOFTWARE_IFTYPES,
/* add attributes here, update the policy in nl80211.c */
@@ -1120,7 +1246,9 @@
* @NL80211_IFTYPE_ADHOC: independent BSS member
* @NL80211_IFTYPE_STATION: managed BSS member
* @NL80211_IFTYPE_AP: access point
- * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
+ * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces
+ * are a bit special in that they must always be tied to a pre-existing
+ * AP type interface.
* @NL80211_IFTYPE_WDS: wireless distribution interface
* @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
* @NL80211_IFTYPE_MESH_POINT: mesh point
@@ -1162,6 +1290,7 @@
* with short barker preamble
* @NL80211_STA_FLAG_WME: station is WME/QoS capable
* @NL80211_STA_FLAG_MFP: station uses management frame protection
+ * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated
* @NL80211_STA_FLAG_MAX: highest station flag number currently defined
* @__NL80211_STA_FLAG_AFTER_LAST: internal use
*/
@@ -1171,6 +1300,7 @@
NL80211_STA_FLAG_SHORT_PREAMBLE,
NL80211_STA_FLAG_WME,
NL80211_STA_FLAG_MFP,
+ NL80211_STA_FLAG_AUTHENTICATED,
/* keep last */
__NL80211_STA_FLAG_AFTER_LAST,
@@ -1216,6 +1346,36 @@
};
/**
+ * enum nl80211_sta_bss_param - BSS information collected by STA
+ *
+ * These attribute types are used with %NL80211_STA_INFO_BSS_PARAM
+ * when getting information about the bitrate of a station.
+ *
+ * @__NL80211_STA_BSS_PARAM_INVALID: attribute number 0 is reserved
+ * @NL80211_STA_BSS_PARAM_CTS_PROT: whether CTS protection is enabled (flag)
+ * @NL80211_STA_BSS_PARAM_SHORT_PREAMBLE: whether short preamble is enabled
+ * (flag)
+ * @NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME: whether short slot time is enabled
+ * (flag)
+ * @NL80211_STA_BSS_PARAM_DTIM_PERIOD: DTIM period for beaconing (u8)
+ * @NL80211_STA_BSS_PARAM_BEACON_INTERVAL: Beacon interval (u16)
+ * @NL80211_STA_BSS_PARAM_MAX: highest sta_bss_param number currently defined
+ * @__NL80211_STA_BSS_PARAM_AFTER_LAST: internal use
+ */
+enum nl80211_sta_bss_param {
+ __NL80211_STA_BSS_PARAM_INVALID,
+ NL80211_STA_BSS_PARAM_CTS_PROT,
+ NL80211_STA_BSS_PARAM_SHORT_PREAMBLE,
+ NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME,
+ NL80211_STA_BSS_PARAM_DTIM_PERIOD,
+ NL80211_STA_BSS_PARAM_BEACON_INTERVAL,
+
+ /* keep last */
+ __NL80211_STA_BSS_PARAM_AFTER_LAST,
+ NL80211_STA_BSS_PARAM_MAX = __NL80211_STA_BSS_PARAM_AFTER_LAST - 1
+};
+
+/**
* enum nl80211_sta_info - station information
*
* These attribute types are used with %NL80211_ATTR_STA_INFO
@@ -1225,17 +1385,26 @@
* @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs)
* @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station)
* @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
- * @__NL80211_STA_INFO_AFTER_LAST: internal
- * @NL80211_STA_INFO_MAX: highest possible station info attribute
* @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
* @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
- * containing info as possible, see &enum nl80211_sta_info_txrate.
+ * containing info as possible, see &enum nl80211_rate_info
* @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station)
* @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this
* station)
* @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station)
* @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station)
* @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm)
+ * @NL80211_STA_INFO_LLID: the station's mesh LLID
+ * @NL80211_STA_INFO_PLID: the station's mesh PLID
+ * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station
+ * (see %enum nl80211_plink_state)
+ * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested
+ * attribute, like NL80211_STA_INFO_TX_BITRATE.
+ * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute
+ * containing info as possible, see &enum nl80211_sta_bss_param
+ * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
+ * @__NL80211_STA_INFO_AFTER_LAST: internal
+ * @NL80211_STA_INFO_MAX: highest possible station info attribute
*/
enum nl80211_sta_info {
__NL80211_STA_INFO_INVALID,
@@ -1252,6 +1421,9 @@
NL80211_STA_INFO_TX_RETRIES,
NL80211_STA_INFO_TX_FAILED,
NL80211_STA_INFO_SIGNAL_AVG,
+ NL80211_STA_INFO_RX_BITRATE,
+ NL80211_STA_INFO_BSS_PARAM,
+ NL80211_STA_INFO_CONNECTED_TIME,
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
@@ -1407,7 +1579,7 @@
* 802.11 country information element with regulatory information it
* thinks we should consider. cfg80211 only processes the country
* code from the IE, and relies on the regulatory domain information
- * structure pased by userspace (CRDA) from our wireless-regdb.
+ * structure passed by userspace (CRDA) from our wireless-regdb.
* If a channel is enabled but the country code indicates it should
* be disabled we disable the channel and re-enable it upon disassociation.
*/
@@ -1586,7 +1758,7 @@
* @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in
* millisecond units, used by the Peer Link Open message
*
- * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the inital confirm timeout, in
+ * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the initial confirm timeout, in
* millisecond units, used by the peer link management to close a peer link
*
* @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in
@@ -1626,7 +1798,7 @@
* @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_HWMP_ROOTMODE: whether root mode is enabled or not
*
* @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a
* source mesh point for path selection elements.
@@ -1674,17 +1846,32 @@
* vendor specific path metric or disable it to use the default Airtime
* metric.
*
- * @NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE: A vendor specific information
- * element that vendors will use to identify the path selection methods and
- * metrics in use.
- *
+ * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a
+ * robust security network ie, or a vendor specific information element that
+ * vendors will use to identify the path selection methods and metrics in use.
+ *
+ * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication
+ * daemon will be authenticating mesh candidates.
+ *
+ * @NL80211_MESH_SETUP_USERSPACE_AMPE: Enable this option if an authentication
+ * daemon will be securing peer link frames. AMPE is a secured version of Mesh
+ * Peering Management (MPM) and is implemented with the assistance of a
+ * userspace daemon. When this flag is set, the kernel will send peer
+ * management frames to a userspace daemon that will implement AMPE
+ * functionality (security capabilities selection, key confirmation, and key
+ * management). When the flag is unset (default), the kernel can autonomously
+ * complete (unsecured) mesh peering without the need of a userspace daemon.
+ *
+ * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
* @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
*/
enum nl80211_mesh_setup_params {
__NL80211_MESH_SETUP_INVALID,
NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL,
NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC,
- NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE,
+ NL80211_MESH_SETUP_IE,
+ NL80211_MESH_SETUP_USERSPACE_AUTH,
+ NL80211_MESH_SETUP_USERSPACE_AMPE,
/* keep last */
__NL80211_MESH_SETUP_ATTR_AFTER_LAST,
@@ -1989,4 +2176,189 @@
NL80211_TX_POWER_FIXED,
};
+/**
+ * enum nl80211_wowlan_packet_pattern_attr - WoWLAN packet pattern attribute
+ * @__NL80211_WOWLAN_PKTPAT_INVALID: invalid number for nested attribute
+ * @NL80211_WOWLAN_PKTPAT_PATTERN: the pattern, values where the mask has
+ * a zero bit are ignored
+ * @NL80211_WOWLAN_PKTPAT_MASK: pattern mask, must be long enough to have
+ * a bit for each byte in the pattern. The lowest-order bit corresponds
+ * to the first byte of the pattern, but the bytes of the pattern are
+ * in a little-endian-like format, i.e. the 9th byte of the pattern
+ * corresponds to the lowest-order bit in the second byte of the mask.
+ * For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where
+ * xx indicates "don't care") would be represented by a pattern of
+ * twelve zero bytes, and a mask of "0xed,0x07".
+ * Note that the pattern matching is done as though frames were not
+ * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked
+ * first (including SNAP header unpacking) and then matched.
+ * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes
+ * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number
+ */
+enum nl80211_wowlan_packet_pattern_attr {
+ __NL80211_WOWLAN_PKTPAT_INVALID,
+ NL80211_WOWLAN_PKTPAT_MASK,
+ NL80211_WOWLAN_PKTPAT_PATTERN,
+
+ NUM_NL80211_WOWLAN_PKTPAT,
+ MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1,
+};
+
+/**
+ * struct nl80211_wowlan_pattern_support - pattern support information
+ * @max_patterns: maximum number of patterns supported
+ * @min_pattern_len: minimum length of each pattern
+ * @max_pattern_len: maximum length of each pattern
+ *
+ * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when
+ * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the
+ * capability information given by the kernel to userspace.
+ */
+struct nl80211_wowlan_pattern_support {
+ __u32 max_patterns;
+ __u32 min_pattern_len;
+ __u32 max_pattern_len;
+} __attribute__((packed));
+
+/**
+ * enum nl80211_wowlan_triggers - WoWLAN trigger definitions
+ * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes
+ * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put
+ * the chip into a special state -- works best with chips that have
+ * support for low-power operation already (flag)
+ * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect
+ * is detected is implementation-specific (flag)
+ * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed
+ * by 16 repetitions of MAC addr, anywhere in payload) (flag)
+ * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns
+ * which are passed in an array of nested attributes, each nested attribute
+ * defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern.
+ * Each pattern defines a wakeup packet. The matching is done on the MSDU,
+ * i.e. as though the packet was an 802.3 packet, so the pattern matching
+ * is done after the packet is converted to the MSDU.
+ *
+ * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute
+ * carrying a &struct nl80211_wowlan_pattern_support.
+ * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
+ * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
+ */
+enum nl80211_wowlan_triggers {
+ __NL80211_WOWLAN_TRIG_INVALID,
+ NL80211_WOWLAN_TRIG_ANY,
+ NL80211_WOWLAN_TRIG_DISCONNECT,
+ NL80211_WOWLAN_TRIG_MAGIC_PKT,
+ NL80211_WOWLAN_TRIG_PKT_PATTERN,
+
+ /* keep last */
+ NUM_NL80211_WOWLAN_TRIG,
+ MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1
+};
+
+/**
+ * enum nl80211_iface_limit_attrs - limit attributes
+ * @NL80211_IFACE_LIMIT_UNSPEC: (reserved)
+ * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that
+ * can be chosen from this set of interface types (u32)
+ * @NL80211_IFACE_LIMIT_TYPES: nested attribute containing a
+ * flag attribute for each interface type in this set
+ * @NUM_NL80211_IFACE_LIMIT: number of attributes
+ * @MAX_NL80211_IFACE_LIMIT: highest attribute number
+ */
+enum nl80211_iface_limit_attrs {
+ NL80211_IFACE_LIMIT_UNSPEC,
+ NL80211_IFACE_LIMIT_MAX,
+ NL80211_IFACE_LIMIT_TYPES,
+
+ /* keep last */
+ NUM_NL80211_IFACE_LIMIT,
+ MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1
+};
+
+/**
+ * enum nl80211_if_combination_attrs -- interface combination attributes
+ *
+ * @NL80211_IFACE_COMB_UNSPEC: (reserved)
+ * @NL80211_IFACE_COMB_LIMITS: Nested attributes containing the limits
+ * for given interface types, see &enum nl80211_iface_limit_attrs.
+ * @NL80211_IFACE_COMB_MAXNUM: u32 attribute giving the total number of
+ * interfaces that can be created in this group. This number doesn't
+ * apply to interfaces purely managed in software, which are listed
+ * in a separate attribute %NL80211_ATTR_INTERFACES_SOFTWARE.
+ * @NL80211_IFACE_COMB_STA_AP_BI_MATCH: flag attribute specifying that
+ * beacon intervals within this group must be all the same even for
+ * infrastructure and AP/GO combinations, i.e. the GO(s) must adopt
+ * the infrastructure network's beacon interval.
+ * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many
+ * different channels may be used within this group.
+ * @NUM_NL80211_IFACE_COMB: number of attributes
+ * @MAX_NL80211_IFACE_COMB: highest attribute number
+ *
+ * Examples:
+ * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2
+ * => allows an AP and a STA that must match BIs
+ *
+ * numbers = [ #{AP, P2P-GO} <= 8 ], channels = 1, max = 8
+ * => allows 8 of AP/GO
+ *
+ * numbers = [ #{STA} <= 2 ], channels = 2, max = 2
+ * => allows two STAs on different channels
+ *
+ * numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4
+ * => allows a STA plus three P2P interfaces
+ *
+ * The list of these four possiblities could completely be contained
+ * within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate
+ * that any of these groups must match.
+ *
+ * "Combinations" of just a single interface will not be listed here,
+ * a single interface of any valid interface type is assumed to always
+ * be possible by itself. This means that implicitly, for each valid
+ * interface type, the following group always exists:
+ * numbers = [ #{<type>} <= 1 ], channels = 1, max = 1
+ */
+enum nl80211_if_combination_attrs {
+ NL80211_IFACE_COMB_UNSPEC,
+ NL80211_IFACE_COMB_LIMITS,
+ NL80211_IFACE_COMB_MAXNUM,
+ NL80211_IFACE_COMB_STA_AP_BI_MATCH,
+ NL80211_IFACE_COMB_NUM_CHANNELS,
+
+ /* keep last */
+ NUM_NL80211_IFACE_COMB,
+ MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1
+};
+
+
+/**
+ * enum nl80211_plink_state - state of a mesh peer link finite state machine
+ *
+ * @NL80211_PLINK_LISTEN: initial state, considered the implicit
+ * state of non existant mesh peer links
+ * @NL80211_PLINK_OPN_SNT: mesh plink open frame has been sent to
+ * this mesh peer
+ * @NL80211_PLINK_OPN_RCVD: mesh plink open frame has been received
+ * from this mesh peer
+ * @NL80211_PLINK_CNF_RCVD: mesh plink confirm frame has been
+ * received from this mesh peer
+ * @NL80211_PLINK_ESTAB: mesh peer link is established
+ * @NL80211_PLINK_HOLDING: mesh peer link is being closed or cancelled
+ * @NL80211_PLINK_BLOCKED: all frames transmitted from this mesh
+ * plink are discarded
+ * @NUM_NL80211_PLINK_STATES: number of peer link states
+ * @MAX_NL80211_PLINK_STATES: highest numerical value of plink states
+ */
+enum nl80211_plink_state {
+ NL80211_PLINK_LISTEN,
+ NL80211_PLINK_OPN_SNT,
+ NL80211_PLINK_OPN_RCVD,
+ NL80211_PLINK_CNF_RCVD,
+ NL80211_PLINK_ESTAB,
+ NL80211_PLINK_HOLDING,
+ NL80211_PLINK_BLOCKED,
+
+ /* keep last */
+ NUM_NL80211_PLINK_STATES,
+ MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1
+};
+
#endif /* __LINUX_NL80211_H */
Modified: iw/branches/upstream/current/phy.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/phy.c?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/phy.c (original)
+++ iw/branches/upstream/current/phy.c Mon Jul 25 11:08:40 2011
@@ -286,12 +286,15 @@
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_TX_POWER_SETTING, type);
if (type != NL80211_TX_POWER_AUTOMATIC) {
+ char *endptr;
if (argc != 2) {
printf("Missing TX power level argument.\n");
return 2;
}
- mbm = atoi(argv[1]);
+ mbm = strtol(argv[1], &endptr, 10);
+ if (!*endptr)
+ return 2;
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, mbm);
} else if (argc != 1)
return 1;
Modified: iw/branches/upstream/current/scan.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/scan.c?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/scan.c (original)
+++ iw/branches/upstream/current/scan.c Mon Jul 25 11:08:40 2011
@@ -27,8 +27,9 @@
#define WLAN_CAPABILITY_APSD (1<<11)
#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
-static unsigned char wifi_oui[3] = { 0x00, 0x50, 0xf2 };
-static unsigned char ieee80211_oui[3] = { 0x00, 0x0f, 0xac };
+static unsigned char ms_oui[3] = { 0x00, 0x50, 0xf2 };
+static unsigned char ieee80211_oui[3] = { 0x00, 0x0f, 0xac };
+static unsigned char wfa_oui[3] = { 0x50, 0x6f, 0x9a };
struct scan_params {
bool unknown;
@@ -105,10 +106,13 @@
return 1;
case FREQ:
freq = strtoul(argv[i], &eptr, 10);
- if (eptr != argv[i] + strlen(argv[i]))
- return 1;
+ if (eptr != argv[i] + strlen(argv[i])) {
+ /* failed to parse as number -- maybe a tag? */
+ i--;
+ parse = NONE;
+ continue;
+ }
NLA_PUT_U32(freqs, i, freq);
- parse = NONE;
break;
case IES:
ies = parse_hex(argv[i], &tmp);
@@ -251,7 +255,7 @@
static void print_cipher(const uint8_t *data)
{
- if (memcmp(data, wifi_oui, 3) == 0) {
+ if (memcmp(data, ms_oui, 3) == 0) {
switch (data[3]) {
case 0:
printf("Use group cipher suite");
@@ -305,7 +309,7 @@
static void print_auth(const uint8_t *data)
{
- if (memcmp(data, wifi_oui, 3) == 0) {
+ if (memcmp(data, ms_oui, 3) == 0) {
switch (data[3]) {
case 1:
printf("IEEE 802.1X");
@@ -832,6 +836,20 @@
val == 2 ? " (Configured)" : "");
break;
}
+ case 0x1047:
+ tab_on_first(&first);
+ printf("\t * UUID: ");
+ if (sublen != 16) {
+ printf("(invalid, length=%d)\n", sublen);
+ break;
+ }
+ printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-"
+ "%02x%02x-%02x%02x%02x%02x%02x%02x\n",
+ data[4], data[5], data[6], data[7],
+ data[8], data[9], data[10], data[11],
+ data[12], data[13], data[14], data[15],
+ data[16], data[17], data[18], data[19]);
+ break;
case 0x1054: {
tab_on_first(&first);
if (sublen != 8) {
@@ -917,6 +935,90 @@
[4] = { "WPS", print_wifi_wps, 0, 255, BIT(PRINT_SCAN), },
};
+static inline void print_p2p(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+ bool first = true;
+ __u8 subtype;
+ __u16 sublen;
+
+ while (len >= 3) {
+ subtype = data[0];
+ sublen = (data[2] << 8) + data[1];
+
+ if (sublen > len - 3)
+ break;
+
+ switch (subtype) {
+ case 0x02: /* capability */
+ tab_on_first(&first);
+ if (sublen < 2) {
+ printf("\t * malformed capability\n");
+ break;
+ }
+ printf("\t * Group capa: 0x%.2x, Device capa: 0x%.2x\n",
+ data[3], data[4]);
+ break;
+ case 0x0d: /* device info */
+ if (sublen < 6 + 2 + 8 + 1) {
+ printf("\t * malformed device info\n");
+ break;
+ }
+ /* fall through for now */
+ case 0x00: /* status */
+ case 0x01: /* minor reason */
+ case 0x03: /* device ID */
+ case 0x04: /* GO intent */
+ case 0x05: /* configuration timeout */
+ case 0x06: /* listen channel */
+ case 0x07: /* group BSSID */
+ case 0x08: /* ext listen timing */
+ case 0x09: /* intended interface address */
+ case 0x0a: /* manageability */
+ case 0x0b: /* channel list */
+ case 0x0c: /* NoA */
+ case 0x0e: /* group info */
+ case 0x0f: /* group ID */
+ case 0x10: /* interface */
+ case 0x11: /* operating channel */
+ case 0x12: /* invitation flags */
+ case 0xdd: /* vendor specific */
+ default: {
+ const __u8 *subdata = data + 4;
+ __u16 tmplen = sublen;
+
+ tab_on_first(&first);
+ printf("\t * Unknown TLV (%#.2x, %d bytes):",
+ subtype, tmplen);
+ while (tmplen) {
+ printf(" %.2x", *subdata);
+ subdata++;
+ tmplen--;
+ }
+ printf("\n");
+ break;
+ }
+ }
+
+ data += sublen + 3;
+ len -= sublen + 3;
+ }
+
+ if (len != 0) {
+ tab_on_first(&first);
+ printf("\t * bogus tail data (%d):", len);
+ while (len) {
+ printf(" %.2x", *data);
+ data++;
+ len--;
+ }
+ printf("\n");
+ }
+}
+
+static const struct ie_print wfa_printers[] = {
+ [9] = { "P2P", print_p2p, 2, 255, BIT(PRINT_SCAN), },
+};
+
static void print_vendor(unsigned char len, unsigned char *data,
bool unknown, enum print_ie_type ptype)
{
@@ -930,7 +1032,7 @@
return;
}
- if (len >= 4 && memcmp(data, wifi_oui, 3) == 0) {
+ if (len >= 4 && memcmp(data, ms_oui, 3) == 0) {
if (data[3] < ARRAY_SIZE(wifiprinters) &&
wifiprinters[data[3]].name &&
wifiprinters[data[3]].flags & BIT(ptype)) {
@@ -939,7 +1041,23 @@
}
if (!unknown)
return;
- printf("\tWiFi OUI %#.2x, data:", data[3]);
+ printf("\tMS/WiFi %#.2x, data:", data[3]);
+ for(i = 0; i < len - 4; i++)
+ printf(" %.02x", data[i + 4]);
+ printf("\n");
+ return;
+ }
+
+ if (len >= 4 && memcmp(data, wfa_oui, 3) == 0) {
+ if (data[3] < ARRAY_SIZE(wfa_printers) &&
+ wfa_printers[data[3]].name &&
+ wfa_printers[data[3]].flags & BIT(ptype)) {
+ print_ie(&wfa_printers[data[3]], data[3], len - 4, data + 4);
+ return;
+ }
+ if (!unknown)
+ return;
+ printf("\tWFA %#.2x, data:", data[3]);
for(i = 0; i < len - 4; i++)
printf(" %.02x", data[i + 4]);
printf("\n");
Modified: iw/branches/upstream/current/util.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/util.c?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/util.c (original)
+++ iw/branches/upstream/current/util.c Mon Jul 25 11:08:40 2011
@@ -48,41 +48,77 @@
return 0;
}
-unsigned char *parse_hex(char *hex, size_t *outlen)
-{
- size_t len = strlen(hex);
- unsigned char *result = calloc(len/2 + 2, 1);
+int parse_hex_mask(char *hexmask, unsigned char **result, size_t *result_len,
+ unsigned char **mask)
+{
+ size_t len = strlen(hexmask) / 2;
+ unsigned char *result_val;
+ unsigned char *result_mask = NULL;
+
int pos = 0;
- if (!result)
- return NULL;
-
- *outlen = 0;
+ *result_len = 0;
+
+ result_val = calloc(len + 2, 1);
+ if (!result_val)
+ goto error;
+ *result = result_val;
+ if (mask) {
+ result_mask = calloc(DIV_ROUND_UP(len, 8) + 2, 1);
+ if (!result_mask)
+ goto error;
+ *mask = result_mask;
+ }
while (1) {
- int temp;
- char *cp = strchr(hex, ':');
+ char *cp = strchr(hexmask, ':');
if (cp) {
*cp = 0;
cp++;
}
- if (sscanf(hex, "%x", &temp) != 1)
- goto error;
- if (temp < 0 || temp > 255)
- goto error;
-
- (*outlen)++;
-
- result[pos++] = temp;
+
+ if (result_mask && (strcmp(hexmask, "-") == 0 ||
+ strcmp(hexmask, "xx") == 0 ||
+ strcmp(hexmask, "--") == 0)) {
+ /* skip this byte and leave mask bit unset */
+ } else {
+ int temp, mask_pos;
+ char *end;
+
+ temp = strtoul(hexmask, &end, 16);
+ if (*end)
+ goto error;
+ if (temp < 0 || temp > 255)
+ goto error;
+ result_val[pos] = temp;
+
+ mask_pos = pos / 8;
+ if (result_mask)
+ result_mask[mask_pos] |= 1 << (pos % 8);
+ }
+
+ (*result_len)++;
+ pos++;
+
if (!cp)
break;
- hex = cp;
- }
-
+ hexmask = cp;
+ }
+
+ return 0;
+ error:
+ free(result_val);
+ free(result_mask);
+ return -1;
+}
+
+unsigned char *parse_hex(char *hex, size_t *outlen)
+{
+ unsigned char *result;
+
+ if (parse_hex_mask(hex, &result, outlen, NULL))
+ return NULL;
return result;
- error:
- free(result);
- return NULL;
}
static const char *ifmodes[NL80211_IFTYPE_MAX + 1] = {
Modified: iw/branches/upstream/current/version.sh
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/version.sh?rev=1593&op=diff
==============================================================================
--- iw/branches/upstream/current/version.sh (original)
+++ iw/branches/upstream/current/version.sh Mon Jul 25 11:08:40 2011
@@ -1,9 +1,7 @@
#!/bin/sh
-VERSION="0.9.22"
+VERSION="3.0"
OUT="$1"
-
-echo '#include "iw.h"' > "$OUT"
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
git update-index --refresh --unmerged > /dev/null
@@ -21,4 +19,5 @@
v="$VERSION"
fi
+echo '#include "iw.h"' > "$OUT"
echo "const char iw_version[] = \"$v\";" >> "$OUT"
Added: iw/branches/upstream/current/wowlan.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/wowlan.c?rev=1593&op=file
==============================================================================
--- iw/branches/upstream/current/wowlan.c (added)
+++ iw/branches/upstream/current/wowlan.c Mon Jul 25 11:08:40 2011
@@ -1,0 +1,179 @@
+#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(wowlan);
+
+static int handle_wowlan_enable(struct nl80211_state *state, struct nl_cb *cb,
+ struct nl_msg *msg, int argc, char **argv)
+{
+ struct nlattr *wowlan, *pattern;
+ struct nl_msg *patterns = NULL;
+ enum {
+ PS_REG,
+ PS_PAT,
+ } parse_state = PS_REG;
+ int err = -ENOBUFS;
+ unsigned char *pat, *mask;
+ size_t patlen;
+ int patnum = 0;
+
+ wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS);
+ if (!wowlan)
+ return -ENOBUFS;
+
+ while (argc) {
+ switch (parse_state) {
+ case PS_REG:
+ if (strcmp(argv[0], "any") == 0)
+ NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_ANY);
+ else if (strcmp(argv[0], "disconnect") == 0)
+ NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_DISCONNECT);
+ else if (strcmp(argv[0], "magic-packet") == 0)
+ NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT);
+ else if (strcmp(argv[0], "patterns") == 0) {
+ parse_state = PS_PAT;
+ patterns = nlmsg_alloc();
+ if (!patterns) {
+ err = -ENOMEM;
+ goto nla_put_failure;
+ }
+ } else {
+ err = 1;
+ goto nla_put_failure;
+ }
+ break;
+ case PS_PAT:
+ if (parse_hex_mask(argv[0], &pat, &patlen, &mask)) {
+ err = 1;
+ goto nla_put_failure;
+ }
+ pattern = nla_nest_start(patterns, ++patnum);
+ NLA_PUT(patterns, NL80211_WOWLAN_PKTPAT_MASK,
+ DIV_ROUND_UP(patlen, 8), mask);
+ NLA_PUT(patterns, NL80211_WOWLAN_PKTPAT_PATTERN,
+ patlen, pat);
+ nla_nest_end(patterns, pattern);
+ free(mask);
+ free(pat);
+ break;
+ }
+ argv++;
+ argc--;
+ }
+
+ if (patterns)
+ nla_put_nested(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN,
+ patterns);
+
+ nla_nest_end(msg, wowlan);
+ err = 0;
+ nla_put_failure:
+ nlmsg_free(patterns);
+ return err;
+}
+COMMAND(wowlan, enable, "[any] [disconnect] [magic-packet] [patterns <pattern>*]",
+ NL80211_CMD_SET_WOWLAN, 0, CIB_PHY, handle_wowlan_enable,
+ "Enable WoWLAN with the given triggers.\n"
+ "Each pattern is given as a bytestring with '-' in places where any byte\n"
+ "may be present, e.g. 00:11:22:-:44 will match 00:11:22:33:44 and\n"
+ "00:11:22:33:ff:44 etc.");
+
+
+static int handle_wowlan_disable(struct nl80211_state *state, struct nl_cb *cb,
+ struct nl_msg *msg, int argc, char **argv)
+{
+ /* just a set w/o wowlan attribute */
+ return 0;
+}
+COMMAND(wowlan, disable, "", NL80211_CMD_SET_WOWLAN, 0, CIB_PHY, handle_wowlan_disable,
+ "Disable WoWLAN.");
+
+
+static int print_wowlan_handler(struct nl_msg *msg, void *arg)
+{
+ struct nlattr *attrs[NL80211_ATTR_MAX + 1];
+ struct nlattr *trig[NUM_NL80211_WOWLAN_TRIG];
+ struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+ struct nlattr *pattern;
+ int rem_pattern;
+
+ nla_parse(attrs, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+ genlmsg_attrlen(gnlh, 0), NULL);
+
+ if (!attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) {
+ printf("WoWLAN is disabled.\n");
+ return NL_SKIP;
+ }
+
+ /* XXX: use policy */
+ nla_parse(trig, MAX_NL80211_WOWLAN_TRIG,
+ nla_data(attrs[NL80211_ATTR_WOWLAN_TRIGGERS]),
+ nla_len(attrs[NL80211_ATTR_WOWLAN_TRIGGERS]),
+ NULL);
+
+ printf("WoWLAN is enabled:\n");
+ if (trig[NL80211_WOWLAN_TRIG_ANY])
+ printf(" * wake up on special any trigger\n");
+ if (trig[NL80211_WOWLAN_TRIG_DISCONNECT])
+ printf(" * wake up on disconnect\n");
+ if (trig[NL80211_WOWLAN_TRIG_MAGIC_PKT])
+ printf(" * wake up on magic packet\n");
+ if (trig[NL80211_WOWLAN_TRIG_PKT_PATTERN]) {
+ nla_for_each_nested(pattern,
+ trig[NL80211_WOWLAN_TRIG_PKT_PATTERN],
+ rem_pattern) {
+ struct nlattr *patattr[NUM_NL80211_WOWLAN_PKTPAT];
+ int i, patlen, masklen;
+ uint8_t *mask, *pat;
+ nla_parse(patattr, MAX_NL80211_WOWLAN_PKTPAT,
+ nla_data(pattern), nla_len(pattern),
+ NULL);
+ if (!patattr[NL80211_WOWLAN_PKTPAT_MASK] ||
+ !patattr[NL80211_WOWLAN_PKTPAT_PATTERN]) {
+ printf(" * (invalid pattern specification)\n");
+ continue;
+ }
+ masklen = nla_len(patattr[NL80211_WOWLAN_PKTPAT_MASK]);
+ patlen = nla_len(patattr[NL80211_WOWLAN_PKTPAT_PATTERN]);
+ if (DIV_ROUND_UP(patlen, 8) != masklen) {
+ printf(" * (invalid pattern specification)\n");
+ continue;
+ }
+ printf(" * wake up on pattern: ");
+ pat = nla_data(patattr[NL80211_WOWLAN_PKTPAT_PATTERN]);
+ mask = nla_data(patattr[NL80211_WOWLAN_PKTPAT_MASK]);
+ for (i = 0; i < patlen; i++) {
+ if (mask[i / 8] & (1 << (i % 8)))
+ printf("%.2x", pat[i]);
+ else
+ printf("--");
+ if (i != patlen - 1)
+ printf(":");
+ }
+ printf("\n");
+ }
+ }
+
+ return NL_SKIP;
+}
+
+static int handle_wowlan_show(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_wowlan_handler, NULL);
+
+ return 0;
+}
+COMMAND(wowlan, show, "", NL80211_CMD_GET_WOWLAN, 0, CIB_PHY, handle_wowlan_show,
+ "Show WoWLAN status.");
More information about the Pkg-wpa-devel
mailing list