linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: greearb@candelatech.com
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, Ben Greear <greearb@candelatech.com>
Subject: [PATCH] iw:  print beacon-loss and wiphy delete events.
Date: Thu, 11 Jun 2015 15:54:11 -0400	[thread overview]
Message-ID: <1434052451-19501-1-git-send-email-greearb@candelatech.com> (raw)

From: Ben Greear <greearb@candelatech.com>

This is nicer than messages about unknown events.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 event.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/event.c b/event.c
index b87a076..2c9694d 100644
--- a/event.c
+++ b/event.c
@@ -140,15 +140,22 @@ static void parse_cqm_event(struct nlattr **attrs)
 
 		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;
-		char buf[3*6];
-
-		frames = nla_get_u32(cqm[NL80211_ATTR_CQM_PKT_LOSS_EVENT]);
-		mac_addr_n2a(buf, nla_data(attrs[NL80211_ATTR_MAC]));
-		printf("peer %s didn't ACK %d packets\n", buf, frames);
-	} else
+	} else if (cqm[NL80211_ATTR_CQM_PKT_LOSS_EVENT]) {
+		if (attrs[NL80211_ATTR_MAC]) {
+			uint32_t frames;
+			char buf[3*6];
+
+			frames = nla_get_u32(cqm[NL80211_ATTR_CQM_PKT_LOSS_EVENT]);
+			mac_addr_n2a(buf, nla_data(attrs[NL80211_ATTR_MAC]));
+			printf("peer %s didn't ACK %d packets\n", buf, frames);
+		}
+		else {
+			printf("PKT-LOSS-EVENT did not have MAC attribute!\n");
+		}
+	} else if (cqm[NL80211_ATTR_CQM_BEACON_LOSS_EVENT]) {
+		printf("beacon loss\n");
+	}
+	else
 		printf("unknown event\n");
 }
 
@@ -615,6 +622,9 @@ static int print_event(struct nl_msg *msg, void *arg)
 	case NL80211_CMD_DEL_INTERFACE:
 		printf("delete interface\n");
 		break;
+	case NL80211_CMD_DEL_WIPHY:
+		printf("delete wiphy\n");
+		break;
 	default:
 		printf("unknown event %d (%s)\n",
 		       gnlh->cmd, command_name(gnlh->cmd));
-- 
1.9.3


             reply	other threads:[~2015-06-11 19:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 19:54 greearb [this message]
2015-06-17  9:16 ` [PATCH] iw: print beacon-loss and wiphy delete events Johannes Berg

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=1434052451-19501-1-git-send-email-greearb@candelatech.com \
    --to=greearb@candelatech.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;
as well as URLs for NNTP newsgroup(s).