3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-28 21:19:24 +01:00
Commit Graph

300 Commits

Author SHA1 Message Date
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
Denis Kenzior
ec6ee1c20b monitor: Dump NL80211_BAND_ATTR_HT_MCS_SET 2021-05-25 18:42:57 -05:00
Denis Kenzior
1cde7c9f3e monitor: Fix wrong bitmask for VHT capabilities
The bitmask was erroneously allowing bits 16 and 17 to be examined, but
these bits belong to the Number of Sounding Dimensions field.
2021-05-25 18:42:23 -05:00
Denis Kenzior
a20a61dca4 monitor: Dump EXPECTED_THROUGHPUT attribute 2021-05-25 18:42:23 -05:00
Denis Kenzior
0dca744d4b monitor: Print out VHT Operation & VHT Capabilities 2021-05-24 14:31:04 -05:00
James Prestwood
b531444a7c monitor: print out extended feature name
This prints out the NL80211_* enum name for extended features
rather than a hex string.
2021-03-24 14:38:32 -05:00
Denis Kenzior
ea3dedffd9 monitor: Use test_bit from ell 2021-03-12 13:46:04 -06:00
Denis Kenzior
e467566866 monitor: Use bit_field from ell 2021-03-11 22:31:50 -06:00
Denis Kenzior
7de5b4adef treewide: replace util_mem_is_zero with l_memeqzero 2021-03-09 15:40:35 -06:00
Denis Kenzior
6a7c7df7fd monitor: Dump more scan attributes 2021-02-03 13:34:11 -06:00
Denis Kenzior
996700e207 monitor: Print MEASUREMENT_DURATION* attributes 2021-02-02 15:32:49 -06:00
Denis Kenzior
83e1265c6b 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.
2021-02-02 12:04:53 -06:00
Denis Kenzior
8bf43c95a8 monitor: Pretty-print NL80211_SCAN_FLAGS 2021-02-02 10:37:12 -06:00
Denis Kenzior
8d76cae6b1 monitor: Dump some additional ROUTE attributes 2020-11-04 14:51:03 -06:00
Denis Kenzior
7c5fb5aad4 monitor: Pretty-print IFA_CACHEINFO entries 2020-11-04 14:51:00 -06:00
Denis Kenzior
609f9c8f43 monitor: Also print IPv6 addresses 2020-11-04 14:29:21 -06:00
Denis Kenzior
5ec8a9f116 monitor: Pretty-print family for RTM_*ROUTE messages 2020-11-04 13:33:58 -06:00
Denis Kenzior
ef7d33ee86 monitor: Pretty-print RTPROT_* values 2020-11-04 13:33:26 -06:00
Denis Kenzior
62810ca3e7 monitor: pid_t is signed on Linux 2020-11-04 10:56:13 -06:00
Alvin Sipraga
01912a427a monitor: print survey info results
Example output:

  > Result: New Survey Results (0x33) len 76 [multi]         14.062327
    Interface Index: 6 (0x00000006)
    Survey Info: len 64
        Frequency: 2472 (0x000009a8)
        Noise dBm: -89
        Survey Time: 100 (0x0000000000000064)
        Busy Time: 4 (0x0000000000000004)
        RX Time: 3 (0x0000000000000003)
        TX Time: 0 (0x0000000000000000)
2020-10-27 09:53:49 -05:00
Denis Kenzior
84e32ba448 monitor: Improve RTM_NEWADDR/GETADDR/DELADDR decoding 2020-10-05 22:42:13 -05:00
Denis Kenzior
e9179c4270 monitor: Nicely print scope field 2020-10-05 22:40:29 -05:00
Denis Kenzior
f9f112b4f5 monitor: Prettify CQM event decoding 2020-05-01 21:40:07 -05:00
Rosen Penev
a47609acbe iwd: remove unnecessary semicolons
Found with clang's -Wextra-semi-stmt
2020-04-08 21:02:15 -05:00
Rosen Penev
6b12593ec0 nlmon: fix -Wformat under musl 1.2.0
musl 1.2.0 uses 64-bit time, even under 32-bit OSes. Cast to int64_t
and use the proper macro.
2020-04-02 00:30:59 -05:00
Andrew Zaborowski
e705c4382a monitor: Print WFD IE contents
Only print the WFD version 2.1.0 spec subelements which removed all the
low level video format details from the IEs so this code is much
shorter.
2020-03-20 10:47:26 -05:00
Denis Kenzior
98e1d38056 monitor: Fix crash
NLMSG_OK and NLMSG_NEXT expect to operate on nlmsg_len which is an int
(signed type).  The current code uses an unsigned type which means that
it cannot detect underflows.  Such underflows can happen when NLMSG_NEXT
tries to advance nlmsg_len by a number of bytes (due to alignment) which
are greater than the current nlmsg_len itself.  This causes iwmon to
crash on certain messages.

Reported-By: Daniel Wagner <wagi@monom.org>
2020-01-22 11:52:28 -06:00
Torstein Husebø
759dbdd37f treewide: fix typos 2020-01-21 16:03:28 -06:00
Marcel Holtmann
ce2b0e7cc6 monitor: Use include path from top source directory 2019-12-13 09:04:15 +01:00
Andrew Zaborowski
b715022ce6 iwmon: Update to use NL80211_ATTR_SOCKET_OWNER
NL80211_ATTR_IFACE_SOCKET_OWNER was renamed to NL80211_ATTR_SOCKET_OWNER.
2019-12-08 21:47:21 -06:00