summaryrefslogtreecommitdiff
path: root/package/iw/patches
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-10-08 14:48:29 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-10-08 14:48:29 +0000
commit5c53069e8a9dba9a29afbd7c731ddbedf66a18c5 (patch)
tree8450a0f0e31400f3ff12c5d8623d436f3146bbe6 /package/iw/patches
parent8973f1f74e09cdf21fa8fd1964881eb3491ef9fe (diff)
iw: update to v3.1, add support for per-chain signal strength info
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28385 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/iw/patches')
-rw-r--r--package/iw/patches/001-nl80211_h_sync.patch251
-rw-r--r--package/iw/patches/001-nl80211_sync.patch81
-rw-r--r--package/iw/patches/110-fix_rate_calculation.patch11
-rw-r--r--package/iw/patches/110-ibss_ht.patch (renamed from package/iw/patches/120-ibss_ht.patch)4
-rw-r--r--package/iw/patches/120-per_chain_signal_strength.patch68
5 files changed, 321 insertions, 94 deletions
diff --git a/package/iw/patches/001-nl80211_h_sync.patch b/package/iw/patches/001-nl80211_h_sync.patch
new file mode 100644
index 0000000000..1c425273a4
--- /dev/null
+++ b/package/iw/patches/001-nl80211_h_sync.patch
@@ -0,0 +1,251 @@
+--- a/nl80211.h
++++ b/nl80211.h
+@@ -6,7 +6,7 @@
+ * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
+ * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
+- * Copyright 2008 Michael Buesch <mb@bu3sch.de>
++ * Copyright 2008 Michael Buesch <m@bues.ch>
+ * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
+ * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
+ * Copyright 2008 Colin McCabe <colin@cozybit.com>
+@@ -161,6 +161,13 @@
+ * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface
+ * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD,
+ * %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes.
++ * Following attributes are provided for drivers that generate full Beacon
++ * and Probe Response frames internally: %NL80211_ATTR_SSID,
++ * %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, %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP,
++ * %NL80211_ATTR_IE_ASSOC_RESP.
+ * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface,
+ * parameters are like for %NL80211_CMD_SET_BEACON.
+ * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
+@@ -762,6 +769,8 @@ enum nl80211_commands {
+ * that can be added to a scan request
+ * @NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN: maximum length of information
+ * elements that can be added to a scheduled scan request
++ * @NL80211_ATTR_MAX_MATCH_SETS: maximum number of sets that can be
++ * used with @NL80211_ATTR_SCHED_SCAN_MATCH, a wiphy attribute.
+ *
+ * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
+ * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
+@@ -842,18 +851,20 @@ enum nl80211_commands {
+ * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT
+ * event (u16)
+ * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating
+- * that protected APs should be used.
++ * that protected APs should be used. This is also used with NEW_BEACON to
++ * indicate that the BSS is to use protection.
+ *
+- * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT and ASSOCIATE to
+- * indicate which unicast key ciphers will be used with the connection
++ * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT, ASSOCIATE, and NEW_BEACON
++ * to indicate which unicast key ciphers will be used with the connection
+ * (an array of u32).
+- * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT and ASSOCIATE to indicate
+- * which group key cipher will be used with the connection (a u32).
+- * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT and ASSOCIATE to indicate
+- * which WPA version(s) the AP we want to associate with is using
++ * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
++ * indicate which group key cipher will be used with the connection (a
++ * u32).
++ * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
++ * indicate which WPA version(s) the AP we want to associate with is using
+ * (a u32 with flags from &enum nl80211_wpa_versions).
+- * @NL80211_ATTR_AKM_SUITES: Used with CONNECT and ASSOCIATE to indicate
+- * which key management algorithm(s) to use (an array of u32).
++ * @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
++ * indicate which key management algorithm(s) to use (an array of u32).
+ *
+ * @NL80211_ATTR_REQ_IE: (Re)association request information elements as
+ * sent out by the card, for ROAM and successful CONNECT events.
+@@ -1002,6 +1013,24 @@ enum nl80211_commands {
+
+ * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan
+ * cycles, in msecs.
++
++ * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more
++ * sets of attributes to match during scheduled scans. Only BSSs
++ * that match any of the sets will be reported. These are
++ * pass-thru filter rules.
++ * For a match to succeed, the BSS must match all attributes of a
++ * set. Since not every hardware supports matching all types of
++ * attributes, there is no guarantee that the reported BSSs are
++ * fully complying with the match sets and userspace needs to be
++ * able to ignore them by itself.
++ * Thus, the implementation is somewhat hardware-dependent, but
++ * this is only an optimization and the userspace application
++ * needs to handle all the non-filtered results anyway.
++ * If the match attributes don't make sense when combined with
++ * the values passed in @NL80211_ATTR_SCAN_SSIDS (eg. if an SSID
++ * is included in the probe request, but the match attributes
++ * will never let it go through), -EINVAL may be returned.
++ * If ommited, no filtering is done.
+ *
+ * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported
+ * interface combinations. In each nested item, it contains attributes
+@@ -1014,6 +1043,33 @@ enum nl80211_commands {
+ * @%NL80211_ATTR_REKEY_DATA: nested attribute containing the information
+ * necessary for GTK rekeying in the device, see &enum nl80211_rekey_data.
+ *
++ * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan,
++ * nested array attribute containing an entry for each band, with the entry
++ * being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but
++ * without the length restriction (at most %NL80211_MAX_SUPP_RATES).
++ *
++ * @NL80211_ATTR_HIDDEN_SSID: indicates whether SSID is to be hidden from Beacon
++ * and Probe Response (when response to wildcard Probe Request); see
++ * &enum nl80211_hidden_ssid, represented as a u32
++ *
++ * @NL80211_ATTR_IE_PROBE_RESP: Information element(s) for Probe Response frame.
++ * This is used with %NL80211_CMD_NEW_BEACON and %NL80211_CMD_SET_BEACON to
++ * provide extra IEs (e.g., WPS/P2P IE) into Probe Response frames when the
++ * driver (or firmware) replies to Probe Request frames.
++ * @NL80211_ATTR_IE_ASSOC_RESP: Information element(s) for (Re)Association
++ * Response frames. This is used with %NL80211_CMD_NEW_BEACON and
++ * %NL80211_CMD_SET_BEACON to provide extra IEs (e.g., WPS/P2P IE) into
++ * (Re)Association Response frames when the driver (or firmware) replies to
++ * (Re)Association Request frames.
++ *
++ * @NL80211_ATTR_STA_WME: Nested attribute containing the wme configuration
++ * of the station, see &enum nl80211_sta_wme_attr.
++ * @NL80211_ATTR_SUPPORT_AP_UAPSD: the device supports uapsd when working
++ * as AP.
++ *
++ * @NL80211_ATTR_ROAM_SUPPORT: Indicates whether the firmware is capable of
++ * roaming to another AP in the same ESS if the signal lever is low.
++ *
+ * @NL80211_ATTR_MAX: highest attribute number currently defined
+ * @__NL80211_ATTR_AFTER_LAST: internal use
+ */
+@@ -1217,6 +1273,21 @@ enum nl80211_attrs {
+ NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS,
+ NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN,
+
++ NL80211_ATTR_SCAN_SUPP_RATES,
++
++ NL80211_ATTR_HIDDEN_SSID,
++
++ NL80211_ATTR_IE_PROBE_RESP,
++ NL80211_ATTR_IE_ASSOC_RESP,
++
++ NL80211_ATTR_STA_WME,
++ NL80211_ATTR_SUPPORT_AP_UAPSD,
++
++ NL80211_ATTR_ROAM_SUPPORT,
++
++ NL80211_ATTR_SCHED_SCAN_MATCH,
++ NL80211_ATTR_MAX_MATCH_SETS,
++
+ /* add attributes here, update the policy in nl80211.c */
+
+ __NL80211_ATTR_AFTER_LAST,
+@@ -1426,6 +1497,8 @@ enum nl80211_sta_bss_param {
+ * @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_CHAIN_SIGNAL: per-chain signal strength of last PPDU
++ * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average
+ * @__NL80211_STA_INFO_AFTER_LAST: internal
+ * @NL80211_STA_INFO_MAX: highest possible station info attribute
+ */
+@@ -1447,6 +1520,8 @@ enum nl80211_sta_info {
+ NL80211_STA_INFO_RX_BITRATE,
+ NL80211_STA_INFO_BSS_PARAM,
+ NL80211_STA_INFO_CONNECTED_TIME,
++ NL80211_STA_INFO_CHAIN_SIGNAL,
++ NL80211_STA_INFO_CHAIN_SIGNAL_AVG,
+
+ /* keep last */
+ __NL80211_STA_INFO_AFTER_LAST,
+@@ -1676,6 +1751,26 @@ enum nl80211_reg_rule_attr {
+ };
+
+ /**
++ * enum nl80211_sched_scan_match_attr - scheduled scan match attributes
++ * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved
++ * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching,
++ * only report BSS with matching SSID.
++ * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter
++ * attribute number currently defined
++ * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use
++ */
++enum nl80211_sched_scan_match_attr {
++ __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID,
++
++ NL80211_ATTR_SCHED_SCAN_MATCH_SSID,
++
++ /* keep last */
++ __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST,
++ NL80211_SCHED_SCAN_MATCH_ATTR_MAX =
++ __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1
++};
++
++/**
+ * enum nl80211_reg_rule_flags - regulatory rule flags
+ *
+ * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed
+@@ -1826,6 +1921,13 @@ enum nl80211_mntr_flags {
+ * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a
+ * source mesh point for path selection elements.
+ *
++ * @NL80211_MESHCONF_HWMP_RANN_INTERVAL: The interval of time (in TUs) between
++ * root announcements are transmitted.
++ *
++ * @NL80211_MESHCONF_GATE_ANNOUNCEMENTS: Advertise that this mesh station has
++ * access to a broader network beyond the MBSS. This is done via Root
++ * Announcement frames.
++ *
+ * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
+ *
+ * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
+@@ -1847,6 +1949,8 @@ enum nl80211_meshconf_params {
+ NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
+ NL80211_MESHCONF_HWMP_ROOTMODE,
+ NL80211_MESHCONF_ELEMENT_TTL,
++ NL80211_MESHCONF_HWMP_RANN_INTERVAL,
++ NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
+
+ /* keep last */
+ __NL80211_MESHCONF_ATTR_AFTER_LAST,
+@@ -2423,4 +2527,37 @@ enum nl80211_rekey_data {
+ MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1
+ };
+
++/**
++ * enum nl80211_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID
++ * @NL80211_HIDDEN_SSID_NOT_IN_USE: do not hide SSID (i.e., broadcast it in
++ * Beacon frames)
++ * @NL80211_HIDDEN_SSID_ZERO_LEN: hide SSID by using zero-length SSID element
++ * in Beacon frames
++ * @NL80211_HIDDEN_SSID_ZERO_CONTENTS: hide SSID by using correct length of SSID
++ * element in Beacon frames but zero out each byte in the SSID
++ */
++enum nl80211_hidden_ssid {
++ NL80211_HIDDEN_SSID_NOT_IN_USE,
++ NL80211_HIDDEN_SSID_ZERO_LEN,
++ NL80211_HIDDEN_SSID_ZERO_CONTENTS
++};
++
++/**
++ * enum nl80211_sta_wme_attr - station WME attributes
++ * @__NL80211_STA_WME_INVALID: invalid number for nested attribute
++ * @NL80211_STA_WME_QUEUES: bitmap of uapsd queues.
++ * @NL80211_STA_WME_MAX_SP: max service period.
++ * @__NL80211_STA_WME_AFTER_LAST: internal
++ * @NL80211_STA_WME_MAX: highest station WME attribute
++ */
++enum nl80211_sta_wme_attr {
++ __NL80211_STA_WME_INVALID,
++ NL80211_STA_WME_UAPSD_QUEUES,
++ NL80211_STA_WME_MAX_SP,
++
++ /* keep last */
++ __NL80211_STA_WME_AFTER_LAST,
++ NL80211_STA_WME_MAX = __NL80211_STA_WME_AFTER_LAST - 1
++};
++
+ #endif /* __LINUX_NL80211_H */
diff --git a/package/iw/patches/001-nl80211_sync.patch b/package/iw/patches/001-nl80211_sync.patch
deleted file mode 100644
index a385897b75..0000000000
--- a/package/iw/patches/001-nl80211_sync.patch
+++ /dev/null
@@ -1,81 +0,0 @@
---- a/nl80211.h
-+++ b/nl80211.h
-@@ -148,6 +148,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
-@@ -612,7 +616,7 @@ enum nl80211_commands {
- * 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
-@@ -879,7 +883,9 @@ enum nl80211_commands {
- * 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_MAX: highest attribute number currently defined
- * @__NL80211_ATTR_AFTER_LAST: internal use
-@@ -1225,8 +1231,6 @@ enum nl80211_rate_info {
- * @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.
-@@ -1236,6 +1240,13 @@ enum nl80211_rate_info {
- * @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
-+ * @NL80211_STA_INFO_RX_BITRATE: last unicast rx rate, nested attribute
-+ * containing info as possible, see &enum nl80211_sta_info_txrate.
-+ * @__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 +1263,7 @@ enum nl80211_sta_info {
- NL80211_STA_INFO_TX_RETRIES,
- NL80211_STA_INFO_TX_FAILED,
- NL80211_STA_INFO_SIGNAL_AVG,
-+ NL80211_STA_INFO_RX_BITRATE,
-
- /* keep last */
- __NL80211_STA_INFO_AFTER_LAST,
-@@ -1626,7 +1638,7 @@ enum nl80211_mntr_flags {
- * @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.
-@@ -1678,6 +1690,7 @@ enum nl80211_meshconf_params {
- * element that vendors will use to identify the path selection methods and
- * metrics in use.
- *
-+ * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
- * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
- */
- enum nl80211_mesh_setup_params {
diff --git a/package/iw/patches/110-fix_rate_calculation.patch b/package/iw/patches/110-fix_rate_calculation.patch
deleted file mode 100644
index e7328e39ba..0000000000
--- a/package/iw/patches/110-fix_rate_calculation.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/ibss.c
-+++ b/ibss.c
-@@ -104,7 +104,7 @@ static int join_ibss(struct nl80211_stat
- 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--;
- }
diff --git a/package/iw/patches/120-ibss_ht.patch b/package/iw/patches/110-ibss_ht.patch
index 1e6c34e3b7..1b5dbd3e99 100644
--- a/package/iw/patches/120-ibss_ht.patch
+++ b/package/iw/patches/110-ibss_ht.patch
@@ -32,7 +32,7 @@
NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss,
--- a/iw.h
+++ b/iw.h
-@@ -130,6 +130,7 @@ void mac_addr_n2a(char *mac_addr, unsign
+@@ -133,6 +133,7 @@ int parse_hex_mask(char *hexmask, unsign
unsigned char *parse_hex(char *hex, size_t *outlen);
int parse_keys(struct nl_msg *msg, char **argv, int argc);
@@ -77,7 +77,7 @@
if (!*argv[0])
--- a/util.c
+++ b/util.c
-@@ -345,6 +345,33 @@ int parse_keys(struct nl_msg *msg, char
+@@ -382,6 +382,33 @@ int parse_keys(struct nl_msg *msg, char
return 2;
}
diff --git a/package/iw/patches/120-per_chain_signal_strength.patch b/package/iw/patches/120-per_chain_signal_strength.patch
new file mode 100644
index 0000000000..abdd6381c0
--- /dev/null
+++ b/package/iw/patches/120-per_chain_signal_strength.patch
@@ -0,0 +1,68 @@
+--- a/station.c
++++ b/station.c
+@@ -61,6 +61,31 @@ static void print_sta_bitrate(struct nla
+ }
+ }
+
++static char *get_chain_signal(struct nlattr *attr_list)
++{
++ struct nlattr *attr;
++ static char buf[64];
++ char *cur = buf;
++ int i = 0, rem;
++ const char *prefix;
++
++ if (!attr_list)
++ return "";
++
++ nla_for_each_nested(attr, attr_list, rem) {
++ if (i++ > 0)
++ prefix = ", ";
++ else
++ prefix = "[";
++
++ cur += snprintf(cur, sizeof(buf) - (cur - buf), "%s%d", prefix,
++ (int8_t) nla_get_u8(attr));
++ }
++ snprintf(cur, sizeof(buf) - (cur - buf), "] ");
++
++ return buf;
++}
++
+ static int print_sta_handler(struct nl_msg *msg, void *arg)
+ {
+ struct nlattr *tb[NL80211_ATTR_MAX + 1];
+@@ -81,7 +106,10 @@ static int print_sta_handler(struct nl_m
+ [NL80211_STA_INFO_PLINK_STATE] = { .type = NLA_U8 },
+ [NL80211_STA_INFO_TX_RETRIES] = { .type = NLA_U32 },
+ [NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32 },
++ [NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
++ [NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
+ };
++ char *chain;
+
+ nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
+ genlmsg_attrlen(gnlh, 0), NULL);
+@@ -128,12 +156,18 @@ static int print_sta_handler(struct nl_m
+ if (sinfo[NL80211_STA_INFO_TX_FAILED])
+ printf("\n\ttx failed:\t%u",
+ nla_get_u32(sinfo[NL80211_STA_INFO_TX_FAILED]));
++
++ chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL]);
+ if (sinfo[NL80211_STA_INFO_SIGNAL])
+- printf("\n\tsignal: \t%d dBm",
+- (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]));
++ printf("\n\tsignal: \t%d %sdBm",
++ (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]),
++ chain);
++
++ chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL_AVG]);
+ if (sinfo[NL80211_STA_INFO_SIGNAL_AVG])
+- printf("\n\tsignal avg:\t%d dBm",
+- (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]));
++ printf("\n\tsignal avg:\t%d %sdBm",
++ (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]),
++ chain);
+
+ print_sta_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], "tx bitrate");
+ print_sta_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE], "rx bitrate");