if (rate > 0)
pos += snprintf(pos, buflen - (pos - buf),
"%d.%d MBit/s", rate / 10, rate % 10);
+ else
+ pos += snprintf(pos, buflen - (pos - buf), "(unknown)");
if (rinfo[NL80211_RATE_INFO_MCS])
pos += snprintf(pos, buflen - (pos - buf),
[NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
[NL80211_STA_INFO_TID_STATS] = { .type = NLA_NESTED },
[NL80211_STA_INFO_BSS_PARAM] = { .type = NLA_NESTED },
+ [NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
};
char *chain;
printf("\n\trx bitrate:\t%s", buf);
}
+ if (sinfo[NL80211_STA_INFO_RX_DURATION])
+ printf("\n\trx duration:\t%lld us",
+ (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_RX_DURATION]));
+
if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) {
uint32_t thr;
COMMAND(station, get, "<MAC address>",
NL80211_CMD_GET_STATION, 0, CIB_NETDEV, handle_station_get,
"Get information for a specific station.");
-COMMAND(station, del, "<MAC address>",
- NL80211_CMD_DEL_STATION, 0, CIB_NETDEV, handle_station_get,
- "Remove the given station entry (use with caution!)");
+
+static int handle_station_del(struct nl80211_state *state,
+ struct nl_msg *msg,
+ int argc, char **argv,
+ enum id_input id)
+{
+ char *end;
+ unsigned char mac_addr[ETH_ALEN];
+ int subtype;
+ int reason_code;
+
+ if (argc < 1)
+ return 1;
+
+ if (mac_addr_a2n(mac_addr, argv[0])) {
+ fprintf(stderr, "invalid mac address\n");
+ return 2;
+ }
+
+ argc--;
+ argv++;
+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+
+ if (argc > 1 && strcmp(argv[0], "subtype") == 0) {
+ argv++;
+ argc--;
+
+ subtype = strtod(argv[0], &end);
+ if (*end != '\0')
+ return 1;
+
+ NLA_PUT_U8(msg, NL80211_ATTR_MGMT_SUBTYPE, subtype);
+ argv++;
+ argc--;
+ }
+
+ if (argc > 1 && strcmp(argv[0], "reason-code") == 0) {
+ argv++;
+ argc--;
+
+ reason_code = strtod(argv[0], &end);
+ if (*end != '\0')
+ return 1;
+
+ NLA_PUT_U16(msg, NL80211_ATTR_REASON_CODE, reason_code);
+ argv++;
+ argc--;
+ }
+
+ if (argc)
+ return 1;
+
+ register_handler(print_sta_handler, NULL);
+
+ return 0;
+ nla_put_failure:
+ return -ENOBUFS;
+}
+COMMAND(station, del, "<MAC address> [subtype <subtype>] [reason-code <code>]",
+ NL80211_CMD_DEL_STATION, 0, CIB_NETDEV, handle_station_del,
+ "Remove the given station entry (use with caution!)\n"
+ "Example subtype values: 0xA (disassociation), 0xC (deauthentication)");
static const struct cmd *station_set_plink;
static const struct cmd *station_set_vlan;