monitor: allow parsing pcaps without -F option

The -F option is undocumented but allows you to pass a nl80211
family ID so iwmon doesn't ignore messages which don't match the
systems nl80211 family ID (i.e. pcaps from other systems).

This is somewhat of a pain to use since its unclear what the other
system's family ID actually is until you run it though something
like wireshark. Instead iwmon can ignore the family ID when in
read mode which makes reading other systems pcap files automatic.
This commit is contained in:
James Prestwood 2022-10-26 13:45:58 -07:00 committed by Denis Kenzior
parent 5ebcc48814
commit ad51250835
3 changed files with 5 additions and 1 deletions

View File

@ -710,6 +710,7 @@ int main(int argc, char *argv[])
switch (opt) {
case 'r':
reader_path = optarg;
config.read_only = true;
break;
case 'w':
writer_path = optarg;

View File

@ -104,6 +104,7 @@ struct nlmon {
bool nowiphy;
bool noscan;
bool noies;
bool read;
};
struct nlmon_req {
@ -7202,7 +7203,7 @@ static void nlmon_message(struct nlmon *nlmon, const struct timeval *tv,
return;
}
if (nlmsg->nlmsg_type != nlmon->id) {
if (!nlmon->read && nlmsg->nlmsg_type != nlmon->id) {
if (nlmsg->nlmsg_type == GENL_ID_CTRL)
store_message(nlmon, tv, nlmsg);
return;
@ -7265,6 +7266,7 @@ struct nlmon *nlmon_create(uint16_t id, const struct nlmon_config *config)
nlmon->nowiphy = config->nowiphy;
nlmon->noscan = config->noscan;
nlmon->noies = config->noies;
nlmon->read = config->read_only;
return nlmon;
}

View File

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