2011-10-18 09:18:37

by Helmut Schaa

[permalink] [raw]
Subject: [PATCH 1/2] iw: Update nl80211.h


Signed-off-by: Helmut Schaa <[email protected]>
---
nl80211.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/nl80211.h b/nl80211.h
index c73582f..013ec4b 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -506,6 +506,9 @@
* @NL80211_CMD_PMKSA_CANDIDATE: This is used as an event to inform userspace
* of PMKSA caching dandidates.
*
+ * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
+ * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -632,6 +635,9 @@ enum nl80211_commands {

NL80211_CMD_PMKSA_CANDIDATE,

+ NL80211_CMD_TDLS_OPER,
+ NL80211_CMD_TDLS_MGMT,
+
/* add new commands above here */

/* used to define NL80211_CMD_MAX below */
@@ -1089,6 +1095,20 @@ enum nl80211_commands {
* This attribute is used with %NL80211_CMD_TRIGGER_SCAN and
* %NL80211_CMD_FRAME commands.
*
+ * @NL80211_ATTR_TDLS_ACTION: Low level TDLS action code (e.g. link setup
+ * request, link setup confirm, link teardown, etc.). Values are
+ * described in the TDLS (802.11z) specification.
+ * @NL80211_ATTR_TDLS_DIALOG_TOKEN: Non-zero token for uniquely identifying a
+ * TDLS conversation between two devices.
+ * @NL80211_ATTR_TDLS_OPERATION: High level TDLS operation; see
+ * &enum nl80211_tdls_operation, represented as a u8.
+ * @NL80211_ATTR_TDLS_SUPPORT: A flag indicating the device can operate
+ * as a TDLS peer sta.
+ * @NL80211_ATTR_TDLS_EXTERNAL_SETUP: The TDLS discovery/setup and teardown
+ * procedures should be performed by sending TDLS packets via
+ * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be
+ * used for asking the driver to perform a TDLS operation.
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1311,6 +1331,12 @@ enum nl80211_attrs {

NL80211_ATTR_TX_NO_CCK_RATE,

+ NL80211_ATTR_TDLS_ACTION,
+ NL80211_ATTR_TDLS_DIALOG_TOKEN,
+ NL80211_ATTR_TDLS_OPERATION,
+ NL80211_ATTR_TDLS_SUPPORT,
+ NL80211_ATTR_TDLS_EXTERNAL_SETUP,
+
/* add attributes here, update the policy in nl80211.c */

__NL80211_ATTR_AFTER_LAST,
@@ -1408,6 +1434,7 @@ enum nl80211_iftype {
* @NL80211_STA_FLAG_WME: station is WME/QoS capable
* @NL80211_STA_FLAG_MFP: station uses management frame protection
* @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated
+ * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer
* @NL80211_STA_FLAG_MAX: highest station flag number currently defined
* @__NL80211_STA_FLAG_AFTER_LAST: internal use
*/
@@ -1418,6 +1445,7 @@ enum nl80211_sta_flags {
NL80211_STA_FLAG_WME,
NL80211_STA_FLAG_MFP,
NL80211_STA_FLAG_AUTHENTICATED,
+ NL80211_STA_FLAG_TDLS_PEER,

/* keep last */
__NL80211_STA_FLAG_AFTER_LAST,
@@ -1520,6 +1548,7 @@ 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_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
* @__NL80211_STA_INFO_AFTER_LAST: internal
* @NL80211_STA_INFO_MAX: highest possible station info attribute
*/
@@ -1541,6 +1570,7 @@ enum nl80211_sta_info {
NL80211_STA_INFO_RX_BITRATE,
NL80211_STA_INFO_BSS_PARAM,
NL80211_STA_INFO_CONNECTED_TIME,
+ NL80211_STA_INFO_STA_FLAGS,

/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
@@ -2604,4 +2634,20 @@ enum nl80211_pmksa_candidate_attr {
MAX_NL80211_PMKSA_CANDIDATE = NUM_NL80211_PMKSA_CANDIDATE - 1
};

+/**
+ * enum nl80211_tdls_operation - values for %NL80211_ATTR_TDLS_OPERATION
+ * @NL80211_TDLS_DISCOVERY_REQ: Send a TDLS discovery request
+ * @NL80211_TDLS_SETUP: Setup TDLS link
+ * @NL80211_TDLS_TEARDOWN: Teardown a TDLS link which is already established
+ * @NL80211_TDLS_ENABLE_LINK: Enable TDLS link
+ * @NL80211_TDLS_DISABLE_LINK: Disable TDLS link
+ */
+enum nl80211_tdls_operation {
+ NL80211_TDLS_DISCOVERY_REQ,
+ NL80211_TDLS_SETUP,
+ NL80211_TDLS_TEARDOWN,
+ NL80211_TDLS_ENABLE_LINK,
+ NL80211_TDLS_DISABLE_LINK,
+};
+
#endif /* __LINUX_NL80211_H */
--
1.7.3.4



2011-10-18 16:41:28

by Arik Nemtsov

[permalink] [raw]
Subject: Re: [PATCH 2/2] iw: show STA flags in station dump

On Tue, Oct 18, 2011 at 11:18, Helmut Schaa <[email protected]> wrote:
>
> Signed-off-by: Helmut Schaa <[email protected]>
> ---
>
> Couldn't come up with a nice/short wording for "Managment frame
> protection" and "Wireless Multimedia Extension" so I just used MFP
> and WME/WMM instead.
>

Printing the NL80211_STA_FLAG_TDLS_PEER flag would be nice as well.

Arik

2011-10-27 19:37:06

by Johannes Berg

[permalink] [raw]
Subject: Re: Re: [PATCH 2/2] iw: show STA flags in station dump

On Tue, 2011-10-18 at 19:23 +0200, Helmut Schaa wrote:
> Am Dienstag, 18. Oktober 2011, 18:41:11 schrieb Arik Nemtsov:
> > On Tue, Oct 18, 2011 at 11:18, Helmut Schaa <[email protected]> wrote:
> > >
> > > Signed-off-by: Helmut Schaa <[email protected]>
> > > ---
> > >
> > > Couldn't come up with a nice/short wording for "Managment frame
> > > protection" and "Wireless Multimedia Extension" so I just used MFP
> > > and WME/WMM instead.
> > >
> >
> > Printing the NL80211_STA_FLAG_TDLS_PEER flag would be nice as well.
>
> Agreed, I somehow missed the (new) TDLS flag, also in the according
> nl80211/mac80211 patches :(

I'll apply this to iw fixed up but please send patches to the kernel.

johannes


2011-10-18 09:18:38

by Helmut Schaa

[permalink] [raw]
Subject: [PATCH 2/2] iw: show STA flags in station dump


Signed-off-by: Helmut Schaa <[email protected]>
---

Couldn't come up with a nice/short wording for "Managment frame
protection" and "Wireless Multimedia Extension" so I just used MFP
and WME/WMM instead.

station.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/station.c b/station.c
index 6581d50..26a2b7c 100644
--- a/station.c
+++ b/station.c
@@ -37,6 +37,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
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] = {
[NL80211_STA_INFO_INACTIVE_TIME] = { .type = NLA_U32 },
[NL80211_STA_INFO_RX_BYTES] = { .type = NLA_U32 },
@@ -50,6 +51,8 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
[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_STA_FLAGS] =
+ { .minlen = sizeof(struct nl80211_sta_flag_update) },
};

static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = {
@@ -167,6 +170,51 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
printf("\n\tmesh plink:\t%s", state_name);
}

+ if (sinfo[NL80211_STA_INFO_STA_FLAGS]) {
+ sta_flags = (struct nl80211_sta_flag_update *)
+ nla_data(sinfo[NL80211_STA_INFO_STA_FLAGS]);
+
+ if (sta_flags->mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
+ printf("\n\tauthorized:\t");
+ if (sta_flags->set & BIT(NL80211_STA_FLAG_AUTHORIZED))
+ printf("yes");
+ else
+ printf("no");
+ }
+
+ if (sta_flags->mask & BIT(NL80211_STA_FLAG_AUTHENTICATED)) {
+ printf("\n\tauthenticated:\t");
+ if (sta_flags->set & BIT(NL80211_STA_FLAG_AUTHENTICATED))
+ printf("yes");
+ else
+ printf("no");
+ }
+
+ if (sta_flags->mask & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE)) {
+ printf("\n\tpreamble:\t");
+ if (sta_flags->set & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE))
+ printf("short");
+ else
+ printf("long");
+ }
+
+ if (sta_flags->mask & BIT(NL80211_STA_FLAG_WME)) {
+ printf("\n\tWMM/WME:\t");
+ if (sta_flags->set & BIT(NL80211_STA_FLAG_WME))
+ printf("yes");
+ else
+ printf("no");
+ }
+
+ if (sta_flags->mask & BIT(NL80211_STA_FLAG_MFP)) {
+ printf("\n\tMFP:\t\t");
+ if (sta_flags->set & BIT(NL80211_STA_FLAG_MFP))
+ printf("yes");
+ else
+ printf("no");
+ }
+ }
+
printf("\n");
return NL_SKIP;
}
--
1.7.3.4


2011-10-28 03:48:01

by Helmut Schaa

[permalink] [raw]
Subject: Re: Re: [PATCH 2/2] iw: show STA flags in station dump

On Thu, Oct 27, 2011 at 9:37 PM, Johannes Berg
<[email protected]> wrote:
> On Tue, 2011-10-18 at 19:23 +0200, Helmut Schaa wrote:
>> Am Dienstag, 18. Oktober 2011, 18:41:11 schrieb Arik Nemtsov:
>> > On Tue, Oct 18, 2011 at 11:18, Helmut Schaa <[email protected]> wrote:
>> > >
>> > > Signed-off-by: Helmut Schaa <[email protected]>
>> > > ---
>> > >
>> > > Couldn't come up with a nice/short wording for "Managment frame
>> > > protection" and "Wireless Multimedia Extension" so I just used MFP
>> > > and WME/WMM instead.
>> > >
>> >
>> > Printing the NL80211_STA_FLAG_TDLS_PEER flag would be nice as well.
>>
>> Agreed, I somehow missed the (new) TDLS flag, also in the according
>> nl80211/mac80211 patches :(
>
> I'll apply this to iw fixed up but please send patches to the kernel.

Agreed, thanks.

And since we've got the flag mask iw will also work with a kernel that
doesn't provide the TDLS flags ;)

Helmut

2011-10-18 17:25:27

by Helmut Schaa

[permalink] [raw]
Subject: Re: Re: [PATCH 2/2] iw: show STA flags in station dump

Am Dienstag, 18. Oktober 2011, 18:41:11 schrieb Arik Nemtsov:
> On Tue, Oct 18, 2011 at 11:18, Helmut Schaa <[email protected]> wrote:
> >
> > Signed-off-by: Helmut Schaa <[email protected]>
> > ---
> >
> > Couldn't come up with a nice/short wording for "Managment frame
> > protection" and "Wireless Multimedia Extension" so I just used MFP
> > and WME/WMM instead.
> >
>
> Printing the NL80211_STA_FLAG_TDLS_PEER flag would be nice as well.

Agreed, I somehow missed the (new) TDLS flag, also in the according
nl80211/mac80211 patches :(

Thanks,
Helmut