diff mbox

iw: print beacon-loss and wiphy delete events.

Message ID 1434052451-19501-1-git-send-email-greearb@candelatech.com (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show

Commit Message

Ben Greear June 11, 2015, 7:54 p.m. UTC
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(-)

Comments

Johannes Berg June 17, 2015, 9:16 a.m. UTC | #1
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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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));