3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-30 06:02:39 +01:00
Commit Graph

329 Commits

Author SHA1 Message Date
James Prestwood
b4a4495537 monitor: add better info about the country code IE
The 3rd byte of the country code was being printed as ASCII but this
byte isn't always a printable character. Instead we can check what
the value is and describe what it means from the spec.
2024-11-13 11:40:13 -06:00
James Prestwood
0868418ad1 treewide: fix spelling mistakes 2024-11-07 19:11:59 +01:00
James Prestwood
23cf6107c6 monitor: fix build with INGRESS/EGRESS definitions
These new values are undefined on older kernels (e.g. 5.15)
2024-09-04 22:07:33 -05:00
Denis Kenzior
e5c0e18751 monitor: Print rmnet flags 2024-08-23 12:30:57 -05:00
Denis Kenzior
02ec70e290 monitor: Don't skip genl control Done,Error messages 2024-08-23 11:17:30 -05:00
Denis Kenzior
5118f08d79 monitor: Don't dump survey results with noscan
Survey is used after each scan, creating quite a bit of spam.  Silence
survey results if noscan is set.
2024-08-23 11:17:26 -05:00
Denis Kenzior
96492483ee monitor: Mask flags from attribute identifier
Certain flags (for example, NLA_F_NESTED) are ORed with the netlink
attribute type identifier prior to being sent on the wire.  Such flags
need to be masked off and not taken into consideration when attribute
type is being compared against known values.
2024-08-05 09:06:25 -05:00
Denis Kenzior
194d8a3052 monitor: Decode RMNet Mux Identifier 2024-08-05 09:06:20 -05:00
Denis Kenzior
faa6a392e4 monitor: Update to the new ell l_netlink_send API 2024-07-26 17:37:29 -05:00
Denis Kenzior
9762c61b4d monitor: Use genl APIs instead of open coding
l_genl class has nice ways of discovering and requesting families.  The
genl functionality has been added after the iwmon skeleton was created,
but it is now time to migrate to using these APIs.
2024-07-26 10:04:05 -05:00
James Prestwood
d8803b309d monitor: fix the CQM RSSI threshold attribute
This attribute is actually an array of signed 32 bit integers and it
was being treated as a single integer. This would work until more
than one threshold was set, then it would fail to parse it.
2024-07-26 09:52:25 -05:00
James Prestwood
26efca80d7 nlmon: parse/print neighbor reports
Adds an IE parser for neighbor report elements
2024-05-09 10:23:45 -05:00
James Prestwood
6b94ab3889 iwmon: fix incorrect mask printing HE capabilities
This was changed from too large of a mask (0xff) in an earlier
commit but was masking 5 bits instead of 6.

Fixes: 121c2c5653 ("monitor: properly mask HE capabilities bitfield")
2024-03-15 08:46:56 -05:00
James Prestwood
121c2c5653 monitor: properly mask HE capabilities bitfield
Caught by static analysis, the bitfield was incorrect and was masking
8 entries (0xff), not 5 (0x1f).
2024-03-11 22:08:19 -05:00
James Prestwood
705898d1db monitor: include unistd.h in main.c
This fixes a build break on some systems, specifically the
raspberry Pi 3 (ARM):

monitor/main.c: In function ‘open_packet’:
monitor/main.c:176:3: error: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Werror=implicit-function-declaration]
  176 |   close(fd);
      |   ^~~~~
      |   pclose
2024-01-04 12:18:05 -06:00
James Prestwood
a2fff11823 monitor: indicate if the MPDU was invalid
If the frame was not parsed as an MPDU indicate this in iwmon. This
also adds handling to print probe requests.
2024-01-02 11:02:15 -06:00
Denis Kenzior
cfb468e44d monitor: Move iwmon reading logic into main.c
To support multiple nlmon sources, move the logic that reads from iwmon
device into main.c instead of nlmon.  nlmon.c now becomes agnostic of
how the packets are actually obtained.  Packets are fed in via
high-level APIs such as nlmon_print_rtnl, nlmon_print_genl,
nlmon_print_pae.
2024-01-02 10:59:38 -06:00
Denis Kenzior
a5f5578a61 monitor: Use nlmon_print_* inside nlmon_receive
The current implementation inside nlmon_receive is asymmetrical.  RTNL
packets are printed using nlmon_print_rtnl while GENL packets are
printed using nlmon_message.

nlmon_print_genl and nlmon_print_rtnl already handle iterating over data
containing multiple messages, and are used by nlmon started in reader
mode.  Use these for better symmetry inside nlmon_receive.

While here, move store_netlink() call into nlmon_print_rtnl.  This makes
handling of PCAP output symmetrical for both RTNL and GENL packets.
This also fixes a possibility where only the first message of a
multi-RTNL packet would be stored.
2024-01-02 10:59:36 -06:00
Denis Kenzior
cc371641ed monitor: Remove unused PACKET_AUXDATA handling 2024-01-02 10:59:34 -06:00
Denis Kenzior
9ba6dac066 monitor: Remove unused code path
nlmon_print_genl invokes genl_ctrl when a generic netlink control
message is encountered.  genl_ctrl() tries to filter nl80211 family
appearance messages and setup nlmon->id with the extracted family id.
However, the id is already provided inside main.c by using nlmon_open,
and no control messages are processed by nlmon in 'capture' mode (-r
command line argument not passed) since all genl messages go through
nlmon_message() path instead.
2024-01-02 10:59:20 -06:00
Ronan Pigott
c574c80e27 tree-wide: correct the spelling Ghz -> GHz
This mispelling was present in the configuration, so I retained parsing
of the legacy BandModifier*Ghz options for compatibility. Without this
change anyone spelling GHz correctly in their configs would be very
confused.
2023-11-07 21:11:50 -06:00
James Prestwood
96587f3c8c iwmon: print HE capabilities element
Adds a handler for the HE capabilities element and reworks the way
the MCS/NSS support bits are printed.

Now if the MCS support is 3 (unsupported) it won't be printed. This
makes the logs a bit shorter to read.
2023-10-16 13:22:07 -05:00
James Prestwood
95652a30d1 monitor: print contents of beacon head/tail, and probe attributes 2023-02-27 10:25:05 -06:00
Denis Kenzior
711a5ff5d1 monitor: dump IEs in FT/SAE Authenticate frames 2023-01-26 10:02:36 -06:00
James Prestwood
e70a241f34 monitor: fix buffer overrun parsing country IE
The country IE can sometimes have a zero pad byte at the end for
alignment. This was not being checked for which caused the loop
to go past the end of the IE and print an entry for channel 0
(the pad byte) plus some garbage data.

Fix this by checking for the pad byte explicitly which skips the
print and terminates the loop.
2022-12-30 11:39:16 -06:00
James Prestwood
99c0cdfab4 monitor: put nortnl check into nlmon_print_rtnl
Doing this allows --nortnl to work when reading pcaps.
2022-10-27 14:11:14 -05:00
James Prestwood
13bdb5ee80 monitor: remove -F option
This is now handled automatically by setting read_only which
bypasses the family ID check.
2022-10-26 16:48:45 -05:00
James Prestwood
ad51250835 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.
2022-10-26 16:48:21 -05:00
James Prestwood
5ebcc48814 monitor: pass config to nlmon_create
Expand nlmon_create to be useful for both pcaps and monitoring. Doing
this also lets iwmon filter pcaps based on --no-ies,rtnl,scan etc
flags since they are part of the config.
2022-10-26 16:47:46 -05:00
James Prestwood
72d35fc491 monitor: use int64_t type for NLMSG_NEXT length
Commit c7640f8346 was meant to fix a sign compare warning
in clang because NLMSG_NEXT internally compares the length
with nlmsghdr->nlmsg_len which is a u32. The problem is the
NLMSG_NEXT can underflow an unsigned value, hence why it
expects an int type to be passed in.

To work around this we can instead pass a larger sized
int64_t which the compiler allows since it can upgrade the
unsigned nlmsghdr->nlmsg_len. There is no underflow risk
with an int64_t either because the buffer used is much
smaller than what can fit in an int64_t.

Fixes: c7640f8346 ("monitor: fix integer comparison error (clang)")
2022-10-14 09:49:13 -05:00
James Prestwood
bc3722060e monitor: parse DPP frame types
Parses the type of frame for easier debugging.
2022-10-06 09:01:42 -05:00
James Prestwood
615e57c289 monitor: change Port ID to %u print
The port ID is a u32 so print with %u rather than %d
2022-10-03 10:39:46 -05:00
James Prestwood
9a447b9b31 monitor: parse probe response frames 2022-09-15 16:15:35 -05:00
James Prestwood
85dd94dfcf monitor: add support for HE element
Support for the HE IE.
2022-08-09 15:48:28 -05:00
James Prestwood
3940453ad2 monitor: print out type of unknown element
This changes the string from "Reserved" to "Unknown" which feels
more fitting, and also prints out the NL type of the unknown
element.
2022-08-09 15:48:24 -05:00
James Prestwood
0fdc5e87d1 monitor: add better array type support
The ATTR_ARRAY type was quite limited, only supporting u16/u32 and
addresses. This changes the union to a struct so nested/function
can be defined along with array_type.
2022-08-09 15:48:21 -05:00
James Prestwood
e67169337f monitor: parse RNR element 2022-08-09 15:47:37 -05:00
James Prestwood
c7640f8346 monitor: fix integer comparison error (clang)
Though the documentation for NLMSG_OK uses an int type for the length
the actual check is based on nlmsghdr->nlmsg_len which is a 32 bit
unsigned integer. Clang was complaining about one call in nlmon.c
because nlmsg_len was int type. Every other usage in nlmon.c uses
a uint32_t, so use that both for consistency and to fix the warning.

monitor/nlmon.c:7998:29: error: comparison of integers of different
		signs: '__u32' (aka 'unsigned int') and 'int'
		[-Werror,-Wsign-compare]
        for (nlmsg = iov.iov_base; NLMSG_OK(nlmsg, nlmsg_len);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/linux/netlink.h💯24: note: expanded from macro 'NLMSG_OK'
                           (nlh)->nlmsg_len <= (len))
2022-06-10 14:26:39 -05:00
James Prestwood
3348f20696 iwmon: parse ATTR_REG_RULES
This parses out the regulatory rules and prints them.
2022-02-25 13:11:23 -06:00
James Prestwood
1cd3cd2eb9 iwmon: add support for new key format
The kernel has two ways SET_KEY/NEW_KEY messages can be structured.
This implements parsers for the new key format.
2021-10-04 13:39:14 -05:00
James Prestwood
4747df491b monitor: print FT Request/Response frames 2021-09-27 19:33:05 -05:00
James Prestwood
e90356285b nlmon: update to use ie_owe_transition_info 2021-09-22 13:53:40 -05:00
James Prestwood
bfde5d4d09 nlmon: print RSNXE 2021-09-21 16:37:57 -05:00
James Prestwood
4dff4b2336 nlmon: print Mobility Domain element 2021-09-21 16:37:44 -05:00
James Prestwood
5c7b5920b0 nlmon: print Fast BSS Transition element 2021-09-21 16:37:36 -05:00
Denis Kenzior
805920dc68 monitor: print OCVC bit in RSNE 2021-09-17 08:21:49 -05:00
James Prestwood
4b7138b05c monitor: parse WFA OWE Transition IE 2021-09-16 11:22:25 -05:00
Denis Kenzior
6dbde8121d monitor: Support short form of '--noies' option 2021-09-14 10:43:36 -05:00
Denis Kenzior
eab0bf6e8a monitor: Fix invalid read
ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000512c08 at pc 0x00000041848d bp 0x7ffcdde71870 sp 0x7ffcdde71860
READ of size 8 at 0x000000512c08 thread T0
    #0 0x41848c in print_attributes monitor/nlmon.c:6268
    #1 0x42ac53 in print_message monitor/nlmon.c:6544
    #2 0x438968 in nlmon_message monitor/nlmon.c:6698
    #3 0x43d5e4 in nlmon_receive monitor/nlmon.c:7658
    #4 0x4b3cd0 in io_callback ell/io.c:120
    #5 0x4b085a in l_main_iterate ell/main.c:478
    #6 0x4b0ee3 in l_main_run ell/main.c:525
    #7 0x4b0ee3 in l_main_run ell/main.c:507
    #8 0x4b13ac in l_main_run_with_signal ell/main.c:647
    #9 0x4072fe in main monitor/main.c:811
2021-07-14 19:10:34 -05:00
Denis Kenzior
5120f46199 monitor: Dump NL80211_BAND_ATTR_HT_CAPA 2021-05-25 18:42:57 -05:00