Browse Source

monitor: Add --noies option

To help understand scanning results a bit better and cut down on scan
output add an option to not print the contents of the IEs.  Only the
SSID IE will be printed.
upstream/latest
Denis Kenzior 2 years ago
parent
commit
83e1265c6b
  1. 5
      monitor/main.c
  2. 14
      monitor/nlmon.c
  3. 1
      monitor/nlmon.h

5
monitor/main.c

@ -671,6 +671,7 @@ static void usage(void)
"\t-n, --nortnl Don't show RTNL output\n"
"\t-y, --nowiphy Don't show 'New Wiphy' output\n"
"\t-s, --noscan Don't show scan result output\n"
"\t-e, --noies Don't show IEs except SSID\n"
"\t-h, --help Show help options\n");
}
@ -683,6 +684,7 @@ static const struct option main_options[] = {
{ "nortnl", no_argument, NULL, 'n' },
{ "nowiphy", no_argument, NULL, 'y' },
{ "noscan", no_argument, NULL, 's' },
{ "noies", no_argument, NULL, 'e' },
{ "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
{ }
@ -746,6 +748,9 @@ int main(int argc, char *argv[])
case 's':
config.noscan = true;
break;
case 'e':
config.noies = true;
break;
case 'v':
printf("%s\n", VERSION);
return EXIT_SUCCESS;

14
monitor/nlmon.c

@ -82,6 +82,8 @@
#define BSS_CAPABILITY_APSD (1<<11)
#define BSS_CAPABILITY_DSSS_OFDM (1<<13)
struct nlmon *cur_nlmon;
enum msg_type {
MSG_REQUEST,
MSG_RESPONSE,
@ -99,6 +101,7 @@ struct nlmon {
bool nortnl;
bool nowiphy;
bool noscan;
bool noies;
};
struct nlmon_req {
@ -2124,6 +2127,9 @@ static void print_ie(unsigned int level, const char *label,
}
}
if (cur_nlmon && cur_nlmon->noies && tag != IE_TYPE_SSID)
continue;
if (entry && entry->function)
entry->function(level + 1, entry->str,
iter.data, iter.len);
@ -3966,6 +3972,9 @@ static void print_management_ies(unsigned int level, const char *label,
print_ie(level, label, data, size);
if (cur_nlmon && cur_nlmon->noies)
return;
wsc_data = ie_tlv_extract_wsc_payload(data, size, &wsc_len);
if (wsc_data) {
print_wsc_attributes(level + 1, "WSC Payload",
@ -6325,6 +6334,8 @@ static void print_message(struct nlmon *nlmon, const struct timeval *tv,
case MSG_REQUEST:
case MSG_RESULT:
case MSG_EVENT:
cur_nlmon = nlmon;
switch (cmd) {
case NL80211_CMD_CONTROL_PORT_FRAME:
print_attributes(0, control_port_attr_table, data, len);
@ -6332,6 +6343,8 @@ static void print_message(struct nlmon *nlmon, const struct timeval *tv,
default:
print_attributes(0, attr_table, data, len);
}
cur_nlmon = NULL;
break;
case MSG_RESPONSE:
print_field("Status: %s (%d)", strerror(status), status);
@ -7692,6 +7705,7 @@ struct nlmon *nlmon_open(const char *ifname, uint16_t id, const char *pathname,
nlmon->nortnl = config->nortnl;
nlmon->nowiphy = config->nowiphy;
nlmon->noscan = config->noscan;
nlmon->noies = config->noies;
l_io_set_read_handler(nlmon->io, nlmon_receive, nlmon, NULL);
l_io_set_read_handler(nlmon->pae_io, pae_receive, nlmon, NULL);

1
monitor/nlmon.h

@ -29,6 +29,7 @@ struct nlmon_config {
bool nortnl;
bool nowiphy;
bool noscan;
bool noies;
};
struct nlmon *nlmon_open(const char *ifname, uint16_t id, const char *pathname,

Loading…
Cancel
Save