All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iw:  print beacon-loss and wiphy delete events.
@ 2015-06-11 19:54 greearb
  2015-06-17  9:16 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: greearb @ 2015-06-11 19:54 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Ben Greear

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iw:  print beacon-loss and wiphy delete events.
  2015-06-11 19:54 [PATCH] iw: print beacon-loss and wiphy delete events greearb
@ 2015-06-17  9:16 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2015-06-17  9:16 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless

On Thu, 2015-06-11 at 15:54 -0400, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> This is nicer than messages about unknown events.

Applied.

johannes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-17  9:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-11 19:54 [PATCH] iw: print beacon-loss and wiphy delete events greearb
2015-06-17  9:16 ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.