"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,
strcmp(tpstr, "ibss") == 0) {
*type = NL80211_IFTYPE_ADHOC;
return 0;
+ } else if (strcmp(tpstr, "ocb") == 0) {
+ *type = NL80211_IFTYPE_OCB;
+ return 0;
} else if (strcmp(tpstr, "monitor") == 0) {
*type = NL80211_IFTYPE_MONITOR;
return 0;
}
static int handle_interface_add(struct nl80211_state *state,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
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,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
printf("\n");
}
+ if (tb_msg[NL80211_ATTR_WIPHY_TX_POWER_LEVEL]) {
+ uint32_t txp = nla_get_u32(tb_msg[NL80211_ATTR_WIPHY_TX_POWER_LEVEL]);
+
+ printf("%s\ttxpower %d.%.2d dBm\n",
+ indent, txp / 100, txp % 100);
+ }
+
return NL_SKIP;
}
static int handle_interface_info(struct nl80211_state *state,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
{
- nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_iface_handler, NULL);
+ register_handler(print_iface_handler, NULL);
return 0;
}
TOPLEVEL(info, NULL, NL80211_CMD_GET_INTERFACE, 0, CIB_NETDEV, handle_interface_info,
"Show information for this interface.");
static int handle_interface_set(struct nl80211_state *state,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
VALID_FLAGS);
static int handle_interface_meshid(struct nl80211_state *state,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
static unsigned int dev_dump_wiphy;
static int handle_dev_dump(struct nl80211_state *state,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
{
dev_dump_wiphy = -1;
- nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_iface_handler, &dev_dump_wiphy);
+ register_handler(print_iface_handler, &dev_dump_wiphy);
return 0;
}
TOPLEVEL(dev, NULL, NL80211_CMD_GET_INTERFACE, NLM_F_DUMP, CIB_NONE, handle_dev_dump,
"List all network interfaces for wireless hardware.");
static int handle_interface_type(struct nl80211_state *state,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
IFACE_TYPES);
static int handle_interface_4addr(struct nl80211_state *state,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
"Set interface 4addr (WDS) mode.");
static int handle_interface_noack_map(struct nl80211_state *state,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
static int handle_interface_wds_peer(struct nl80211_state *state,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)
"Set interface WDS peer.");
static int set_mcast_rate(struct nl80211_state *state,
- struct nl_cb *cb,
struct nl_msg *msg,
int argc, char **argv,
enum id_input id)