"fcsfail: show frames with FCS errors\n"\
"control: show control frames\n"\
"otherbss: show frames from other BSSes\n"\
- "cook: use cooked mode"
+ "cook: use cooked mode\n"\
+ "active: use active mode (ACK incoming unicast packets)"
SECTION(interface);
"control",
"otherbss",
"cook",
+ "active",
};
static int parse_mntr_flags(int *_argc, char ***_argv,
char *mesh_id = NULL;
enum nl80211_iftype type;
int tpset;
+ unsigned char mac_addr[ETH_ALEN];
+ int found_mac = 0;
if (argc < 1)
return 1;
if (tpset)
return tpset;
+try_another:
if (argc) {
if (strcmp(argv[0], "mesh_id") == 0) {
argc--;
mesh_id = argv[0];
argc--;
argv++;
+ } else if (strcmp(argv[0], "addr") == 0) {
+ argc--;
+ argv++;
+ if (mac_addr_a2n(mac_addr, argv[0])) {
+ fprintf(stderr, "Invalid MAC address\n");
+ return 2;
+ }
+ argc--;
+ argv++;
+ found_mac = 1;
+ goto try_another;
} else if (strcmp(argv[0], "4addr") == 0) {
argc--;
argv++;
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, type);
if (mesh_id)
NLA_PUT(msg, NL80211_ATTR_MESH_ID, strlen(mesh_id), mesh_id);
+ if (found_mac)
+ NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
return 0;
nla_put_failure:
return -ENOBUFS;
}
-COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]",
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]",
NL80211_CMD_NEW_INTERFACE, 0, CIB_PHY, handle_interface_add,
"Add a new virtual interface with the given configuration.\n"
IFACE_TYPES "\n\n"
"The flags are only used for monitor interfaces, valid flags are:\n"
VALID_FLAGS "\n\n"
"The mesh_id is used only for mesh mode.");
-COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*]",
+COMMAND(interface, add, "<name> type <type> [mesh_id <meshid>] [4addr on|off] [flags <flag>*] [addr <mac-addr>]",
NL80211_CMD_NEW_INTERFACE, 0, CIB_NETDEV, handle_interface_add, NULL);
static int handle_interface_del(struct nl80211_state *state,
}
}
+char *channel_width_name(enum nl80211_chan_width width)
+{
+ switch (width) {
+ case NL80211_CHAN_WIDTH_20_NOHT:
+ return "20 MHz (no HT)";
+ case NL80211_CHAN_WIDTH_20:
+ return "20 MHz";
+ case NL80211_CHAN_WIDTH_40:
+ return "40 MHz";
+ case NL80211_CHAN_WIDTH_80:
+ return "80 MHz";
+ case NL80211_CHAN_WIDTH_80P80:
+ return "80+80 MHz";
+ case NL80211_CHAN_WIDTH_160:
+ return "160 MHz";
+ default:
+ return "unknown";
+ }
+}
+
static int print_iface_handler(struct nl_msg *msg, void *arg)
{
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
printf("%s\twiphy %d\n", indent, nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]));
if (tb_msg[NL80211_ATTR_WIPHY_FREQ]) {
uint32_t freq = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_FREQ]);
- enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
- if (tb_msg[NL80211_ATTR_WIPHY_CHANNEL_TYPE])
+ printf("%s\tchannel %d (%d MHz)", indent,
+ ieee80211_frequency_to_channel(freq), freq);
+
+ if (tb_msg[NL80211_ATTR_CHANNEL_WIDTH]) {
+ printf(", width: %s",
+ channel_width_name(nla_get_u32(tb_msg[NL80211_ATTR_CHANNEL_WIDTH])));
+ if (tb_msg[NL80211_ATTR_CENTER_FREQ1])
+ printf(", center1: %d MHz",
+ nla_get_u32(tb_msg[NL80211_ATTR_CENTER_FREQ1]));
+ if (tb_msg[NL80211_ATTR_CENTER_FREQ2])
+ printf(", center2: %d MHz",
+ nla_get_u32(tb_msg[NL80211_ATTR_CENTER_FREQ2]));
+ } else if (tb_msg[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) {
+ enum nl80211_channel_type channel_type;
+
channel_type = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_CHANNEL_TYPE]);
+ printf(" %s", channel_type_name(channel_type));
+ }
- printf("%s\tchannel %d (%d MHz) %s\n", indent,
- ieee80211_frequency_to_channel(freq), freq,
- channel_type_name(channel_type));
+ printf("\n");
}
return NL_SKIP;