]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: print beacon-loss and wiphy delete events
authorBen Greear <greearb@candelatech.com>
Thu, 11 Jun 2015 19:54:11 +0000 (15:54 -0400)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 17 Jun 2015 09:17:03 +0000 (11:17 +0200)
This is nicer than messages about unknown events.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
event.c

diff --git a/event.c b/event.c
index 929854bd8354b7d7a80538fe4a6245ab711cbb5d..f73e078d4aea80109b4f986e6ec29f05587865ba 100644 (file)
--- a/event.c
+++ b/event.c
@@ -140,16 +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");
+       }
 }
 
 static const char * key_type_str(enum nl80211_key_type key_type)
@@ -599,6 +605,9 @@ static int print_event(struct nl_msg *msg, void *arg)
                }
                printf("\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));