[pkg-wpa-devel] r1805 - in /iw/branches/upstream/current: Android.mk Makefile android-nl.c connect.c event.c info.c interface.c iw.c iw.h link.c mesh.c mpath.c nl80211.h reg.c scan.c station.c version.sh wowlan.c
slh-guest at users.alioth.debian.org
slh-guest at users.alioth.debian.org
Fri May 3 18:38:12 UTC 2013
Author: slh-guest
Date: Fri May 3 18:38:12 2013
New Revision: 1805
URL: http://svn.debian.org/wsvn/?sc=1&rev=1805
Log:
[svn-upgrade] new version iw (3.10)
Added:
iw/branches/upstream/current/Android.mk
iw/branches/upstream/current/android-nl.c
Modified:
iw/branches/upstream/current/Makefile
iw/branches/upstream/current/connect.c
iw/branches/upstream/current/event.c
iw/branches/upstream/current/info.c
iw/branches/upstream/current/interface.c
iw/branches/upstream/current/iw.c
iw/branches/upstream/current/iw.h
iw/branches/upstream/current/link.c
iw/branches/upstream/current/mesh.c
iw/branches/upstream/current/mpath.c
iw/branches/upstream/current/nl80211.h
iw/branches/upstream/current/reg.c
iw/branches/upstream/current/scan.c
iw/branches/upstream/current/station.c
iw/branches/upstream/current/version.sh
iw/branches/upstream/current/wowlan.c
Added: iw/branches/upstream/current/Android.mk
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/Android.mk?rev=1805&op=file
==============================================================================
--- iw/branches/upstream/current/Android.mk (added)
+++ iw/branches/upstream/current/Android.mk Fri May 3 18:38:12 2013
@@ -1,0 +1,25 @@
+LOCAL_PATH := $(call my-dir)
+IW_SOURCE_DIR := $(LOCAL_PATH)
+
+include $(CLEAR_VARS)
+
+NO_PKG_CONFIG=y
+include $(LOCAL_PATH)/Makefile
+
+LOCAL_SRC_FILES := $(patsubst %.o,%.c,$(OBJS)) android-nl.c
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH) \
+ external/libnl-headers/
+
+LOCAL_CFLAGS += -DCONFIG_LIBNL20
+LOCAL_LDFLAGS := -Wl,--no-gc-sections
+#LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_TAGS := eng
+LOCAL_SHARED_LIBRARIES := libnl_2
+LOCAL_MODULE := iw
+
+$(IW_SOURCE_DIR)/version.c:
+ $(IW_SOURCE_DIR)/version.sh $(IW_SOURCE_DIR)/version.c
+
+include $(BUILD_EXECUTABLE)
Modified: iw/branches/upstream/current/Makefile
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/Makefile?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/Makefile (original)
+++ iw/branches/upstream/current/Makefile Fri May 3 18:38:12 2013
@@ -1,5 +1,3 @@
--include .config
-
MAKEFLAGS += --no-print-directory
PREFIX ?= /usr
@@ -23,8 +21,11 @@
OBJS-$(HWSIM) += hwsim.o
+OBJS += $(OBJS-y) $(OBJS-Y)
+
ALL = iw
+ifeq ($(NO_PKG_CONFIG),)
NL3xFOUND := $(shell $(PKG_CONFIG) --atleast-version=3.2 libnl-3.0 && echo Y)
ifneq ($(NL3xFOUND),Y)
NL31FOUND := $(shell $(PKG_CONFIG) --exact-version=3.1 libnl-3.1 && echo Y)
@@ -77,6 +78,7 @@
LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME))
CFLAGS += $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
+endif # NO_PKG_CONFIG
ifeq ($(V),1)
Q=
@@ -88,7 +90,7 @@
all: $(ALL)
-VERSION_OBJS := $(filter-out version.o, $(OBJS) $(OBJS-y))
+VERSION_OBJS := $(filter-out version.o, $(OBJS))
version.c: version.sh $(patsubst %.o,%.c,$(VERSION_OBJS)) nl80211.h iw.h Makefile \
$(wildcard .git/index .git/refs/tags)
@@ -99,9 +101,9 @@
@$(NQ) ' CC ' $@
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
-iw: $(OBJS) $(OBJS-y)
+iw: $(OBJS)
@$(NQ) ' CC ' iw
- $(Q)$(CC) $(LDFLAGS) $(OBJS) $(OBJS-y) $(LIBS) -o iw
+ $(Q)$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o iw
check:
$(Q)$(MAKE) all CC="REAL_CC=$(CC) CHECK=\"sparse -Wall\" cgcc"
Added: iw/branches/upstream/current/android-nl.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/android-nl.c?rev=1805&op=file
==============================================================================
--- iw/branches/upstream/current/android-nl.c (added)
+++ iw/branches/upstream/current/android-nl.c Fri May 3 18:38:12 2013
@@ -1,0 +1,6 @@
+#include <netlink/attr.h>
+
+int nla_put_flag(struct nl_msg *msg, int flag)
+{
+ return nla_put(msg, flag, 0, NULL);
+}
Modified: iw/branches/upstream/current/connect.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/connect.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/connect.c (original)
+++ iw/branches/upstream/current/connect.c Fri May 3 18:38:12 2013
@@ -145,3 +145,74 @@
"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);
+
+static int iw_auth(struct nl80211_state *state, struct nl_cb *cb,
+ struct nl_msg *msg, int argc, char **argv,
+ enum id_input id)
+{
+ char *end;
+ unsigned char bssid[6];
+ int freq;
+ bool need_key = false;
+
+ if (argc < 4)
+ return 1;
+
+ /* SSID */
+ NLA_PUT(msg, NL80211_ATTR_SSID, strlen(argv[0]), argv[0]);
+ argv++;
+ argc--;
+
+ /* bssid */
+ if (mac_addr_a2n(bssid, argv[0]) == 0) {
+ NLA_PUT(msg, NL80211_ATTR_MAC, 6, bssid);
+ argv++;
+ argc--;
+ } else {
+ return 1;
+ }
+
+ /* FIXME */
+ if (strcmp(argv[0], "open") == 0) {
+ NLA_PUT_U32(msg, NL80211_ATTR_AUTH_TYPE,
+ NL80211_AUTHTYPE_OPEN_SYSTEM);
+ } else if (strcmp(argv[0], "shared") == 0) {
+ NLA_PUT_U32(msg, NL80211_ATTR_AUTH_TYPE,
+ NL80211_AUTHTYPE_SHARED_KEY);
+ need_key = true;
+ } else {
+ return 1;
+ }
+ argv++;
+ argc--;
+
+ freq = strtoul(argv[0], &end, 10);
+ if (*end == '\0') {
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
+ argv++;
+ argc--;
+ } else {
+ return 1;
+ }
+
+ if (!argc && need_key)
+ return 1;
+ if (argc && !need_key)
+ return 1;
+ if (!argc)
+ return 0;
+
+ if (strcmp(*argv, "key") != 0 && strcmp(*argv, "keys") != 0)
+ return 1;
+
+ argv++;
+ argc--;
+
+ return parse_keys(msg, argv, argc);
+ nla_put_failure:
+ return -ENOSPC;
+}
+
+TOPLEVEL(auth, "<SSID> <bssid> <type:open|shared> <freq in MHz> [key 0:abcde d:1:6162636465]",
+ NL80211_CMD_AUTHENTICATE, 0, CIB_NETDEV, iw_auth,
+ "Authenticate with the given network.\n");
Modified: iw/branches/upstream/current/event.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/event.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/event.c (original)
+++ iw/branches/upstream/current/event.c Fri May 3 18:38:12 2013
@@ -110,7 +110,7 @@
struct nlattr *cqm[NL80211_ATTR_CQM_MAX + 1];
struct nlattr *cqm_attr = attrs[NL80211_ATTR_CQM];
- printf("connection quality monitor event: ");
+ printf("CQM event: ");
if (!cqm_attr ||
nla_parse_nested(cqm, NL80211_ATTR_CQM_MAX, cqm_attr, cqm_policy)) {
@@ -120,11 +120,27 @@
if (cqm[NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT]) {
enum nl80211_cqm_rssi_threshold_event rssi_event;
+ bool found_one = false;
+
rssi_event = nla_get_u32(cqm[NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT]);
- if (rssi_event == NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH)
+
+ switch (rssi_event) {
+ case NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH:
printf("RSSI went above threshold\n");
- else
+ found_one = true;
+ break;
+ case NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW:
printf("RSSI went below threshold\n");
+ found_one = true;
+ break;
+ case NL80211_CQM_RSSI_BEACON_LOSS_EVENT:
+ printf("Beacon loss detected\n");
+ found_one = true;
+ break;
+ }
+
+ if (!found_one)
+ printf("Unknown event type: %i\n", rssi_event);
} else if (cqm[NL80211_ATTR_CQM_PKT_LOSS_EVENT] &&
attrs[NL80211_ATTR_MAC]) {
uint32_t frames;
@@ -181,6 +197,67 @@
}
printf("\n");
+}
+
+static void parse_wowlan_wake_event(struct nlattr **attrs)
+{
+ struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG];
+
+ printf("WoWLAN wakeup\n");
+ if (!attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) {
+ printf("\twakeup not due to WoWLAN\n");
+ return;
+ }
+
+ nla_parse(tb, MAX_NL80211_WOWLAN_TRIG,
+ nla_data(attrs[NL80211_ATTR_WOWLAN_TRIGGERS]),
+ nla_len(attrs[NL80211_ATTR_WOWLAN_TRIGGERS]), NULL);
+
+ if (tb[NL80211_WOWLAN_TRIG_DISCONNECT])
+ printf("\t* was disconnected\n");
+ if (tb[NL80211_WOWLAN_TRIG_MAGIC_PKT])
+ printf("\t* magic packet received\n");
+ if (tb[NL80211_WOWLAN_TRIG_PKT_PATTERN])
+ printf("\t* pattern index: %u\n",
+ nla_get_u32(tb[NL80211_WOWLAN_TRIG_PKT_PATTERN]));
+ if (tb[NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE])
+ printf("\t* GTK rekey failure\n");
+ if (tb[NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST])
+ printf("\t* EAP identity request\n");
+ if (tb[NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE])
+ printf("\t* 4-way handshake\n");
+ if (tb[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
+ printf("\t* RF-kill released\n");
+ if (tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]) {
+ uint8_t *d = nla_data(tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]);
+ int l = nla_len(tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211]);
+ int i;
+ printf("\t* packet (might be truncated): ");
+ for (i = 0; i < l; i++) {
+ if (i > 0)
+ printf(":");
+ printf("%.2x", d[i]);
+ }
+ printf("\n");
+ }
+ if (tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023]) {
+ uint8_t *d = nla_data(tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023]);
+ int l = nla_len(tb[NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023]);
+ int i;
+ printf("\t* packet (might be truncated): ");
+ for (i = 0; i < l; i++) {
+ if (i > 0)
+ printf(":");
+ printf("%.2x", d[i]);
+ }
+ printf("\n");
+ }
+ if (tb[NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH])
+ printf("\t* TCP connection wakeup received\n");
+ if (tb[NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST])
+ printf("\t* TCP connection lost\n");
+ if (tb[NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS])
+ printf("\t* TCP connection ran out of tokens\n");
}
static int print_event(struct nl_msg *msg, void *arg)
@@ -434,8 +511,21 @@
(unsigned long long)nla_get_u64(tb[NL80211_ATTR_COOKIE]),
tb[NL80211_ATTR_ACK] ? "acked" : "no ack");
break;
- case NL80211_ATTR_PMKSA_CANDIDATE:
+ case NL80211_CMD_PMKSA_CANDIDATE:
printf("PMKSA candidate found\n");
+ break;
+ case NL80211_CMD_SET_WOWLAN:
+ parse_wowlan_wake_event(tb);
+ break;
+ case NL80211_CMD_PROBE_CLIENT:
+ if (tb[NL80211_ATTR_MAC])
+ mac_addr_n2a(macbuf, nla_data(tb[NL80211_ATTR_MAC]));
+ else
+ strcpy(macbuf, "??");
+ printf("probe client %s (cookie %llx): %s\n",
+ macbuf,
+ (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);
Modified: iw/branches/upstream/current/info.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/info.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/info.c (original)
+++ iw/branches/upstream/current/info.c Fri May 3 18:38:12 2013
@@ -49,6 +49,20 @@
}
}
+static char *dfs_state_name(enum nl80211_dfs_state state)
+{
+ switch (state) {
+ case NL80211_DFS_USABLE:
+ return "usable";
+ case NL80211_DFS_AVAILABLE:
+ return "available";
+ case NL80211_DFS_UNAVAILABLE:
+ return "unavailable";
+ default:
+ return "unknown";
+ }
+}
+
static int print_phy_handler(struct nl_msg *msg, void *arg)
{
struct nlattr *tb_msg[NL80211_ATTR_MAX + 1];
@@ -78,92 +92,128 @@
struct nlattr *nl_mode;
struct nlattr *nl_cmd;
struct nlattr *nl_if, *nl_ftype;
- int bandidx = 1;
int rem_band, rem_freq, rem_rate, rem_mode, rem_cmd, rem_ftype, rem_if;
int open;
+ /*
+ * static variables only work here, other applications need to use the
+ * callback pointer and store them there so they can be multithreaded
+ * and/or have multiple netlink sockets, etc.
+ */
+ static int64_t phy_id = -1;
+ static int last_band = -1;
+ static bool band_had_freq = false;
+ bool print_name = true;
nla_parse(tb_msg, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
genlmsg_attrlen(gnlh, 0), NULL);
- if (!tb_msg[NL80211_ATTR_WIPHY_BANDS])
- return NL_SKIP;
-
- if (tb_msg[NL80211_ATTR_WIPHY_NAME])
+ if (tb_msg[NL80211_ATTR_WIPHY]) {
+ if (nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]) == phy_id)
+ print_name = false;
+ else
+ last_band = -1;
+ phy_id = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]);
+ }
+ if (print_name && tb_msg[NL80211_ATTR_WIPHY_NAME])
printf("Wiphy %s\n", nla_get_string(tb_msg[NL80211_ATTR_WIPHY_NAME]));
- nla_for_each_nested(nl_band, tb_msg[NL80211_ATTR_WIPHY_BANDS], rem_band) {
- printf("\tBand %d:\n", bandidx);
- bandidx++;
-
- nla_parse(tb_band, NL80211_BAND_ATTR_MAX, nla_data(nl_band),
- nla_len(nl_band), NULL);
-
- if (tb_band[NL80211_BAND_ATTR_HT_CAPA]) {
- __u16 cap = nla_get_u16(tb_band[NL80211_BAND_ATTR_HT_CAPA]);
- print_ht_capability(cap);
- }
- if (tb_band[NL80211_BAND_ATTR_HT_AMPDU_FACTOR]) {
- __u8 exponent = nla_get_u8(tb_band[NL80211_BAND_ATTR_HT_AMPDU_FACTOR]);
- print_ampdu_length(exponent);
- }
- if (tb_band[NL80211_BAND_ATTR_HT_AMPDU_DENSITY]) {
- __u8 spacing = nla_get_u8(tb_band[NL80211_BAND_ATTR_HT_AMPDU_DENSITY]);
- print_ampdu_spacing(spacing);
- }
- if (tb_band[NL80211_BAND_ATTR_HT_MCS_SET] &&
- nla_len(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]) == 16)
- print_ht_mcs(nla_data(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]));
- if (tb_band[NL80211_BAND_ATTR_VHT_CAPA] &&
- tb_band[NL80211_BAND_ATTR_VHT_MCS_SET])
- print_vht_info(nla_get_u32(tb_band[NL80211_BAND_ATTR_VHT_CAPA]),
- nla_data(tb_band[NL80211_BAND_ATTR_VHT_MCS_SET]));
-
- printf("\t\tFrequencies:\n");
-
- nla_for_each_nested(nl_freq, tb_band[NL80211_BAND_ATTR_FREQS], rem_freq) {
- uint32_t freq;
- nla_parse(tb_freq, NL80211_FREQUENCY_ATTR_MAX, nla_data(nl_freq),
- nla_len(nl_freq), freq_policy);
- if (!tb_freq[NL80211_FREQUENCY_ATTR_FREQ])
- continue;
- freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]);
- printf("\t\t\t* %d MHz [%d]", freq, ieee80211_frequency_to_channel(freq));
-
- if (tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] &&
- !tb_freq[NL80211_FREQUENCY_ATTR_DISABLED])
- printf(" (%.1f dBm)", 0.01 * nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER]));
-
- open = 0;
- if (tb_freq[NL80211_FREQUENCY_ATTR_DISABLED]) {
- print_flag("disabled", &open);
- goto next;
- }
- if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN])
- print_flag("passive scanning", &open);
- if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IBSS])
- print_flag("no IBSS", &open);
- if (tb_freq[NL80211_FREQUENCY_ATTR_RADAR])
- print_flag("radar detection", &open);
- next:
- if (open)
- printf(")");
- printf("\n");
- }
-
- printf("\t\tBitrates (non-HT):\n");
-
- nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
- nla_parse(tb_rate, NL80211_BITRATE_ATTR_MAX, nla_data(nl_rate),
- nla_len(nl_rate), rate_policy);
- if (!tb_rate[NL80211_BITRATE_ATTR_RATE])
- continue;
- printf("\t\t\t* %2.1f Mbps", 0.1 * nla_get_u32(tb_rate[NL80211_BITRATE_ATTR_RATE]));
- open = 0;
- if (tb_rate[NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE])
- print_flag("short preamble supported", &open);
- if (open)
- printf(")");
- printf("\n");
+ /* needed for split dump */
+ if (tb_msg[NL80211_ATTR_WIPHY_BANDS]) {
+ nla_for_each_nested(nl_band, tb_msg[NL80211_ATTR_WIPHY_BANDS], rem_band) {
+ if (last_band != nl_band->nla_type) {
+ printf("\tBand %d:\n", nl_band->nla_type + 1);
+ band_had_freq = false;
+ }
+ last_band = nl_band->nla_type;
+
+ nla_parse(tb_band, NL80211_BAND_ATTR_MAX, nla_data(nl_band),
+ nla_len(nl_band), NULL);
+
+ if (tb_band[NL80211_BAND_ATTR_HT_CAPA]) {
+ __u16 cap = nla_get_u16(tb_band[NL80211_BAND_ATTR_HT_CAPA]);
+ print_ht_capability(cap);
+ }
+ if (tb_band[NL80211_BAND_ATTR_HT_AMPDU_FACTOR]) {
+ __u8 exponent = nla_get_u8(tb_band[NL80211_BAND_ATTR_HT_AMPDU_FACTOR]);
+ print_ampdu_length(exponent);
+ }
+ if (tb_band[NL80211_BAND_ATTR_HT_AMPDU_DENSITY]) {
+ __u8 spacing = nla_get_u8(tb_band[NL80211_BAND_ATTR_HT_AMPDU_DENSITY]);
+ print_ampdu_spacing(spacing);
+ }
+ if (tb_band[NL80211_BAND_ATTR_HT_MCS_SET] &&
+ nla_len(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]) == 16)
+ print_ht_mcs(nla_data(tb_band[NL80211_BAND_ATTR_HT_MCS_SET]));
+ if (tb_band[NL80211_BAND_ATTR_VHT_CAPA] &&
+ tb_band[NL80211_BAND_ATTR_VHT_MCS_SET])
+ print_vht_info(nla_get_u32(tb_band[NL80211_BAND_ATTR_VHT_CAPA]),
+ nla_data(tb_band[NL80211_BAND_ATTR_VHT_MCS_SET]));
+
+ if (tb_band[NL80211_BAND_ATTR_FREQS]) {
+ if (!band_had_freq) {
+ printf("\t\tFrequencies:\n");
+ band_had_freq = true;
+ }
+ nla_for_each_nested(nl_freq, tb_band[NL80211_BAND_ATTR_FREQS], rem_freq) {
+ uint32_t freq;
+ nla_parse(tb_freq, NL80211_FREQUENCY_ATTR_MAX, nla_data(nl_freq),
+ nla_len(nl_freq), freq_policy);
+ if (!tb_freq[NL80211_FREQUENCY_ATTR_FREQ])
+ continue;
+ freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]);
+ printf("\t\t\t* %d MHz [%d]", freq, ieee80211_frequency_to_channel(freq));
+
+ if (tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER] &&
+ !tb_freq[NL80211_FREQUENCY_ATTR_DISABLED])
+ printf(" (%.1f dBm)", 0.01 * nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_MAX_TX_POWER]));
+
+ open = 0;
+ if (tb_freq[NL80211_FREQUENCY_ATTR_DISABLED]) {
+ print_flag("disabled", &open);
+ goto next;
+ }
+ if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN])
+ print_flag("passive scanning", &open);
+ if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IBSS])
+ print_flag("no IBSS", &open);
+ if (tb_freq[NL80211_FREQUENCY_ATTR_RADAR])
+ print_flag("radar detection", &open);
+next:
+ if (open)
+ printf(")");
+ printf("\n");
+
+ if (!tb_freq[NL80211_FREQUENCY_ATTR_DISABLED] && tb_freq[NL80211_FREQUENCY_ATTR_DFS_STATE]) {
+ enum nl80211_dfs_state state = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_DFS_STATE]);
+ unsigned long time;
+
+ printf("\t\t\t DFS state: %s", dfs_state_name(state));
+ if (tb_freq[NL80211_FREQUENCY_ATTR_DFS_TIME]) {
+ time = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_DFS_TIME]);
+ printf(" (for %lu sec)", time/1000);
+ }
+ printf("\n");
+ }
+
+ }
+ }
+
+ if (tb_band[NL80211_BAND_ATTR_RATES]) {
+ printf("\t\tBitrates (non-HT):\n");
+ nla_for_each_nested(nl_rate, tb_band[NL80211_BAND_ATTR_RATES], rem_rate) {
+ nla_parse(tb_rate, NL80211_BITRATE_ATTR_MAX, nla_data(nl_rate),
+ nla_len(nl_rate), rate_policy);
+ if (!tb_rate[NL80211_BITRATE_ATTR_RATE])
+ continue;
+ printf("\t\t\t* %2.1f Mbps", 0.1 * nla_get_u32(tb_rate[NL80211_BITRATE_ATTR_RATE]));
+ open = 0;
+ if (tb_rate[NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE])
+ print_flag("short preamble supported", &open);
+ if (open)
+ printf(")");
+ printf("\n");
+ }
+ }
}
}
@@ -245,6 +295,7 @@
[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 },
+ [NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS] = { .type = NLA_U32 },
};
struct nlattr *tb_comb[NUM_NL80211_IFACE_COMB];
static struct nla_policy iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = {
@@ -296,11 +347,30 @@
}
printf(",\n\t\t ");
- printf("total <= %d, #channels <= %d%s\n",
+ printf("total <= %d, #channels <= %d%s",
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" : "");
+ if (tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]) {
+ unsigned long widths = nla_get_u32(tb_comb[NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS]);
+
+ if (widths) {
+ int width;
+ bool first = true;
+
+ printf(", radar detect widths: {");
+ for (width = 0; width < 32; width++)
+ if (widths & (1 << width)) {
+ printf("%s %s",
+ first ? "":",",
+ channel_width_name(width));
+ first = false;
+ }
+ printf(" }\n");
+ }
+ }
+ printf("\n");
broken_combination:
;
}
@@ -354,14 +424,13 @@
[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),
- },
+ [NL80211_WOWLAN_TRIG_PKT_PATTERN] = { .minlen = 12 },
[NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED] = { .type = NLA_FLAG },
[NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE] = { .type = NLA_FLAG },
[NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST] = { .type = NLA_FLAG },
[NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE] = { .type = NLA_FLAG },
[NL80211_WOWLAN_TRIG_RFKILL_RELEASE] = { .type = NLA_FLAG },
+ [NL80211_WOWLAN_TRIG_TCP_CONNECTION] = { .type = NLA_NESTED },
};
struct nl80211_wowlan_pattern_support *pat;
int err;
@@ -382,8 +451,11 @@
printf("\t\t * wake up on magic packet\n");
if (tb_wowlan[NL80211_WOWLAN_TRIG_PKT_PATTERN]) {
pat = nla_data(tb_wowlan[NL80211_WOWLAN_TRIG_PKT_PATTERN]);
- printf("\t\t * wake up on pattern match, up to %u patterns of %u-%u bytes\n",
- pat->max_patterns, pat->min_pattern_len, pat->max_pattern_len);
+ printf("\t\t * wake up on pattern match, up to %u patterns of %u-%u bytes,\n"
+ "\t\t maximum packet offset %u bytes\n",
+ pat->max_patterns, pat->min_pattern_len, pat->max_pattern_len,
+ (nla_len(tb_wowlan[NL80211_WOWLAN_TRIG_PKT_PATTERN]) <
+ sizeof(*pat)) ? 0 : pat->max_pkt_offset);
}
if (tb_wowlan[NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED])
printf("\t\t * can do GTK rekeying\n");
@@ -395,6 +467,8 @@
printf("\t\t * wake up on 4-way handshake\n");
if (tb_wowlan[NL80211_WOWLAN_TRIG_RFKILL_RELEASE])
printf("\t\t * wake up on rfkill release\n");
+ if (tb_wowlan[NL80211_WOWLAN_TRIG_TCP_CONNECTION])
+ printf("\t\t * wake up on TCP connection\n");
}
}
@@ -457,12 +531,23 @@
return NL_SKIP;
}
+static bool nl80211_has_split_wiphy = false;
+
static int handle_info(struct nl80211_state *state,
struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
{
+ char *feat_args[] = { "features", "-q" };
+ int err;
+
+ err = handle_cmd(state, CIB_NONE, 2, feat_args);
+ if (!err && nl80211_has_split_wiphy) {
+ nla_put_flag(msg, NL80211_ATTR_SPLIT_WIPHY_DUMP);
+ nlmsg_hdr(msg)->nlmsg_flags |= NLM_F_DUMP;
+ }
+
nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_phy_handler, NULL);
return 0;
@@ -485,3 +570,38 @@
}
TOPLEVEL(commands, NULL, NL80211_CMD_GET_WIPHY, 0, CIB_NONE, handle_commands,
"list all known commands and their decimal & hex value");
+
+static int print_feature_handler(struct nl_msg *msg, void *arg)
+{
+ struct nlattr *tb_msg[NL80211_ATTR_MAX + 1];
+ struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
+ bool print = (unsigned long)arg;
+#define maybe_printf(...) do { if (print) printf(__VA_ARGS__); } while (0)
+
+ nla_parse(tb_msg, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+ genlmsg_attrlen(gnlh, 0), NULL);
+
+ if (tb_msg[NL80211_ATTR_PROTOCOL_FEATURES]) {
+ uint32_t feat = nla_get_u32(tb_msg[NL80211_ATTR_PROTOCOL_FEATURES]);
+
+ maybe_printf("nl80211 features: 0x%x\n", feat);
+ if (feat & NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP) {
+ maybe_printf("\t* split wiphy dump\n");
+ nl80211_has_split_wiphy = true;
+ }
+ }
+
+ return NL_SKIP;
+}
+
+static int handle_features(struct nl80211_state *state,
+ struct nl_cb *cb, struct nl_msg *msg,
+ int argc, char **argv, enum id_input id)
+{
+ unsigned long print = argc == 0 || strcmp(argv[0], "-q");
+ nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_feature_handler, (void *)print);
+ return 0;
+}
+
+TOPLEVEL(features, "", NL80211_CMD_GET_PROTOCOL_FEATURES, 0, CIB_NONE,
+ handle_features, "");
Modified: iw/branches/upstream/current/interface.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/interface.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/interface.c (original)
+++ iw/branches/upstream/current/interface.c Fri May 3 18:38:12 2013
@@ -262,7 +262,7 @@
}
}
-static char *channel_width_name(enum nl80211_chan_width width)
+char *channel_width_name(enum nl80211_chan_width width)
{
switch (width) {
case NL80211_CHAN_WIDTH_20_NOHT:
Modified: iw/branches/upstream/current/iw.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/iw.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/iw.c (original)
+++ iw/branches/upstream/current/iw.c Fri May 3 18:38:12 2013
@@ -34,6 +34,12 @@
{
nl_handle_destroy(h);
}
+
+static inline int nl_socket_set_buffer_size(struct nl_sock *sk,
+ int rxbuf, int txbuf)
+{
+ return nl_set_buffer_size(sk, rxbuf, txbuf);
+}
#endif /* CONFIG_LIBNL20 && CONFIG_LIBNL30 */
int iw_debug = 0;
@@ -47,6 +53,8 @@
fprintf(stderr, "Failed to allocate netlink socket.\n");
return -ENOMEM;
}
+
+ nl_socket_set_buffer_size(state->nl_sock, 8192, 8192);
if (genl_connect(state->nl_sock)) {
fprintf(stderr, "Failed to connect to generic netlink.\n");
Modified: iw/branches/upstream/current/iw.h
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/iw.h?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/iw.h (original)
+++ iw/branches/upstream/current/iw.h Fri May 3 18:38:12 2013
@@ -145,6 +145,7 @@
void print_ht_capability(__u16 cap);
void print_vht_info(__u32 capa, const __u8 *mcs);
+char *channel_width_name(enum nl80211_chan_width width);
const char *iftype_name(enum nl80211_iftype iftype);
const char *command_name(enum nl80211_commands cmd);
int ieee80211_channel_to_frequency(int chan);
@@ -169,6 +170,7 @@
void print_ies(unsigned char *ie, int ielen, bool unknown,
enum print_ie_type ptype);
+void parse_tx_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
DECLARE_SECTION(set);
DECLARE_SECTION(get);
Modified: iw/branches/upstream/current/link.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/link.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/link.c (original)
+++ iw/branches/upstream/current/link.c Fri May 3 18:38:12 2013
@@ -115,7 +115,6 @@
struct nlattr *tb[NL80211_ATTR_MAX + 1];
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 },
@@ -129,14 +128,6 @@
[NL80211_STA_INFO_PLID] = { .type = NLA_U16 },
[NL80211_STA_INFO_PLINK_STATE] = { .type = NLA_U8 },
};
-
- static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
- [NL80211_RATE_INFO_BITRATE] = { .type = NLA_U16 },
- [NL80211_RATE_INFO_BITRATE32] = { .type = NLA_U32 },
- [NL80211_RATE_INFO_MCS] = { .type = NLA_U8 },
- [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 },
@@ -172,27 +163,10 @@
(int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]));
if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
- if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX,
- sinfo[NL80211_STA_INFO_TX_BITRATE], rate_policy)) {
- fprintf(stderr, "failed to parse nested rate attributes!\n");
- } else {
- int rate = 0;
- printf("\ttx bitrate: ");
- if (rinfo[NL80211_RATE_INFO_BITRATE32])
- rate = nla_get_u32(rinfo[NL80211_RATE_INFO_BITRATE32]);
- else if (rinfo[NL80211_RATE_INFO_BITRATE])
- rate = nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]);
- if (rate > 0)
- printf("%d.%d MBit/s", rate / 10, rate % 10);
-
- if (rinfo[NL80211_RATE_INFO_MCS])
- printf(" MCS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_MCS]));
- if (rinfo[NL80211_RATE_INFO_40_MHZ_WIDTH])
- printf(" 40Mhz");
- if (rinfo[NL80211_RATE_INFO_SHORT_GI])
- printf(" short GI");
- printf("\n");
- }
+ char buf[100];
+
+ parse_tx_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof(buf));
+ printf("\ttx bitrate: %s\n", buf);
}
if (sinfo[NL80211_STA_INFO_BSS_PARAM]) {
Modified: iw/branches/upstream/current/mesh.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/mesh.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/mesh.c (original)
+++ iw/branches/upstream/current/mesh.c Fri May 3 18:38:12 2013
@@ -109,6 +109,23 @@
return 0;
}
+static uint32_t _parse_u32_power_mode(const char *str, _any *ret)
+{
+ unsigned long int v;
+
+ /* Parse attribute for the name of power mode */
+ if (!strcmp(str, "active"))
+ v = NL80211_MESH_POWER_ACTIVE;
+ else if (!strcmp(str, "light"))
+ v = NL80211_MESH_POWER_LIGHT_SLEEP;
+ else if (!strcmp(str, "deep"))
+ v = NL80211_MESH_POWER_DEEP_SLEEP;
+ else
+ return 0xff;
+
+ ret->u.as_32 = (uint32_t)v;
+ return 0;
+}
static void _print_u8(struct nlattr *a)
{
@@ -143,6 +160,26 @@
static void _print_u32_in_TUs(struct nlattr *a)
{
printf("%d TUs", nla_get_u32(a));
+}
+
+static void _print_u32_power_mode(struct nlattr *a)
+{
+ unsigned long v = nla_get_u32(a);
+
+ switch (v) {
+ case NL80211_MESH_POWER_ACTIVE:
+ printf("active");
+ break;
+ case NL80211_MESH_POWER_LIGHT_SLEEP:
+ printf("light");
+ break;
+ case NL80211_MESH_POWER_DEEP_SLEEP:
+ printf("deep");
+ break;
+ default:
+ printf("undefined");
+ break;
+ }
}
static void _print_s32_in_dBm(struct nlattr *a)
@@ -217,6 +254,10 @@
{"mesh_hwmp_confirmation_interval",
NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL,
_my_nla_put_u16, _parse_u16, _print_u16_in_TUs},
+ {"mesh_power_mode", NL80211_MESHCONF_POWER_MODE,
+ _my_nla_put_u32, _parse_u32_power_mode, _print_u32_power_mode},
+ {"mesh_awake_window", NL80211_MESHCONF_AWAKE_WINDOW,
+ _my_nla_put_u16, _parse_u16, _print_u16_in_TUs},
};
static void print_all_mesh_param_descr(void)
@@ -294,8 +335,15 @@
/* Parse the new value */
ret = mdescr->parse_fn(value, &any);
if (ret != 0) {
- printf("%s must be set to a number "
- "between 0 and %u\n", mdescr->name, ret);
+ if (mdescr->mesh_param_num
+ == NL80211_MESHCONF_POWER_MODE)
+ printf("%s must be set to active, light or "
+ "deep.\n", mdescr->name);
+ else
+ printf("%s must be set to a number "
+ "between 0 and %u\n",
+ mdescr->name, ret);
+
return 2;
}
@@ -383,6 +431,7 @@
{
struct nlattr *container;
float rate;
+ int bintval, dtim_period;
char *end;
if (argc < 1)
@@ -401,6 +450,32 @@
return 1;
NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, (int)(rate * 10));
+ argv++;
+ argc--;
+ }
+
+ if (argc > 1 && strcmp(argv[0], "beacon-interval") == 0) {
+ argc--;
+ argv++;
+
+ bintval = strtoul(argv[0], &end, 10);
+ if (*end != '\0')
+ return 1;
+
+ NLA_PUT_U32(msg, NL80211_ATTR_BEACON_INTERVAL, bintval);
+ argv++;
+ argc--;
+ }
+
+ if (argc > 1 && strcmp(argv[0], "dtim-period") == 0) {
+ argc--;
+ argv++;
+
+ dtim_period = strtoul(argv[0], &end, 10);
+ if (*end != '\0')
+ return 1;
+
+ NLA_PUT_U32(msg, NL80211_ATTR_DTIM_PERIOD, dtim_period);
argv++;
argc--;
}
@@ -431,8 +506,9 @@
nla_put_failure:
return -ENOBUFS;
}
-COMMAND(mesh, join, "<mesh ID> [mcast-rate <rate in Mbps>] [vendor_sync on|off]"
- " [<param>=<value>]*",
+COMMAND(mesh, join, "<mesh ID> [mcast-rate <rate in Mbps>]"
+ " [beacon-interval <time in TUs>] [dtim-period <value>]"
+ " [vendor_sync on|off] [<param>=<value>]*",
NL80211_CMD_JOIN_MESH, 0, CIB_NETDEV, join_mesh,
"Join a mesh with the given mesh ID with mcast-rate and mesh parameters.");
Modified: iw/branches/upstream/current/mpath.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/mpath.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/mpath.c (original)
+++ iw/branches/upstream/current/mpath.c Fri May 3 18:38:12 2013
@@ -21,12 +21,6 @@
ESTAB,
HOLDING,
BLOCKED
-};
-
-enum plink_actions {
- PLINK_ACTION_UNDEFINED,
- PLINK_ACTION_OPEN,
- PLINK_ACTION_BLOCK,
};
Modified: iw/branches/upstream/current/nl80211.h
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/nl80211.h?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/nl80211.h (original)
+++ iw/branches/upstream/current/nl80211.h Fri May 3 18:38:12 2013
@@ -36,7 +36,21 @@
* The station is still assumed to belong to the AP interface it was added
* to.
*
- * TODO: need more info?
+ * Station handling varies per interface type and depending on the driver's
+ * capabilities.
+ *
+ * For drivers supporting TDLS with external setup (WIPHY_FLAG_SUPPORTS_TDLS
+ * and WIPHY_FLAG_TDLS_EXTERNAL_SETUP), the station lifetime is as follows:
+ * - a setup station entry is added, not yet authorized, without any rate
+ * or capability information, this just exists to avoid race conditions
+ * - when the TDLS setup is done, a single NL80211_CMD_SET_STATION is valid
+ * to add rate and capability information to the station and at the same
+ * time mark it authorized.
+ * - %NL80211_TDLS_ENABLE_LINK is then used
+ * - after this, the only valid operation is to remove it by tearing down
+ * the TDLS link (%NL80211_TDLS_DISABLE_LINK)
+ *
+ * TODO: need more info for other interface types
*/
/**
@@ -170,7 +184,8 @@
* %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE,
* %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS,
* %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
- * %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT.
+ * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_INACTIVITY_TIMEOUT,
+ * %NL80211_ATTR_ACL_POLICY and %NL80211_ATTR_MAC_ADDRS.
* The channel to use can be set on the interface or be given using the
* %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel width.
* @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
@@ -374,8 +389,8 @@
* requests to connect to a specified network but without separating
* auth and assoc steps. For this, you need to specify the SSID in a
* %NL80211_ATTR_SSID attribute, and can optionally specify the association
- * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC,
- * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
+ * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP,
+ * %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
* %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and
* %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT.
* Background scan period can optionally be
@@ -498,9 +513,11 @@
* @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
+ * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH,
+ * @NL80211_MESH_SETUP_USERSPACE_AMPE, or
+ * @NL80211_MESH_SETUP_USERSPACE_MPM 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.
@@ -512,6 +529,12 @@
* command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
* more background information, see
* http://wireless.kernel.org/en/users/Documentation/WoWLAN.
+ * The @NL80211_CMD_SET_WOWLAN command can also be used as a notification
+ * from the driver reporting the wakeup reason. In this case, the
+ * @NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason
+ * for the wakeup, if it was caused by wireless. If it is not present
+ * in the wakeup notification, the wireless device didn't cause the
+ * wakeup but reports that it was woken up.
*
* @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver
* the necessary information for supporting GTK rekey offload. This
@@ -586,6 +609,43 @@
* @NL80211_CMD_SET_MCAST_RATE: Change the rate used to send multicast frames
* for IBSS or MESH vif.
*
+ * @NL80211_CMD_SET_MAC_ACL: sets ACL for MAC address based access control.
+ * This is to be used with the drivers advertising the support of MAC
+ * address based access control. List of MAC addresses is passed in
+ * %NL80211_ATTR_MAC_ADDRS and ACL policy is passed in
+ * %NL80211_ATTR_ACL_POLICY. Driver will enable ACL with this list, if it
+ * is not already done. The new list will replace any existing list. Driver
+ * will clear its ACL when the list of MAC addresses passed is empty. This
+ * command is used in AP/P2P GO mode. Driver has to make sure to clear its
+ * ACL list during %NL80211_CMD_STOP_AP.
+ *
+ * @NL80211_CMD_RADAR_DETECT: Start a Channel availability check (CAC). Once
+ * a radar is detected or the channel availability scan (CAC) has finished
+ * or was aborted, or a radar was detected, usermode will be notified with
+ * this event. This command is also used to notify userspace about radars
+ * while operating on this channel.
+ * %NL80211_ATTR_RADAR_EVENT is used to inform about the type of the
+ * event.
+ *
+ * @NL80211_CMD_GET_PROTOCOL_FEATURES: Get global nl80211 protocol features,
+ * i.e. features for the nl80211 protocol rather than device features.
+ * Returns the features in the %NL80211_ATTR_PROTOCOL_FEATURES bitmap.
+ *
+ * @NL80211_CMD_UPDATE_FT_IES: Pass down the most up-to-date Fast Transition
+ * Information Element to the WLAN driver
+ *
+ * @NL80211_CMD_FT_EVENT: Send a Fast transition event from the WLAN driver
+ * to the supplicant. This will carry the target AP's MAC address along
+ * with the relevant Information Elements. This event is used to report
+ * received FT IEs (MDIE, FTIE, RSN IE, TIE, RICIE).
+ *
+ * @NL80211_CMD_CRIT_PROTOCOL_START: Indicates user-space will start running
+ * a critical protocol that needs more reliability in the connection to
+ * complete.
+ *
+ * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can
+ * return back to normal.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -735,6 +795,18 @@
NL80211_CMD_CONN_FAILED,
NL80211_CMD_SET_MCAST_RATE,
+
+ NL80211_CMD_SET_MAC_ACL,
+
+ NL80211_CMD_RADAR_DETECT,
+
+ NL80211_CMD_GET_PROTOCOL_FEATURES,
+
+ NL80211_CMD_UPDATE_FT_IES,
+ NL80211_CMD_FT_EVENT,
+
+ NL80211_CMD_CRIT_PROTOCOL_START,
+ NL80211_CMD_CRIT_PROTOCOL_STOP,
/* add new commands above here */
@@ -855,7 +927,8 @@
* consisting of a nested array.
*
* @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes).
- * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link.
+ * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link
+ * (see &enum nl80211_plink_action).
* @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
@@ -958,7 +1031,7 @@
* @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is
* used for the association (&enum nl80211_mfp, represented as a u32);
* this attribute can be used
- * with %NL80211_CMD_ASSOCIATE request
+ * with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests
*
* @NL80211_ATTR_STA_FLAGS2: Attribute containing a
* &struct nl80211_sta_flag_update.
@@ -1138,10 +1211,10 @@
* @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_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 or
+ * @NL80211_MESH_SETUP_USERSPACE_MPM must be enabled.
*
* @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy
* capabilities, the supported WoWLAN triggers
@@ -1310,6 +1383,52 @@
* if not given in START_AP 0 is assumed, if not given in SET_BSS
* no change is made.
*
+ * @NL80211_ATTR_LOCAL_MESH_POWER_MODE: local mesh STA link-specific power mode
+ * defined in &enum nl80211_mesh_power_mode.
+ *
+ * @NL80211_ATTR_ACL_POLICY: ACL policy, see &enum nl80211_acl_policy,
+ * carried in a u32 attribute
+ *
+ * @NL80211_ATTR_MAC_ADDRS: Array of nested MAC addresses, used for
+ * MAC ACL.
+ *
+ * @NL80211_ATTR_MAC_ACL_MAX: u32 attribute to advertise the maximum
+ * number of MAC addresses that a device can support for MAC
+ * ACL.
+ *
+ * @NL80211_ATTR_RADAR_EVENT: Type of radar event for notification to userspace,
+ * contains a value of enum nl80211_radar_event (u32).
+ *
+ * @NL80211_ATTR_EXT_CAPA: 802.11 extended capabilities that the kernel driver
+ * has and handles. The format is the same as the IE contents. See
+ * 802.11-2012 8.4.2.29 for more information.
+ * @NL80211_ATTR_EXT_CAPA_MASK: Extended capabilities that the kernel driver
+ * has set in the %NL80211_ATTR_EXT_CAPA value, for multibit fields.
+ *
+ * @NL80211_ATTR_STA_CAPABILITY: Station capabilities (u16) are advertised to
+ * the driver, e.g., to enable TDLS power save (PU-APSD).
+ *
+ * @NL80211_ATTR_STA_EXT_CAPABILITY: Station extended capabilities are
+ * advertised to the driver, e.g., to enable TDLS off channel operations
+ * and PU-APSD.
+ *
+ * @NL80211_ATTR_PROTOCOL_FEATURES: global nl80211 feature flags, see
+ * &enum nl80211_protocol_features, the attribute is a u32.
+ *
+ * @NL80211_ATTR_SPLIT_WIPHY_DUMP: flag attribute, userspace supports
+ * receiving the data for a single wiphy split across multiple
+ * messages, given with wiphy dump message
+ *
+ * @NL80211_ATTR_MDID: Mobility Domain Identifier
+ *
+ * @NL80211_ATTR_IE_RIC: Resource Information Container Information
+ * Element
+ *
+ * @NL80211_ATTR_CRIT_PROT_ID: critical protocol identifier requiring increased
+ * reliability, see &enum nl80211_crit_proto_id (u16).
+ * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which
+ * the connection should have increased reliability (u16).
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1579,6 +1698,34 @@
NL80211_ATTR_P2P_CTWINDOW,
NL80211_ATTR_P2P_OPPPS,
+
+ NL80211_ATTR_LOCAL_MESH_POWER_MODE,
+
+ NL80211_ATTR_ACL_POLICY,
+
+ NL80211_ATTR_MAC_ADDRS,
+
+ NL80211_ATTR_MAC_ACL_MAX,
+
+ NL80211_ATTR_RADAR_EVENT,
+
+ NL80211_ATTR_EXT_CAPA,
+ NL80211_ATTR_EXT_CAPA_MASK,
+
+ NL80211_ATTR_STA_CAPABILITY,
+ NL80211_ATTR_STA_EXT_CAPABILITY,
+
+ NL80211_ATTR_PROTOCOL_FEATURES,
+ NL80211_ATTR_SPLIT_WIPHY_DUMP,
+
+ NL80211_ATTR_DISABLE_VHT,
+ NL80211_ATTR_VHT_CAPABILITY_MASK,
+
+ NL80211_ATTR_MDID,
+ NL80211_ATTR_IE_RIC,
+
+ NL80211_ATTR_CRIT_PROT_ID,
+ NL80211_ATTR_MAX_CRIT_PROT_DURATION,
/* add attributes here, update the policy in nl80211.c */
@@ -1697,6 +1844,9 @@
* flag can't be changed, it is only valid while adding a station, and
* attempts to change it will silently be ignored (rather than rejected
* as errors.)
+ * @NL80211_STA_FLAG_ASSOCIATED: station is associated; used with drivers
+ * that support %NL80211_FEATURE_FULL_AP_CLIENT_STATE to transition a
+ * previously added station into associated state
* @NL80211_STA_FLAG_MAX: highest station flag number currently defined
* @__NL80211_STA_FLAG_AFTER_LAST: internal use
*/
@@ -1708,6 +1858,7 @@
NL80211_STA_FLAG_MFP,
NL80211_STA_FLAG_AUTHENTICATED,
NL80211_STA_FLAG_TDLS_PEER,
+ NL80211_STA_FLAG_ASSOCIATED,
/* keep last */
__NL80211_STA_FLAG_AFTER_LAST,
@@ -1813,6 +1964,8 @@
* @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_RX_BYTES64: total received bytes (u64, from this station)
+ * @NL80211_STA_INFO_TX_BYTES64: total transmitted bytes (u64, to this station)
* @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_rate_info
@@ -1834,6 +1987,10 @@
* @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
* @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
* @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64)
+ * @NL80211_STA_INFO_LOCAL_PM: local mesh STA link-specific power mode
+ * @NL80211_STA_INFO_PEER_PM: peer mesh STA link-specific power mode
+ * @NL80211_STA_INFO_NONPEER_PM: neighbor mesh STA power save mode towards
+ * non-peer STA
* @__NL80211_STA_INFO_AFTER_LAST: internal
* @NL80211_STA_INFO_MAX: highest possible station info attribute
*/
@@ -1858,6 +2015,11 @@
NL80211_STA_INFO_STA_FLAGS,
NL80211_STA_INFO_BEACON_LOSS,
NL80211_STA_INFO_T_OFFSET,
+ NL80211_STA_INFO_LOCAL_PM,
+ NL80211_STA_INFO_PEER_PM,
+ NL80211_STA_INFO_NONPEER_PM,
+ NL80211_STA_INFO_RX_BYTES64,
+ NL80211_STA_INFO_TX_BYTES64,
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
@@ -1967,6 +2129,20 @@
* on this channel in current regulatory domain.
* @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
* (100 * dBm).
+ * @NL80211_FREQUENCY_ATTR_DFS_STATE: current state for DFS
+ * (enum nl80211_dfs_state)
+ * @NL80211_FREQUENCY_ATTR_DFS_TIME: time in miliseconds for how long
+ * this channel is in this DFS state.
+ * @NL80211_FREQUENCY_ATTR_NO_HT40_MINUS: HT40- isn't possible with this
+ * channel as the control channel
+ * @NL80211_FREQUENCY_ATTR_NO_HT40_PLUS: HT40+ isn't possible with this
+ * channel as the control channel
+ * @NL80211_FREQUENCY_ATTR_NO_80MHZ: any 80 MHz channel using this channel
+ * as the primary or any of the secondary channels isn't possible,
+ * this includes 80+80 channels
+ * @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel
+ * using this channel as the primary or any of the secondary channels
+ * isn't possible
* @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
* currently defined
* @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -1979,6 +2155,12 @@
NL80211_FREQUENCY_ATTR_NO_IBSS,
NL80211_FREQUENCY_ATTR_RADAR,
NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
+ NL80211_FREQUENCY_ATTR_DFS_STATE,
+ NL80211_FREQUENCY_ATTR_DFS_TIME,
+ NL80211_FREQUENCY_ATTR_NO_HT40_MINUS,
+ NL80211_FREQUENCY_ATTR_NO_HT40_PLUS,
+ NL80211_FREQUENCY_ATTR_NO_80MHZ,
+ NL80211_FREQUENCY_ATTR_NO_160MHZ,
/* keep last */
__NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -2249,6 +2431,34 @@
};
/**
+ * enum nl80211_mesh_power_mode - mesh power save modes
+ *
+ * @NL80211_MESH_POWER_UNKNOWN: The mesh power mode of the mesh STA is
+ * not known or has not been set yet.
+ * @NL80211_MESH_POWER_ACTIVE: Active mesh power mode. The mesh STA is
+ * in Awake state all the time.
+ * @NL80211_MESH_POWER_LIGHT_SLEEP: Light sleep mode. The mesh STA will
+ * alternate between Active and Doze states, but will wake up for
+ * neighbor's beacons.
+ * @NL80211_MESH_POWER_DEEP_SLEEP: Deep sleep mode. The mesh STA will
+ * alternate between Active and Doze states, but may not wake up
+ * for neighbor's beacons.
+ *
+ * @__NL80211_MESH_POWER_AFTER_LAST - internal use
+ * @NL80211_MESH_POWER_MAX - highest possible power save level
+ */
+
+enum nl80211_mesh_power_mode {
+ NL80211_MESH_POWER_UNKNOWN,
+ NL80211_MESH_POWER_ACTIVE,
+ NL80211_MESH_POWER_LIGHT_SLEEP,
+ NL80211_MESH_POWER_DEEP_SLEEP,
+
+ __NL80211_MESH_POWER_AFTER_LAST,
+ NL80211_MESH_POWER_MAX = __NL80211_MESH_POWER_AFTER_LAST - 1
+};
+
+/**
* enum nl80211_meshconf_params - mesh configuration parameters
*
* Mesh configuration parameters. These can be changed while the mesh is
@@ -2275,8 +2485,10 @@
* @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
* point.
*
- * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically
- * open peer links when we detect compatible mesh peers.
+ * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically open
+ * peer links when we detect compatible mesh peers. Disabled if
+ * @NL80211_MESH_SETUP_USERSPACE_MPM or @NL80211_MESH_SETUP_USERSPACE_AMPE are
+ * set.
*
* @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames
* containing a PREQ that an MP can send to a particular destination (path
@@ -2341,6 +2553,11 @@
* @NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL: The minimum interval of time
* (in TUs) during which a mesh STA can send only one Action frame
* containing a PREQ element for root path confirmation.
+ *
+ * @NL80211_MESHCONF_POWER_MODE: Default mesh power mode for new peer links.
+ * type &enum nl80211_mesh_power_mode (u32)
+ *
+ * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs)
*
* @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
*/
@@ -2371,6 +2588,8 @@
NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT,
NL80211_MESHCONF_HWMP_ROOT_INTERVAL,
NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL,
+ NL80211_MESHCONF_POWER_MODE,
+ NL80211_MESHCONF_AWAKE_WINDOW,
/* keep last */
__NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2415,6 +2634,9 @@
* vendor specific synchronization method or disable it to use the default
* neighbor offset synchronization
*
+ * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will
+ * implement an MPM which handles peer allocation and state.
+ *
* @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
*
* @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
@@ -2427,6 +2649,7 @@
NL80211_MESH_SETUP_USERSPACE_AUTH,
NL80211_MESH_SETUP_USERSPACE_AMPE,
NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC,
+ NL80211_MESH_SETUP_USERSPACE_MPM,
/* keep last */
__NL80211_MESH_SETUP_ATTR_AFTER_LAST,
@@ -2816,10 +3039,12 @@
* 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".
+ * twelve zero bytes, and a mask of "0xed,0x01".
* 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.
+ * @NL80211_WOWLAN_PKTPAT_OFFSET: packet offset, pattern is matched after
+ * these fixed number of bytes of received packet
* @NUM_NL80211_WOWLAN_PKTPAT: number of attributes
* @MAX_NL80211_WOWLAN_PKTPAT: max attribute number
*/
@@ -2827,6 +3052,7 @@
__NL80211_WOWLAN_PKTPAT_INVALID,
NL80211_WOWLAN_PKTPAT_MASK,
NL80211_WOWLAN_PKTPAT_PATTERN,
+ NL80211_WOWLAN_PKTPAT_OFFSET,
NUM_NL80211_WOWLAN_PKTPAT,
MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1,
@@ -2837,6 +3063,7 @@
* @max_patterns: maximum number of patterns supported
* @min_pattern_len: minimum length of each pattern
* @max_pattern_len: maximum length of each pattern
+ * @max_pkt_offset: maximum Rx packet offset
*
* This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when
* that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the
@@ -2846,6 +3073,7 @@
__u32 max_patterns;
__u32 min_pattern_len;
__u32 max_pattern_len;
+ __u32 max_pkt_offset;
} __attribute__((packed));
/**
@@ -2861,12 +3089,17 @@
* @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.
+ * Each pattern defines a wakeup packet. Packet offset is associated with
+ * each pattern which is used while matching the pattern. 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.
+ *
+ * When reporting wakeup. it is a u32 attribute containing the 0-based
+ * index of the pattern that caused the wakeup, in the patterns passed
+ * to the kernel when configuring.
* @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be
* used when setting, used only to indicate that GTK rekeying is supported
* by the device (flag)
@@ -2877,8 +3110,36 @@
* @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag)
* @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released
* (on devices that have rfkill in the device) (flag)
+ * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211: For wakeup reporting only, contains
+ * the 802.11 packet that caused the wakeup, e.g. a deauth frame. The frame
+ * may be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN
+ * attribute contains the original length.
+ * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN: Original length of the 802.11
+ * packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211
+ * attribute if the packet was truncated somewhere.
+ * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023: For wakeup reporting only, contains the
+ * 802.11 packet that caused the wakeup, e.g. a magic packet. The frame may
+ * be truncated, the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN attribute
+ * contains the original length.
+ * @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN: Original length of the 802.3
+ * packet, may be bigger than the @NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023
+ * attribute if the packet was truncated somewhere.
+ * @NL80211_WOWLAN_TRIG_TCP_CONNECTION: TCP connection wake, see DOC section
+ * "TCP connection wakeup" for more details. This is a nested attribute
+ * containing the exact information for establishing and keeping alive
+ * the TCP connection.
+ * @NL80211_WOWLAN_TRIG_TCP_WAKEUP_MATCH: For wakeup reporting only, the
+ * wakeup packet was received on the TCP connection
+ * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST: For wakeup reporting only, the
+ * TCP connection was lost or failed to be established
+ * @NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS: For wakeup reporting only,
+ * the TCP connection ran out of tokens to use for data to send to the
+ * service
* @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
* @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
+ *
+ * These nested attributes are used to configure the wakeup triggers and
+ * to report the wakeup reason(s).
*/
enum nl80211_wowlan_triggers {
__NL80211_WOWLAN_TRIG_INVALID,
@@ -2891,10 +3152,128 @@
NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST,
NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE,
NL80211_WOWLAN_TRIG_RFKILL_RELEASE,
+ NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211,
+ NL80211_WOWLAN_TRIG_WAKEUP_PKT_80211_LEN,
+ NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023,
+ NL80211_WOWLAN_TRIG_WAKEUP_PKT_8023_LEN,
+ NL80211_WOWLAN_TRIG_TCP_CONNECTION,
+ NL80211_WOWLAN_TRIG_WAKEUP_TCP_MATCH,
+ NL80211_WOWLAN_TRIG_WAKEUP_TCP_CONNLOST,
+ NL80211_WOWLAN_TRIG_WAKEUP_TCP_NOMORETOKENS,
/* keep last */
NUM_NL80211_WOWLAN_TRIG,
MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1
+};
+
+/**
+ * DOC: TCP connection wakeup
+ *
+ * Some devices can establish a TCP connection in order to be woken up by a
+ * packet coming in from outside their network segment, or behind NAT. If
+ * configured, the device will establish a TCP connection to the given
+ * service, and periodically send data to that service. The first data
+ * packet is usually transmitted after SYN/ACK, also ACKing the SYN/ACK.
+ * The data packets can optionally include a (little endian) sequence
+ * number (in the TCP payload!) that is generated by the device, and, also
+ * optionally, a token from a list of tokens. This serves as a keep-alive
+ * with the service, and for NATed connections, etc.
+ *
+ * During this keep-alive period, the server doesn't send any data to the
+ * client. When receiving data, it is compared against the wakeup pattern
+ * (and mask) and if it matches, the host is woken up. Similarly, if the
+ * connection breaks or cannot be established to start with, the host is
+ * also woken up.
+ *
+ * Developer's note: ARP offload is required for this, otherwise TCP
+ * response packets might not go through correctly.
+ */
+
+/**
+ * struct nl80211_wowlan_tcp_data_seq - WoWLAN TCP data sequence
+ * @start: starting value
+ * @offset: offset of sequence number in packet
+ * @len: length of the sequence value to write, 1 through 4
+ *
+ * Note: don't confuse with the TCP sequence number(s), this is for the
+ * keepalive packet payload. The actual value is written into the packet
+ * in little endian.
+ */
+struct nl80211_wowlan_tcp_data_seq {
+ __u32 start, offset, len;
+};
+
+/**
+ * struct nl80211_wowlan_tcp_data_token - WoWLAN TCP data token config
+ * @offset: offset of token in packet
+ * @len: length of each token
+ * @token_stream: stream of data to be used for the tokens, the length must
+ * be a multiple of @len for this to make sense
+ */
+struct nl80211_wowlan_tcp_data_token {
+ __u32 offset, len;
+ __u8 token_stream[];
+};
+
+/**
+ * struct nl80211_wowlan_tcp_data_token_feature - data token features
+ * @min_len: minimum token length
+ * @max_len: maximum token length
+ * @bufsize: total available token buffer size (max size of @token_stream)
+ */
+struct nl80211_wowlan_tcp_data_token_feature {
+ __u32 min_len, max_len, bufsize;
+};
+
+/**
+ * enum nl80211_wowlan_tcp_attrs - WoWLAN TCP connection parameters
+ * @__NL80211_WOWLAN_TCP_INVALID: invalid number for nested attributes
+ * @NL80211_WOWLAN_TCP_SRC_IPV4: source IPv4 address (in network byte order)
+ * @NL80211_WOWLAN_TCP_DST_IPV4: destination IPv4 address
+ * (in network byte order)
+ * @NL80211_WOWLAN_TCP_DST_MAC: destination MAC address, this is given because
+ * route lookup when configured might be invalid by the time we suspend,
+ * and doing a route lookup when suspending is no longer possible as it
+ * might require ARP querying.
+ * @NL80211_WOWLAN_TCP_SRC_PORT: source port (u16); optional, if not given a
+ * socket and port will be allocated
+ * @NL80211_WOWLAN_TCP_DST_PORT: destination port (u16)
+ * @NL80211_WOWLAN_TCP_DATA_PAYLOAD: data packet payload, at least one byte.
+ * For feature advertising, a u32 attribute holding the maximum length
+ * of the data payload.
+ * @NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ: data packet sequence configuration
+ * (if desired), a &struct nl80211_wowlan_tcp_data_seq. For feature
+ * advertising it is just a flag
+ * @NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN: data packet token configuration,
+ * see &struct nl80211_wowlan_tcp_data_token and for advertising see
+ * &struct nl80211_wowlan_tcp_data_token_feature.
+ * @NL80211_WOWLAN_TCP_DATA_INTERVAL: data interval in seconds, maximum
+ * interval in feature advertising (u32)
+ * @NL80211_WOWLAN_TCP_WAKE_PAYLOAD: wake packet payload, for advertising a
+ * u32 attribute holding the maximum length
+ * @NL80211_WOWLAN_TCP_WAKE_MASK: Wake packet payload mask, not used for
+ * feature advertising. The mask works like @NL80211_WOWLAN_PKTPAT_MASK
+ * but on the TCP payload only.
+ * @NUM_NL80211_WOWLAN_TCP: number of TCP attributes
+ * @MAX_NL80211_WOWLAN_TCP: highest attribute number
+ */
+enum nl80211_wowlan_tcp_attrs {
+ __NL80211_WOWLAN_TCP_INVALID,
+ NL80211_WOWLAN_TCP_SRC_IPV4,
+ NL80211_WOWLAN_TCP_DST_IPV4,
+ NL80211_WOWLAN_TCP_DST_MAC,
+ NL80211_WOWLAN_TCP_SRC_PORT,
+ NL80211_WOWLAN_TCP_DST_PORT,
+ NL80211_WOWLAN_TCP_DATA_PAYLOAD,
+ NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ,
+ NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN,
+ NL80211_WOWLAN_TCP_DATA_INTERVAL,
+ NL80211_WOWLAN_TCP_WAKE_PAYLOAD,
+ NL80211_WOWLAN_TCP_WAKE_MASK,
+
+ /* keep last */
+ NUM_NL80211_WOWLAN_TCP,
+ MAX_NL80211_WOWLAN_TCP = NUM_NL80211_WOWLAN_TCP - 1
};
/**
@@ -2933,6 +3312,8 @@
* the infrastructure network's beacon interval.
* @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many
* different channels may be used within this group.
+ * @NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS: u32 attribute containing the bitmap
+ * of supported channel widths for radar detection.
* @NUM_NL80211_IFACE_COMB: number of attributes
* @MAX_NL80211_IFACE_COMB: highest attribute number
*
@@ -2965,6 +3346,7 @@
NL80211_IFACE_COMB_MAXNUM,
NL80211_IFACE_COMB_STA_AP_BI_MATCH,
NL80211_IFACE_COMB_NUM_CHANNELS,
+ NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
/* keep last */
NUM_NL80211_IFACE_COMB,
@@ -3003,6 +3385,23 @@
NUM_NL80211_PLINK_STATES,
MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1
};
+
+/**
+ * enum nl80211_plink_action - actions to perform in mesh peers
+ *
+ * @NL80211_PLINK_ACTION_NO_ACTION: perform no action
+ * @NL80211_PLINK_ACTION_OPEN: start mesh peer link establishment
+ * @NL80211_PLINK_ACTION_BLOCK: block traffic from this mesh peer
+ * @NUM_NL80211_PLINK_ACTIONS: number of possible actions
+ */
+enum plink_actions {
+ NL80211_PLINK_ACTION_NO_ACTION,
+ NL80211_PLINK_ACTION_OPEN,
+ NL80211_PLINK_ACTION_BLOCK,
+
+ NUM_NL80211_PLINK_ACTIONS,
+};
+
#define NL80211_KCK_LEN 16
#define NL80211_KEK_LEN 16
@@ -3140,6 +3539,23 @@
* setting
* @NL80211_FEATURE_P2P_GO_OPPPS: P2P GO implementation supports opportunistic
* powersave
+ * @NL80211_FEATURE_FULL_AP_CLIENT_STATE: The driver supports full state
+ * transitions for AP clients. Without this flag (and if the driver
+ * doesn't have the AP SME in the device) the driver supports adding
+ * stations only when they're associated and adds them in associated
+ * state (to later be transitioned into authorized), with this flag
+ * they should be added before even sending the authentication reply
+ * and then transitioned into authenticated, associated and authorized
+ * states using station flags.
+ * Note that even for drivers that support this, the default is to add
+ * stations in authenticated/associated state, so to add unauthenticated
+ * stations the authenticated/associated bits have to be set in the mask.
+ * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits
+ * (HT40, VHT 80/160 MHz) if this flag is set
+ * @NL80211_FEATURE_USERSPACE_MPM: This driver supports a userspace Mesh
+ * Peering Management entity which may be implemented by registering for
+ * beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is
+ * still generated by the driver.
*/
enum nl80211_feature_flags {
NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -3155,6 +3571,10 @@
NL80211_FEATURE_NEED_OBSS_SCAN = 1 << 10,
NL80211_FEATURE_P2P_GO_CTWIN = 1 << 11,
NL80211_FEATURE_P2P_GO_OPPPS = 1 << 12,
+ /* bit 13 is reserved */
+ NL80211_FEATURE_ADVERTISE_CHAN_LIMITS = 1 << 14,
+ NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15,
+ NL80211_FEATURE_USERSPACE_MPM = 1 << 16,
};
/**
@@ -3182,7 +3602,7 @@
* enum nl80211_connect_failed_reason - connection request failed reasons
* @NL80211_CONN_FAIL_MAX_CLIENTS: Maximum number of clients that can be
* handled by the AP is reached.
- * @NL80211_CONN_FAIL_BLOCKED_CLIENT: Client's MAC is in the AP's blocklist.
+ * @NL80211_CONN_FAIL_BLOCKED_CLIENT: Connection request is rejected due to ACL.
*/
enum nl80211_connect_failed_reason {
NL80211_CONN_FAIL_MAX_CLIENTS,
@@ -3210,4 +3630,95 @@
NL80211_SCAN_FLAG_AP = 1<<2,
};
+/**
+ * enum nl80211_acl_policy - access control policy
+ *
+ * Access control policy is applied on a MAC list set by
+ * %NL80211_CMD_START_AP and %NL80211_CMD_SET_MAC_ACL, to
+ * be used with %NL80211_ATTR_ACL_POLICY.
+ *
+ * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are
+ * listed in ACL, i.e. allow all the stations which are not listed
+ * in ACL to authenticate.
+ * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow the stations which are listed
+ * in ACL, i.e. deny all the stations which are not listed in ACL.
+ */
+enum nl80211_acl_policy {
+ NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED,
+ NL80211_ACL_POLICY_DENY_UNLESS_LISTED,
+};
+
+/**
+ * enum nl80211_radar_event - type of radar event for DFS operation
+ *
+ * Type of event to be used with NL80211_ATTR_RADAR_EVENT to inform userspace
+ * about detected radars or success of the channel available check (CAC)
+ *
+ * @NL80211_RADAR_DETECTED: A radar pattern has been detected. The channel is
+ * now unusable.
+ * @NL80211_RADAR_CAC_FINISHED: Channel Availability Check has been finished,
+ * the channel is now available.
+ * @NL80211_RADAR_CAC_ABORTED: Channel Availability Check has been aborted, no
+ * change to the channel status.
+ * @NL80211_RADAR_NOP_FINISHED: The Non-Occupancy Period for this channel is
+ * over, channel becomes usable.
+ */
+enum nl80211_radar_event {
+ NL80211_RADAR_DETECTED,
+ NL80211_RADAR_CAC_FINISHED,
+ NL80211_RADAR_CAC_ABORTED,
+ NL80211_RADAR_NOP_FINISHED,
+};
+
+/**
+ * enum nl80211_dfs_state - DFS states for channels
+ *
+ * Channel states used by the DFS code.
+ *
+ * @IEEE80211_DFS_USABLE: The channel can be used, but channel availability
+ * check (CAC) must be performed before using it for AP or IBSS.
+ * @IEEE80211_DFS_UNAVAILABLE: A radar has been detected on this channel, it
+ * is therefore marked as not available.
+ * @IEEE80211_DFS_AVAILABLE: The channel has been CAC checked and is available.
+ */
+
+enum nl80211_dfs_state {
+ NL80211_DFS_USABLE,
+ NL80211_DFS_UNAVAILABLE,
+ NL80211_DFS_AVAILABLE,
+};
+
+/**
+ * enum enum nl80211_protocol_features - nl80211 protocol features
+ * @NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP: nl80211 supports splitting
+ * wiphy dumps (if requested by the application with the attribute
+ * %NL80211_ATTR_SPLIT_WIPHY_DUMP. Also supported is filtering the
+ * wiphy dump by %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFINDEX or
+ * %NL80211_ATTR_WDEV.
+ */
+enum nl80211_protocol_features {
+ NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP = 1 << 0,
+};
+
+/**
+ * enum nl80211_crit_proto_id - nl80211 critical protocol identifiers
+ *
+ * @NL80211_CRIT_PROTO_UNSPEC: protocol unspecified.
+ * @NL80211_CRIT_PROTO_DHCP: BOOTP or DHCPv6 protocol.
+ * @NL80211_CRIT_PROTO_EAPOL: EAPOL protocol.
+ * @NL80211_CRIT_PROTO_APIPA: APIPA protocol.
+ * @NUM_NL80211_CRIT_PROTO: must be kept last.
+ */
+enum nl80211_crit_proto_id {
+ NL80211_CRIT_PROTO_UNSPEC,
+ NL80211_CRIT_PROTO_DHCP,
+ NL80211_CRIT_PROTO_EAPOL,
+ NL80211_CRIT_PROTO_APIPA,
+ /* add other protocols before this one */
+ NUM_NL80211_CRIT_PROTO
+};
+
+/* maximum duration for critical protocol measures */
+#define NL80211_CRIT_PROTO_MAX_DURATION 5000 /* msec */
+
#endif /* __LINUX_NL80211_H */
Modified: iw/branches/upstream/current/reg.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/reg.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/reg.c (original)
+++ iw/branches/upstream/current/reg.c Fri May 3 18:38:12 2013
@@ -59,6 +59,22 @@
}
}
+static const char *dfs_domain_name(enum nl80211_dfs_regions region)
+{
+ switch (region) {
+ case NL80211_DFS_UNSET:
+ return "DFS-UNSET";
+ case NL80211_DFS_FCC:
+ return "DFS-FCC";
+ case NL80211_DFS_ETSI:
+ return "DFS-ETSI";
+ case NL80211_DFS_JP:
+ return "DFS-JP";
+ default:
+ return "DFS-invalid";
+ }
+}
+
static int handle_reg_set(struct nl80211_state *state,
struct nl_cb *cb,
struct nl_msg *msg,
@@ -110,6 +126,7 @@
char *alpha2;
struct nlattr *nl_rule;
int rem_rule;
+ enum nl80211_dfs_regions dfs_domain;
static struct nla_policy reg_rule_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
[NL80211_ATTR_REG_RULE_FLAGS] = { .type = NLA_U32 },
[NL80211_ATTR_FREQ_RANGE_START] = { .type = NLA_U32 },
@@ -132,8 +149,13 @@
return NL_SKIP;
}
+ if (tb_msg[NL80211_ATTR_DFS_REGION])
+ dfs_domain = nla_get_u8(tb_msg[NL80211_ATTR_DFS_REGION]);
+ else
+ dfs_domain = NL80211_DFS_UNSET;
+
alpha2 = nla_data(tb_msg[NL80211_ATTR_REG_ALPHA2]);
- printf("country %c%c:\n", alpha2[0], alpha2[1]);
+ printf("country %c%c: %s\n", alpha2[0], alpha2[1], dfs_domain_name(dfs_domain));
nla_for_each_nested(nl_rule, tb_msg[NL80211_ATTR_REG_RULES], rem_rule) {
struct nlattr *tb_rule[NL80211_FREQUENCY_ATTR_MAX + 1];
Modified: iw/branches/upstream/current/scan.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/scan.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/scan.c (original)
+++ iw/branches/upstream/current/scan.c Fri May 3 18:38:12 2013
@@ -25,7 +25,25 @@
#define WLAN_CAPABILITY_QOS (1<<9)
#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
#define WLAN_CAPABILITY_APSD (1<<11)
+#define WLAN_CAPABILITY_RADIO_MEASURE (1<<12)
#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
+#define WLAN_CAPABILITY_DEL_BACK (1<<14)
+#define WLAN_CAPABILITY_IMM_BACK (1<<15)
+/* DMG (60gHz) 802.11ad */
+/* type - bits 0..1 */
+#define WLAN_CAPABILITY_DMG_TYPE_MASK (3<<0)
+
+#define WLAN_CAPABILITY_DMG_TYPE_IBSS (1<<0) /* Tx by: STA */
+#define WLAN_CAPABILITY_DMG_TYPE_PBSS (2<<0) /* Tx by: PCP */
+#define WLAN_CAPABILITY_DMG_TYPE_AP (3<<0) /* Tx by: AP */
+
+#define WLAN_CAPABILITY_DMG_CBAP_ONLY (1<<2)
+#define WLAN_CAPABILITY_DMG_CBAP_SOURCE (1<<3)
+#define WLAN_CAPABILITY_DMG_PRIVACY (1<<4)
+#define WLAN_CAPABILITY_DMG_ECPAC (1<<5)
+
+#define WLAN_CAPABILITY_DMG_SPECTRUM_MGMT (1<<8)
+#define WLAN_CAPABILITY_DMG_RADIO_MEASURE (1<<12)
static unsigned char ms_oui[3] = { 0x00, 0x50, 0xf2 };
static unsigned char ieee80211_oui[3] = { 0x00, 0x0f, 0xac };
@@ -265,6 +283,12 @@
static void print_powerconstraint(const uint8_t type, uint8_t len, const uint8_t *data)
{
printf(" %d dB\n", data[0]);
+}
+
+static void print_tpcreport(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+ printf(" TX power: %d dBm\n", data[0]);
+ /* printf(" Link Margin (%d dB) is reserved in Beacons\n", data[1]); */
}
static void print_erp(const uint8_t type, uint8_t len, const uint8_t *data)
@@ -675,6 +699,11 @@
printf("\n");
}
+static void print_ibssatim(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+ printf(" %d TUs", (data[1] << 8) + data[0]);
+}
+
static void print_vht_capa(const uint8_t type, uint8_t len, const uint8_t *data)
{
printf("\n");
@@ -773,11 +802,14 @@
[1] = { "Supported rates", print_supprates, 0, 255, BIT(PRINT_SCAN), },
[3] = { "DS Parameter set", print_ds, 1, 1, BIT(PRINT_SCAN), },
[5] = { "TIM", print_tim, 4, 255, BIT(PRINT_SCAN), },
+ [6] = { "IBSS ATIM window", print_ibssatim, 2, 2, BIT(PRINT_SCAN), },
[7] = { "Country", print_country, 3, 255, BIT(PRINT_SCAN), },
[11] = { "BSS Load", print_bss_load, 5, 5, BIT(PRINT_SCAN), },
[32] = { "Power constraint", print_powerconstraint, 1, 1, BIT(PRINT_SCAN), },
+ [35] = { "TPC report", print_tpcreport, 2, 2, BIT(PRINT_SCAN), },
[42] = { "ERP", print_erp, 1, 255, BIT(PRINT_SCAN), },
[45] = { "HT capabilities", print_ht_capa, 26, 26, BIT(PRINT_SCAN), },
+ [47] = { "ERP D4.0", print_erp, 1, 255, BIT(PRINT_SCAN), },
[74] = { "Overlapping BSS scan params", print_obss_scan_params, 14, 255, BIT(PRINT_SCAN), },
[61] = { "HT operation", print_ht_op, 22, 22, BIT(PRINT_SCAN), },
[62] = { "Secondary Channel Offset", print_secchan_offs, 1, 1, BIT(PRINT_SCAN), },
@@ -1216,6 +1248,70 @@
}
}
+static void print_capa_dmg(__u16 capa)
+{
+ switch (capa & WLAN_CAPABILITY_DMG_TYPE_MASK) {
+ case WLAN_CAPABILITY_DMG_TYPE_AP:
+ printf(" DMG_ESS");
+ break;
+ case WLAN_CAPABILITY_DMG_TYPE_PBSS:
+ printf(" DMG_PCP");
+ break;
+ case WLAN_CAPABILITY_DMG_TYPE_IBSS:
+ printf(" DMG_IBSS");
+ break;
+ }
+
+ if (capa & WLAN_CAPABILITY_DMG_CBAP_ONLY)
+ printf(" CBAP_Only");
+ if (capa & WLAN_CAPABILITY_DMG_CBAP_SOURCE)
+ printf(" CBAP_Src");
+ if (capa & WLAN_CAPABILITY_DMG_PRIVACY)
+ printf(" Privacy");
+ if (capa & WLAN_CAPABILITY_DMG_ECPAC)
+ printf(" ECPAC");
+ if (capa & WLAN_CAPABILITY_DMG_SPECTRUM_MGMT)
+ printf(" SpectrumMgmt");
+ if (capa & WLAN_CAPABILITY_DMG_RADIO_MEASURE)
+ printf(" RadioMeasure");
+}
+
+static void print_capa_non_dmg(__u16 capa)
+{
+ if (capa & WLAN_CAPABILITY_ESS)
+ printf(" ESS");
+ if (capa & WLAN_CAPABILITY_IBSS)
+ printf(" IBSS");
+ if (capa & WLAN_CAPABILITY_CF_POLLABLE)
+ printf(" CfPollable");
+ if (capa & WLAN_CAPABILITY_CF_POLL_REQUEST)
+ printf(" CfPollReq");
+ if (capa & WLAN_CAPABILITY_PRIVACY)
+ printf(" Privacy");
+ if (capa & WLAN_CAPABILITY_SHORT_PREAMBLE)
+ printf(" ShortPreamble");
+ if (capa & WLAN_CAPABILITY_PBCC)
+ printf(" PBCC");
+ if (capa & WLAN_CAPABILITY_CHANNEL_AGILITY)
+ printf(" ChannelAgility");
+ if (capa & WLAN_CAPABILITY_SPECTRUM_MGMT)
+ printf(" SpectrumMgmt");
+ if (capa & WLAN_CAPABILITY_QOS)
+ printf(" QoS");
+ if (capa & WLAN_CAPABILITY_SHORT_SLOT_TIME)
+ printf(" ShortSlotTime");
+ if (capa & WLAN_CAPABILITY_APSD)
+ printf(" APSD");
+ if (capa & WLAN_CAPABILITY_RADIO_MEASURE)
+ printf(" RadioMeasure");
+ if (capa & WLAN_CAPABILITY_DSSS_OFDM)
+ printf(" DSSS-OFDM");
+ if (capa & WLAN_CAPABILITY_DEL_BACK)
+ printf(" DelayedBACK");
+ if (capa & WLAN_CAPABILITY_IMM_BACK)
+ printf(" ImmediateBACK");
+}
+
static int print_bss_handler(struct nl_msg *msg, void *arg)
{
struct nlattr *tb[NL80211_ATTR_MAX + 1];
@@ -1237,6 +1333,7 @@
};
struct scan_params *params = arg;
int show = params->show_both_ie_sets ? 2 : 1;
+ bool is_dmg = false;
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
genlmsg_attrlen(gnlh, 0), NULL);
@@ -1256,8 +1353,11 @@
return NL_SKIP;
mac_addr_n2a(mac_addr, nla_data(bss[NL80211_BSS_BSSID]));
- if_indextoname(nla_get_u32(tb[NL80211_ATTR_IFINDEX]), dev);
- printf("BSS %s (on %s)", mac_addr, dev);
+ printf("BSS %s", mac_addr);
+ if (tb[NL80211_ATTR_IFINDEX]) {
+ if_indextoname(nla_get_u32(tb[NL80211_ATTR_IFINDEX]), dev);
+ printf("(on %s)", dev);
+ }
if (bss[NL80211_BSS_STATUS]) {
switch (nla_get_u32(bss[NL80211_BSS_STATUS])) {
@@ -1285,37 +1385,22 @@
tsf, tsf/1000/1000/60/60/24, (tsf/1000/1000/60/60) % 24,
(tsf/1000/1000/60) % 60, (tsf/1000/1000) % 60);
}
- if (bss[NL80211_BSS_FREQUENCY])
- printf("\tfreq: %d\n",
- nla_get_u32(bss[NL80211_BSS_FREQUENCY]));
+ if (bss[NL80211_BSS_FREQUENCY]) {
+ int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
+ printf("\tfreq: %d\n", freq);
+ if (freq > 45000)
+ is_dmg = true;
+ }
if (bss[NL80211_BSS_BEACON_INTERVAL])
- printf("\tbeacon interval: %d\n",
+ printf("\tbeacon interval: %d TUs\n",
nla_get_u16(bss[NL80211_BSS_BEACON_INTERVAL]));
if (bss[NL80211_BSS_CAPABILITY]) {
__u16 capa = nla_get_u16(bss[NL80211_BSS_CAPABILITY]);
printf("\tcapability:");
- if (capa & WLAN_CAPABILITY_ESS)
- printf(" ESS");
- if (capa & WLAN_CAPABILITY_IBSS)
- printf(" IBSS");
- if (capa & WLAN_CAPABILITY_PRIVACY)
- printf(" Privacy");
- if (capa & WLAN_CAPABILITY_SHORT_PREAMBLE)
- printf(" ShortPreamble");
- if (capa & WLAN_CAPABILITY_PBCC)
- printf(" PBCC");
- if (capa & WLAN_CAPABILITY_CHANNEL_AGILITY)
- printf(" ChannelAgility");
- if (capa & WLAN_CAPABILITY_SPECTRUM_MGMT)
- printf(" SpectrumMgmt");
- if (capa & WLAN_CAPABILITY_QOS)
- printf(" QoS");
- if (capa & WLAN_CAPABILITY_SHORT_SLOT_TIME)
- printf(" ShortSlotTime");
- if (capa & WLAN_CAPABILITY_APSD)
- printf(" APSD");
- if (capa & WLAN_CAPABILITY_DSSS_OFDM)
- printf(" DSSS-OFDM");
+ if (is_dmg)
+ print_capa_dmg(capa);
+ else
+ print_capa_non_dmg(capa);
printf(" (0x%.4x)\n", capa);
}
if (bss[NL80211_BSS_SIGNAL_MBM]) {
Modified: iw/branches/upstream/current/station.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/station.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/station.c (original)
+++ iw/branches/upstream/current/station.c Fri May 3 18:38:12 2013
@@ -23,19 +23,79 @@
BLOCKED
};
-enum plink_actions {
- PLINK_ACTION_UNDEFINED,
- PLINK_ACTION_OPEN,
- PLINK_ACTION_BLOCK,
-};
-
+static void print_power_mode(struct nlattr *a)
+{
+ enum nl80211_mesh_power_mode pm = nla_get_u32(a);
+
+ switch (pm) {
+ case NL80211_MESH_POWER_ACTIVE:
+ printf("ACTIVE");
+ break;
+ case NL80211_MESH_POWER_LIGHT_SLEEP:
+ printf("LIGHT SLEEP");
+ break;
+ case NL80211_MESH_POWER_DEEP_SLEEP:
+ printf("DEEP SLEEP");
+ break;
+ default:
+ printf("UNKNOWN");
+ break;
+ }
+}
+
+void parse_tx_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen)
+{
+ int rate = 0;
+ char *pos = buf;
+ struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1];
+ static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
+ [NL80211_RATE_INFO_BITRATE] = { .type = NLA_U16 },
+ [NL80211_RATE_INFO_BITRATE32] = { .type = NLA_U32 },
+ [NL80211_RATE_INFO_MCS] = { .type = NLA_U8 },
+ [NL80211_RATE_INFO_40_MHZ_WIDTH] = { .type = NLA_FLAG },
+ [NL80211_RATE_INFO_SHORT_GI] = { .type = NLA_FLAG },
+ };
+
+ if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX,
+ bitrate_attr, rate_policy)) {
+ snprintf(buf, buflen, "failed to parse nested rate attributes!");
+ return;
+ }
+
+ if (rinfo[NL80211_RATE_INFO_BITRATE32])
+ rate = nla_get_u32(rinfo[NL80211_RATE_INFO_BITRATE32]);
+ else if (rinfo[NL80211_RATE_INFO_BITRATE])
+ rate = nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]);
+ if (rate > 0)
+ pos += snprintf(pos, buflen - (pos - buf),
+ "%d.%d MBit/s", rate / 10, rate % 10);
+
+ if (rinfo[NL80211_RATE_INFO_MCS])
+ pos += snprintf(pos, buflen - (pos - buf),
+ " MCS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_MCS]));
+ if (rinfo[NL80211_RATE_INFO_VHT_MCS])
+ pos += snprintf(pos, buflen - (pos - buf),
+ " VHT-MCS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_VHT_MCS]));
+ if (rinfo[NL80211_RATE_INFO_40_MHZ_WIDTH])
+ pos += snprintf(pos, buflen - (pos - buf), " 40MHz");
+ if (rinfo[NL80211_RATE_INFO_80_MHZ_WIDTH])
+ pos += snprintf(pos, buflen - (pos - buf), " 80MHz");
+ if (rinfo[NL80211_RATE_INFO_80P80_MHZ_WIDTH])
+ pos += snprintf(pos, buflen - (pos - buf), " 80P80MHz");
+ if (rinfo[NL80211_RATE_INFO_160_MHZ_WIDTH])
+ pos += snprintf(pos, buflen - (pos - buf), " 160MHz");
+ if (rinfo[NL80211_RATE_INFO_SHORT_GI])
+ pos += snprintf(pos, buflen - (pos - buf), " short GI");
+ if (rinfo[NL80211_RATE_INFO_VHT_NSS])
+ pos += snprintf(pos, buflen - (pos - buf),
+ " VHT-NSS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_VHT_NSS]));
+}
static int print_sta_handler(struct nl_msg *msg, void *arg)
{
struct nlattr *tb[NL80211_ATTR_MAX + 1];
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
struct nlattr *sinfo[NL80211_STA_INFO_MAX + 1];
- struct nlattr *rinfo[NL80211_RATE_INFO_MAX + 1];
char mac_addr[20], state_name[10], dev[20];
struct nl80211_sta_flag_update *sta_flags;
static struct nla_policy stats_policy[NL80211_STA_INFO_MAX + 1] = {
@@ -54,14 +114,9 @@
[NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32 },
[NL80211_STA_INFO_STA_FLAGS] =
{ .minlen = sizeof(struct nl80211_sta_flag_update) },
- };
-
- static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
- [NL80211_RATE_INFO_BITRATE] = { .type = NLA_U16 },
- [NL80211_RATE_INFO_BITRATE32] = { .type = NLA_U32 },
- [NL80211_RATE_INFO_MCS] = { .type = NLA_U8 },
- [NL80211_RATE_INFO_40_MHZ_WIDTH] = { .type = NLA_FLAG },
- [NL80211_RATE_INFO_SHORT_GI] = { .type = NLA_FLAG },
+ [NL80211_STA_INFO_LOCAL_PM] = { .type = NLA_U32},
+ [NL80211_STA_INFO_PEER_PM] = { .type = NLA_U32},
+ [NL80211_STA_INFO_NONPEER_PM] = { .type = NLA_U32},
};
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@@ -120,26 +175,10 @@
(unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_T_OFFSET]));
if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
- if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX,
- sinfo[NL80211_STA_INFO_TX_BITRATE], rate_policy)) {
- fprintf(stderr, "failed to parse nested rate attributes!\n");
- } else {
- int rate = 0;
- printf("\n\ttx bitrate:\t");
- if (rinfo[NL80211_RATE_INFO_BITRATE32])
- rate = nla_get_u32(rinfo[NL80211_RATE_INFO_BITRATE32]);
- else if (rinfo[NL80211_RATE_INFO_BITRATE])
- rate = nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]);
- if (rate > 0)
- printf("%d.%d MBit/s", rate / 10, rate % 10);
-
- if (rinfo[NL80211_RATE_INFO_MCS])
- printf(" MCS %d", nla_get_u8(rinfo[NL80211_RATE_INFO_MCS]));
- if (rinfo[NL80211_RATE_INFO_40_MHZ_WIDTH])
- printf(" 40Mhz");
- if (rinfo[NL80211_RATE_INFO_SHORT_GI])
- printf(" short GI");
- }
+ char buf[100];
+
+ parse_tx_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], buf, sizeof(buf));
+ printf("\n\ttx bitrate:\t%s", buf);
}
if (sinfo[NL80211_STA_INFO_LLID])
@@ -177,6 +216,18 @@
}
printf("\n\tmesh plink:\t%s", state_name);
}
+ if (sinfo[NL80211_STA_INFO_LOCAL_PM]) {
+ printf("\n\tmesh local PS mode:\t");
+ print_power_mode(sinfo[NL80211_STA_INFO_LOCAL_PM]);
+ }
+ if (sinfo[NL80211_STA_INFO_PEER_PM]) {
+ printf("\n\tmesh peer PS mode:\t");
+ print_power_mode(sinfo[NL80211_STA_INFO_PEER_PM]);
+ }
+ if (sinfo[NL80211_STA_INFO_NONPEER_PM]) {
+ printf("\n\tmesh non-peer PS mode:\t");
+ print_power_mode(sinfo[NL80211_STA_INFO_NONPEER_PM]);
+ }
if (sinfo[NL80211_STA_INFO_STA_FLAGS]) {
sta_flags = (struct nl80211_sta_flag_update *)
@@ -223,7 +274,7 @@
}
if (sta_flags->mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) {
- printf("\n\tTDLS peer:\t\t");
+ printf("\n\tTDLS peer:\t");
if (sta_flags->set & BIT(NL80211_STA_FLAG_TDLS_PEER))
printf("yes");
else
@@ -274,6 +325,7 @@
static const struct cmd *station_set_plink;
static const struct cmd *station_set_vlan;
+static const struct cmd *station_set_mesh_power_mode;
static const struct cmd *select_station_cmd(int argc, char **argv)
{
@@ -283,6 +335,8 @@
return station_set_plink;
if (strcmp(argv[1], "vlan") == 0)
return station_set_vlan;
+ if (strcmp(argv[1], "mesh_power_mode") == 0)
+ return station_set_mesh_power_mode;
return NULL;
}
@@ -311,9 +365,9 @@
argv++;
if (strcmp("open", argv[0]) == 0)
- plink_action = PLINK_ACTION_OPEN;
+ plink_action = NL80211_PLINK_ACTION_OPEN;
else if (strcmp("block", argv[0]) == 0)
- plink_action = PLINK_ACTION_BLOCK;
+ plink_action = NL80211_PLINK_ACTION_BLOCK;
else {
fprintf(stderr, "plink action not supported\n");
return 2;
@@ -384,6 +438,58 @@
"Set an AP VLAN for this station.",
select_station_cmd, station_set_vlan);
+static int handle_station_set_mesh_power_mode(struct nl80211_state *state,
+ struct nl_cb *cb,
+ struct nl_msg *msg,
+ int argc, char **argv,
+ enum id_input id)
+{
+ unsigned char mesh_power_mode;
+ unsigned char mac_addr[ETH_ALEN];
+
+ if (argc < 3)
+ return 1;
+
+ if (mac_addr_a2n(mac_addr, argv[0])) {
+ fprintf(stderr, "invalid mac address\n");
+ return 2;
+ }
+ argc--;
+ argv++;
+
+ if (strcmp("mesh_power_mode", argv[0]) != 0)
+ return 1;
+ argc--;
+ argv++;
+
+ if (strcmp("active", argv[0]) == 0)
+ mesh_power_mode = NL80211_MESH_POWER_ACTIVE;
+ else if (strcmp("light", argv[0]) == 0)
+ mesh_power_mode = NL80211_MESH_POWER_LIGHT_SLEEP;
+ else if (strcmp("deep", argv[0]) == 0)
+ mesh_power_mode = NL80211_MESH_POWER_DEEP_SLEEP;
+ else {
+ fprintf(stderr, "unknown mesh power mode\n");
+ return 2;
+ }
+ argc--;
+ argv++;
+
+ if (argc)
+ return 1;
+
+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+ NLA_PUT_U32(msg, NL80211_ATTR_LOCAL_MESH_POWER_MODE, mesh_power_mode);
+
+ return 0;
+nla_put_failure:
+ return -ENOBUFS;
+}
+COMMAND_ALIAS(station, set, "<MAC address> mesh_power_mode "
+ "<active|light|deep>", NL80211_CMD_SET_STATION, 0, CIB_NETDEV,
+ handle_station_set_mesh_power_mode,
+ "Set link-specific mesh power mode for this station",
+ select_station_cmd, station_set_mesh_power_mode);
static int handle_station_dump(struct nl80211_state *state,
struct nl_cb *cb,
Modified: iw/branches/upstream/current/version.sh
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/version.sh?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/version.sh (original)
+++ iw/branches/upstream/current/version.sh Fri May 3 18:38:12 2013
@@ -1,6 +1,6 @@
#!/bin/sh
-VERSION="3.8"
+VERSION="3.10"
OUT="$1"
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
Modified: iw/branches/upstream/current/wowlan.c
URL: http://svn.debian.org/wsvn/iw/branches/upstream/current/wowlan.c?rev=1805&op=diff
==============================================================================
--- iw/branches/upstream/current/wowlan.c (original)
+++ iw/branches/upstream/current/wowlan.c Fri May 3 18:38:12 2013
@@ -1,6 +1,7 @@
#include <net/if.h>
#include <errno.h>
#include <string.h>
+#include <stdio.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/family.h>
@@ -8,10 +9,177 @@
#include <netlink/msg.h>
#include <netlink/attr.h>
+#include <arpa/inet.h>
+
#include "nl80211.h"
#include "iw.h"
SECTION(wowlan);
+
+static int wowlan_parse_tcp_file(struct nl_msg *msg, const char *fn)
+{
+ char buf[16768];
+ int err = 1;
+ FILE *f = fopen(fn, "r");
+ struct nlattr *tcp;
+
+ if (!f)
+ return 1;
+ tcp = nla_nest_start(msg, NL80211_WOWLAN_TRIG_TCP_CONNECTION);
+ if (!tcp)
+ goto nla_put_failure;
+
+ while (!feof(f)) {
+ char *eol;
+
+ if (!fgets(buf, sizeof(buf), f))
+ break;
+
+ eol = strchr(buf + 5, '\r');
+ if (eol)
+ *eol = 0;
+ eol = strchr(buf + 5, '\n');
+ if (eol)
+ *eol = 0;
+
+ if (strncmp(buf, "source=", 7) == 0) {
+ struct in_addr in_addr;
+ char *addr = buf + 7;
+ char *port = strchr(buf + 7, ':');
+
+ if (port) {
+ *port = 0;
+ port++;
+ }
+ if (inet_aton(addr, &in_addr) == 0)
+ goto close;
+ NLA_PUT_U32(msg, NL80211_WOWLAN_TCP_SRC_IPV4,
+ in_addr.s_addr);
+ if (port)
+ NLA_PUT_U16(msg, NL80211_WOWLAN_TCP_SRC_PORT,
+ atoi(port));
+ } else if (strncmp(buf, "dest=", 5) == 0) {
+ struct in_addr in_addr;
+ char *addr = buf + 5;
+ char *port = strchr(buf + 5, ':');
+ char *mac;
+ unsigned char macbuf[6];
+
+ if (!port)
+ goto close;
+ *port = 0;
+ port++;
+ mac = strchr(port, '@');
+ if (!mac)
+ goto close;
+ *mac = 0;
+ mac++;
+ if (inet_aton(addr, &in_addr) == 0)
+ goto close;
+ NLA_PUT_U32(msg, NL80211_WOWLAN_TCP_DST_IPV4,
+ in_addr.s_addr);
+ NLA_PUT_U16(msg, NL80211_WOWLAN_TCP_DST_PORT,
+ atoi(port));
+ if (mac_addr_a2n(macbuf, mac))
+ goto close;
+ NLA_PUT(msg, NL80211_WOWLAN_TCP_DST_MAC,
+ 6, macbuf);
+ } else if (strncmp(buf, "data=", 5) == 0) {
+ size_t len;
+ unsigned char *pkt = parse_hex(buf + 5, &len);
+
+ if (!pkt)
+ goto close;
+ NLA_PUT(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD, len, pkt);
+ free(pkt);
+ } else if (strncmp(buf, "data.interval=", 14) == 0) {
+ NLA_PUT_U32(msg, NL80211_WOWLAN_TCP_DATA_INTERVAL,
+ atoi(buf + 14));
+ } else if (strncmp(buf, "wake=", 5) == 0) {
+ unsigned char *pat, *mask;
+ size_t patlen;
+
+ if (parse_hex_mask(buf + 5, &pat, &patlen, &mask))
+ goto close;
+ NLA_PUT(msg, NL80211_WOWLAN_TCP_WAKE_MASK,
+ DIV_ROUND_UP(patlen, 8), mask);
+ NLA_PUT(msg, NL80211_WOWLAN_TCP_WAKE_PAYLOAD,
+ patlen, pat);
+ free(mask);
+ free(pat);
+ } else if (strncmp(buf, "data.seq=", 9) == 0) {
+ struct nl80211_wowlan_tcp_data_seq seq = {};
+ char *len, *offs, *start;
+
+ len = buf + 9;
+ offs = strchr(len, ',');
+ if (!offs)
+ goto close;
+ *offs = 0;
+ offs++;
+ start = strchr(offs, ',');
+ if (start) {
+ *start = 0;
+ start++;
+ seq.start = atoi(start);
+ }
+ seq.len = atoi(len);
+ seq.offset = atoi(offs);
+
+ NLA_PUT(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ,
+ sizeof(seq), &seq);
+ } else if (strncmp(buf, "data.tok=", 9) == 0) {
+ struct nl80211_wowlan_tcp_data_token *tok;
+ size_t stream_len;
+ char *len, *offs, *toks;
+ unsigned char *stream;
+
+ len = buf + 9;
+ offs = strchr(len, ',');
+ if (!offs)
+ goto close;
+ *offs = 0;
+ offs++;
+ toks = strchr(offs, ',');
+ if (!toks)
+ goto close;
+ *toks = 0;
+ toks++;
+
+ stream = parse_hex(toks, &stream_len);
+ if (!stream)
+ goto close;
+ tok = malloc(sizeof(*tok) + stream_len);
+ if (!tok) {
+ free(stream);
+ err = -ENOMEM;
+ goto close;
+ }
+
+ tok->len = atoi(len);
+ tok->offset = atoi(offs);
+ memcpy(tok->token_stream, stream, stream_len);
+
+ NLA_PUT(msg, NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN,
+ sizeof(*tok) + stream_len, tok);
+ free(stream);
+ free(tok);
+ } else {
+ if (buf[0] == '#')
+ continue;
+ goto close;
+ }
+ }
+
+ err = 0;
+ goto close;
+ nla_put_failure:
+ err = -ENOBUFS;
+ close:
+ fclose(f);
+ nla_nest_end(msg, tcp);
+ return err;
+}
static int handle_wowlan_enable(struct nl80211_state *state, struct nl_cb *cb,
struct nl_msg *msg, int argc, char **argv,
@@ -26,7 +194,8 @@
int err = -ENOBUFS;
unsigned char *pat, *mask;
size_t patlen;
- int patnum = 0;
+ int patnum = 0, pkt_offset;
+ char *eptr, *value1, *value2, *sptr = NULL;
wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS);
if (!wowlan)
@@ -49,7 +218,17 @@
NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE);
else if (strcmp(argv[0], "rfkill-release") == 0)
NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE);
- else if (strcmp(argv[0], "patterns") == 0) {
+ else if (strcmp(argv[0], "tcp") == 0) {
+ argv++;
+ argc--;
+ if (!argc) {
+ err = 1;
+ goto nla_put_failure;
+ }
+ err = wowlan_parse_tcp_file(msg, argv[0]);
+ if (err)
+ goto nla_put_failure;
+ } else if (strcmp(argv[0], "patterns") == 0) {
parse_state = PS_PAT;
patterns = nlmsg_alloc();
if (!patterns) {
@@ -62,15 +241,31 @@
}
break;
case PS_PAT:
- if (parse_hex_mask(argv[0], &pat, &patlen, &mask)) {
+ value1 = strtok_r(argv[0], "+", &sptr);
+ value2 = strtok_r(NULL, "+", &sptr);
+
+ if (!value2) {
+ pkt_offset = 0;
+ value2 = value1;
+ } else {
+ pkt_offset = strtoul(value1, &eptr, 10);
+ if (eptr != value1 + strlen(value1)) {
+ err = 1;
+ goto nla_put_failure;
+ }
+ }
+
+ if (parse_hex_mask(value2, &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_PUT_U32(patterns, NL80211_WOWLAN_PKTPAT_OFFSET, pkt_offset);
nla_nest_end(patterns, pattern);
free(mask);
free(pat);
@@ -91,12 +286,22 @@
return err;
}
COMMAND(wowlan, enable, "[any] [disconnect] [magic-packet] [gtk-rekey-failure] [eap-identity-request]"
- " [4way-handshake] [rfkill-release] [patterns <pattern>*]",
+ " [4way-handshake] [rfkill-release] [tcp <config-file>] [patterns [offset1+]<pattern1> ...]",
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.");
+ "00:11:22:33:ff:44 etc.\n"
+ "Offset and pattern should be separated by '+', e.g. 18+43:34:00:12 will match "
+ "'43:34:00:12' after 18 bytes of offset in Rx packet.\n\n"
+ "The TCP configuration file contains:\n"
+ " source=ip[:port]\n"
+ " dest=ip:port at mac\n"
+ " data=<hex data packet>\n"
+ " data.interval=seconds\n"
+ " [wake=<hex packet with masked out bytes indicated by '-'>]\n"
+ " [data.seq=len,offset[,start]]\n"
+ " [data.tok=len,offset,<token stream>]");
static int handle_wowlan_disable(struct nl80211_state *state, struct nl_cb *cb,
@@ -152,23 +357,26 @@
trig[NL80211_WOWLAN_TRIG_PKT_PATTERN],
rem_pattern) {
struct nlattr *patattr[NUM_NL80211_WOWLAN_PKTPAT];
- int i, patlen, masklen;
+ int i, patlen, masklen, pkt_offset;
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]) {
+ !patattr[NL80211_WOWLAN_PKTPAT_PATTERN] ||
+ !patattr[NL80211_WOWLAN_PKTPAT_OFFSET]) {
printf(" * (invalid pattern specification)\n");
continue;
}
masklen = nla_len(patattr[NL80211_WOWLAN_PKTPAT_MASK]);
patlen = nla_len(patattr[NL80211_WOWLAN_PKTPAT_PATTERN]);
+ pkt_offset = nla_get_u32(patattr[NL80211_WOWLAN_PKTPAT_OFFSET]);
if (DIV_ROUND_UP(patlen, 8) != masklen) {
printf(" * (invalid pattern specification)\n");
continue;
}
- printf(" * wake up on pattern: ");
+ printf(" * wake up on packet offset: %d", pkt_offset);
+ printf(" pattern: ");
pat = nla_data(patattr[NL80211_WOWLAN_PKTPAT_PATTERN]);
mask = nla_data(patattr[NL80211_WOWLAN_PKTPAT_MASK]);
for (i = 0; i < patlen; i++) {
@@ -182,6 +390,8 @@
printf("\n");
}
}
+ if (trig[NL80211_WOWLAN_TRIG_TCP_CONNECTION])
+ printf(" * wake up on TCP connection\n");
return NL_SKIP;
}
More information about the Pkg-wpa-devel
mailing list