3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-09 05:29:23 +01:00
Commit Graph

7064 Commits

Author SHA1 Message Date
James Prestwood
f555e5dda2 wiphy: fix runtime error from bit shift
The compiler treated the '1' as an int type which was not big enough
to hold a bit shift of 31:

runtime error: left shift of 1 by 31 places cannot be represented in
		type 'int'

Instead of doing the iftype check manually, refactor
wiphy_get_supported_iftypes by adding a subroutine which just parses
out iftypes from a mask into a char** list. This removes the need to
case each iftype into a string.
2022-08-04 10:20:59 -05:00
Denis Kenzior
61682cdc97 gitignore: Add tools/iwd-psk 2022-08-04 10:20:10 -05:00
Alexander Kobel
cfd2fe7d33 manager: Fix typo 2022-08-04 09:15:50 -05:00
Michael Johnson
6b87d3e7e2 netdev: Add logging for CQM messages
Add extra logging around CQM events to help track wifi status. This is
useful for headless systems that can only be accessed over the network
and so information in the logs is invaluable for debugging outages.

Prior to this change, the only log for CQM messages is saying one was
received. This adds details to what attributes were set and the
associated data with them.

The signal strength log format was chosen to roughly match
wpa_supplicant's which looks like this:

CTRL-EVENT-SIGNAL-CHANGE above=1 signal=-60 noise=-96 txrate=6000
2022-08-02 11:11:18 -05:00
Michael Johnson
f4c3278a7b station: Log scan results during a roam
Provides useful information on why a roam might have failed, such as
failing to find the BSS or the BSS being ranked lower, and why that
might be.

The output format is the same as station_add_seen_bss for consistency.
2022-08-01 10:17:23 -05:00
James Prestwood
d9a16fee56 nl80211util: add nested attribute support
Adds support for nested attributes in nl80211_parse_attrs
2022-07-26 15:31:37 -05:00
James Prestwood
f2961cd63a wiphy: constrain scan set by disabled frequencies
With the addition of disabled_freqs, wiphy_constrain_freq_set needs
to also remove any frequencies which are disabled.
2022-07-26 15:31:31 -05:00
James Prestwood
98620ecd11 wiphy: add disabled_freqs list
If a frequency is disabled IWD should keep track and disallow any
operations on that channel such as scanning. A new list has been added
which contains only disabled frequencies.
2022-07-26 15:31:08 -05:00
James Prestwood
081b0af2d6 util: add scan_freq_set_subtract
Removes any frequencies from one set that are found in the other.
2022-07-26 13:13:11 -05:00
James Prestwood
3f1d72e545 util: make scan_freq_set_get_bands const 2022-07-26 13:13:04 -05:00
James Prestwood
b52ed27b72 scan: make scan_freq_set const in scan_passive
The scan_passive API wasn't using a const struct scan_freq_set as it
should be since it's not modifying the contents. Changing this to
const did require some additional changes like making the scan_parameters
'freqs' member const as well.

After changing scan_parameters, p2p needed updating since it was using
scan_parameters.freqs directly. This was changed to using a separate
scan_freq_set pointer, then setting to scan_parameters.freqs when needed.
2022-07-26 13:12:38 -05:00
James Prestwood
7d6a38de93 auto-t: iwd.py: let IWD class specify developer mode 2022-07-26 13:11:39 -05:00
James Prestwood
71ac0a8909 test-runner: make developer mode optional
IWD can now be started without -E if needed
2022-07-26 13:11:33 -05:00
James Prestwood
1efbe1637f manager: unregister nl80211 config watch
For consistency unregister the config watch when manager exits
2022-07-26 13:11:22 -05:00
Denis Kenzior
4353935e0a gitignore: Add pycache directories 2022-07-22 12:41:53 -05:00
James Prestwood
890f212af2 unit: add HE tests to test-band
This tests for all the possible widths selected in 2.4 and 5/6GHz,
as well as some failure tests.
2022-07-20 17:19:42 -05:00
James Prestwood
aff5663c0b build: add ie.c/netdev.h to test-band build 2022-07-20 17:19:39 -05:00
James Prestwood
4e55447a60 wiphy: use HE element for data rate estimation
If an HE element is found, prefer using this for the rate estimation
since it will likely yield the fastest rate.
2022-07-20 17:19:25 -05:00
James Prestwood
43db085ef1 band: add band_estimate_he_rx_rate
Similar to the HT/VHT APIs, this estimates the data rate based on the
HE Capabilities element, in addition to our own capabilities. The
logic is much the same as HT/VHT. The major difference being that HE
uses several MCS tables depending on the channel width. Each width
MCS set is checked (if supported) and the highest estimated rate out
of all the MCS sets is used.
2022-07-20 17:19:07 -05:00
James Prestwood
53988a7285 ie: add validation for HE Capabilities element
This makes sure the width set bits are sane, and validates the length
depending on which MCS sets are enabled.
2022-07-20 17:18:35 -05:00
Jesse Lentz
fb014268d5 doc: Mention "wep" network type
Document "wep" as a possible Network Type. Mention that connections to WEP
networks are unsupported.
2022-07-20 12:34:55 -05:00
James Prestwood
a3521ff172 wiphy: fix strange compiler bug with gcc 11.2
There appears to be a compiler bug with gcc 11.2 which thinks the vht_mcs_set
is a zero length array, and the memset of size 8 is out of bounds. This is only
seen once an element is added to 'struct band'.

In file included from /usr/include/string.h:519,
                 from src/wiphy.c:34:
In function ‘memset’,
    inlined from ‘band_new_from_message’ at src/wiphy.c:1300:2,
    inlined from ‘parse_supported_bands’ at src/wiphy.c:1423:11,
    inlined from ‘wiphy_parse_attributes’ at src/wiphy.c:1596:5,
    inlined from ‘wiphy_update_from_genl’ at src/wiphy.c:1773:2:
/usr/include/bits/string_fortified.h:59:10: error: ‘__builtin_memset’ offset [0, 7] is out of the bounds [0, 0] [-Werror=array-bounds]
   59 |   return __builtin___memset_chk (__dest, __ch, __len,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   60 |                                  __glibc_objsize0 (__dest));
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-07-19 17:45:19 -05:00
James Prestwood
7f63872dcf unit: memset band to zero after alloc
In test-band the band object was allocated using l_malloc, but not
memset to zero. This will cause problems if allocated pointers are
included in struct band once band is freed.
2022-07-19 17:45:10 -05:00
James Prestwood
6c6bfb3d16 scan: increase max data rate, now for HE
This increases the maximum data rate which now is possible with HE.
A few comments were also updated, one to include 6G when adjusting
the rank for >4000mhz, and the other fixing a typo.
2022-07-19 16:25:42 -05:00
James Prestwood
a7ed0e6ba5 band: add find_best_mcs_nss
This is a general way of finding the best MCS/NSS values which will work
for HT, VHT, and HE by passing in the max MCS values for each value which
the MCS map could contain (0, 1, or 2).
2022-07-19 15:51:17 -05:00
James Prestwood
9baaaebd38 wiphy: parse HE capabilities from band info
The HE capabilities information is contained in
NL80211_BAND_ATTR_IFTYPE_DATA where each entry is a set of attributes
which define the rules for one or more interface types. This patch
specifically parses the HE PHY and HE MCS data which will be used for
data rate estimation.

Since the set of info is per-iftype(s) the data is stored in a queue
where each entry contains the PHY/MCS info, and a uint32 bit mask where
each bit index signifies an interface type.
2022-07-19 15:47:35 -05:00
James Prestwood
3d48d147ca wiphy: make MCS info print more generic
With the addition of HE, the print function for MCS sets needs to change
slightly. The maps themselves are the same format, but the values indicate
different MCS ranges. Now the three MCS max values are passed in.
2022-07-19 15:46:49 -05:00
James Prestwood
bdcbccbb9f wiphy: use a 16 bit tag for extended IEs
If an extended IE is needed a uint8_t tag would overflow.
2022-07-19 15:46:44 -05:00
James Prestwood
d46fac6e93 wiphy: set band->freq when parsing band info
This sets the band into the 'band' structure in order to support
HE data rates.
2022-07-19 15:46:10 -05:00
James Prestwood
fce1449a87 band: add he_capabilities queue
This queue will hold iftype(s) specific data for HE capabilities. Since
the capabilities may differ per-iftype the data is stored as such. Iftypes
may share a configuration so the band_he_capabilities structure has a
mask for each iftype using that configuration.
2022-07-19 15:45:58 -05:00
James Prestwood
62bdd1bea5 band: add band_freq
HE has different rules depending on the frequency, so the band
structure also needs to track the frequency for any rate information
to have context.
2022-07-19 15:45:47 -05:00
James Prestwood
d8fe443363 ie: add IE's from 802.11ax amendment 2022-07-19 15:45:28 -05:00
James Prestwood
e089ab2de2 scan: add colocated scan flag 2022-07-19 15:45:18 -05:00
James Prestwood
07a3b1d655 test-runner: automatically find PCI passthrough config
When PCI adapters are properly configured they should exist in the
vfio-pci system tree. It is assumed any devices configured as such
are used for test-runner.

This removes the need for a hw.conf file to be supplied, but still
is required for USB adapters. Because of this the --hw option was
updated to allow no value, or a file path.
2022-07-19 14:32:49 -05:00
James Prestwood
99773ea7e8 test-runner: start dbus with --start
Starts dbus-daemon as well as sets the right environment variables
so IWD can start (and any other dbus services).
2022-07-19 14:32:49 -05:00
James Prestwood
5692dcf9a0 test-runner: allow infinite process wait
subprocess.Popen's wait() method was overwritten to be non-blocking but
in certain circumstances you do want to wait forever. Fix this to allow
timeout=None, which calls the parent wait() method directly.
2022-07-19 14:32:49 -05:00
Denis Kenzior
c57a15d21c tools: Add CONFIG_CRYPTO_ECDSA 2022-07-18 10:58:06 -05:00
Denis Kenzior
b84b71042b iwd: Add missing module dependencies
Certain module dependencies were missing, which could cause a crash on
exit under (very unlikely) circumstances.

  #0  l_queue_peek_head (queue=<optimized out>) at ../iwd-1.28/ell/queue.c:241
  #1  0x0000aaaab752f2a0 in wiphy_radio_work_done (wiphy=0xaaaac3a129a0, id=6)
      at ../iwd-1.28/src/wiphy.c:2013
  #2  0x0000aaaab7523f50 in netdev_connect_free (netdev=netdev@entry=0xaaaac3a13db0)
      at ../iwd-1.28/src/netdev.c:765
  #3  0x0000aaaab7526208 in netdev_free (data=0xaaaac3a13db0) at ../iwd-1.28/src/netdev.c:909
  #4  0x0000aaaab75a3924 in l_queue_clear (queue=queue@entry=0xaaaac3a0c800,
      destroy=destroy@entry=0xaaaab7526190 <netdev_free>) at ../iwd-1.28/ell/queue.c:107
  #5  0x0000aaaab75a3974 in l_queue_destroy (queue=0xaaaac3a0c800,
      destroy=destroy@entry=0xaaaab7526190 <netdev_free>) at ../iwd-1.28/ell/queue.c:82
  #6  0x0000aaaab7522050 in netdev_exit () at ../iwd-1.28/src/netdev.c:6653
  #7  0x0000aaaab7579bb0 in iwd_modules_exit () at ../iwd-1.28/src/module.c:181

In this particular case, wiphy module was de-initialized prior to the
netdev module:

Jul 14 18:14:39 localhost iwd[2867]: ../iwd-1.28/src/wiphy.c:wiphy_free() Freeing wiphy phy0[0]
Jul 14 18:14:39 localhost iwd[2867]: ../iwd-1.28/src/netdev.c:netdev_free() Freeing netdev wlan0[45]
2022-07-18 10:58:06 -05:00
Marcel Holtmann
f807901c47 Release 1.29 2022-07-15 19:06:48 +02:00
Marcel Holtmann
f2ccc1bf84 build: Require at least version 0.52 when building with external ELL 2022-07-15 18:59:56 +02:00
Denis Kenzior
0593846ffc tools: Add CONFIG_CRYPTO_GCM
Certain TLS suites are based on AES/GCM, make sure it is added to the
reference test-runner kernel config.
2022-07-14 11:50:37 -05:00
Denis Kenzior
ee68e44b80 tools: Remove ARC4 from t-runner reference config
ARC4 is now supported natively inside ell and has been made unavailable
via the skcipher userspace API.
2022-07-14 11:49:30 -05:00
Andrew Zaborowski
043a6959e0 test-runner: Mark source directory as safe for git
Since we use git ls-files to produce the list of all tests for -A, if
the source directory is owned by somebody other than root one might
get:

fatal: unsafe repository ('/home/balrog/repos/iwd' is owned by someone else)
To add an exception for this directory, call:

	git config --global --add safe.directory /home/balrog/repos/iwd

Starting
/home/balrog/repos/iwd/tools/..//autotests/ threw an uncaught exception
Traceback (most recent call last):
  File "/home/balrog/repos/iwd/tools/run-tests", line 966, in run_auto_tests
    subtests = pre_test(ctx, test, copied)
  File "/home/balrog/repos/iwd/tools/run-tests", line 814, in pre_test
    raise Exception("No hw.conf found for %s" % test)
Exception: No hw.conf found for /home/balrog/repos/iwd/tools/..//autotests/

Mark args.testhome as a safe directory on every run.
2022-07-12 12:47:50 -05:00
Andrew Zaborowski
d58e754344 autotests: Also validate correct hostname sent over DHCPv4 2022-07-12 12:47:09 -05:00
Andrew Zaborowski
187706c348 autotests: DHCPv4 renewal/resend test in testNetconfig
Test that the DHCPv4 lease got renewed after the T1 timer runs out.
Then also simulate the DHCPREQUEST during renew being lost and
retransmitted and the lease eventually getting renewed T1 + 60s later.

The main downside is that this test will inevitably take a while if
running in Qemu without the time travel ability.

Update the test and some utility code to run hostapd in an isolated net
namespace for connection_test.py.  We now need a second hostapd
instance though because in static_test.py we test ACD and we need to
produce an IP conflict.  Moving the hostapd instance unexpectedly fixes
dhcpd's internal mechanism to avoid IP conflicts and it would no longer
assign 192.168.1.10 to the second client, it'd notice that address was
already in use and assign the next free address, or fail if there was
none.  So add a second hostapd instance that runs in the main namespace
together with the statically-configured client, it turns out the test
relies on the kernel being unable to deliver IP traffic to interfaces on
the same system.
2022-07-12 12:47:09 -05:00
Andrew Zaborowski
39fa246d9e test-runner: Support running hostapd in namespaces
The kernel will not let us test some scenarios of communication between
two hwsim radios (e.g. STA and AP) if they're in the same net namespace.
For example, when connected, you can't add normal IPv4 subnet routes for
the same subnet on two different interfaces in one namespace (you'd
either get an EEXIST or you'd replace the other route), you can set
different metrics on the routes but that won't fix IP routing.  For
testNetconfig the result is that communication works for DHCP before we
get the inital lease but renewals won't work because they're unicast.
Allow hostapd to run on a radio that has been moved to a different
namespace in hw.conf so we don't have to work around these issues.
2022-07-12 12:47:09 -05:00
James Prestwood
6022ebaa36 test-runner: run prepare_environment with --start
The --start option was directly passed to the kernel init parameter,
preventing any environment setup from happening.

Intead always use 'run-tests' as the init process but detect --start
and execute that binary/script once inside the environment.
2022-07-11 11:11:35 -05:00
James Prestwood
b7664c7970 client: update ad-hoc table header
The table header needs to be adjusted to include spaces between
columns.
2022-07-07 14:09:03 -05:00
James Prestwood
951781686b client: update adapter table header
The table header needs to be adjusted to include spaces between
columns.

The 'adapter list' command was also updated to shorted a few
columns which were quite long for the data that is actually displayed.
2022-07-07 14:09:03 -05:00
James Prestwood
6ce16686df client: update device to use display_table_row 2022-07-07 14:09:03 -05:00