Linux wireless drivers development
 help / color / mirror / Atom feed
From: Helmut Schaa <helmut.schaa@googlemail.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
	Helmut Schaa <helmut.schaa@googlemail.com>
Subject: [PATCH 2/2] iw: show STA flags in station dump
Date: Tue, 18 Oct 2011 11:18:27 +0200	[thread overview]
Message-ID: <1318929507-11447-2-git-send-email-helmut.schaa@googlemail.com> (raw)
In-Reply-To: <1318929507-11447-1-git-send-email-helmut.schaa@googlemail.com>


Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---

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


  reply	other threads:[~2011-10-18  9:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18  9:18 [PATCH 1/2] iw: Update nl80211.h Helmut Schaa
2011-10-18  9:18 ` Helmut Schaa [this message]
2011-10-18 16:41   ` [PATCH 2/2] iw: show STA flags in station dump Arik Nemtsov
2011-10-18 17:23     ` Helmut Schaa
2011-10-27 19:37       ` Johannes Berg
2011-10-28  3:48         ` Helmut Schaa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318929507-11447-2-git-send-email-helmut.schaa@googlemail.com \
    --to=helmut.schaa@googlemail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox