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

6800 Commits

Author SHA1 Message Date
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
James Prestwood
82cc80e54e client: update command table header
The table header needs to be adjusted to include spaces between
columns.
2022-07-07 14:09:03 -05:00
James Prestwood
5bf1410ac4 client: update known-networks to use display_table_row 2022-07-07 14:09:03 -05:00
James Prestwood
89a86d0975 client: update ap to use display_table_row 2022-07-07 14:09:03 -05:00
James Prestwood
0b68601c10 client: make COLOR_* macros take a string input
The existing color code escape sequences required the user to set the
color, write the string, then unset with COLOR_OFF. Instead the macros
can be made to take the string itself and automatically terminate the
color with COLOR_OFF. This makes for much more concise strings.
2022-07-07 14:09:03 -05:00
James Prestwood
e4c3cfd229 client: update CLEAR_SCREEN to be consistent with others
Clear screen used a \033 escape sequence while others used a \x
2022-07-07 14:09:03 -05:00
James Prestwood
da8a87fcf5 client: check NULL return for DPP cmd_show
If the DPP interface goes away this could return NULL which was
unchecked. Caught by static analysis.
2022-07-07 14:09:03 -05:00
James Prestwood
3ccaf7beed client: dpp: display table footer and set to auto update
The table footer never got added when the properties did. In addition
set the 'show' command to update since these properties could change.
2022-07-07 14:09:03 -05:00
James Prestwood
35dd2c0821 client: update station to use display_table_row
This includes updating diagnostics too, otherwise the output becomes
really nasty.
2022-07-07 14:09:03 -05:00
James Prestwood
e1d485029b client: update dbus-proxy to use display_table_row 2022-07-07 14:09:03 -05:00
James Prestwood
c7b0c57010 client: remove newline/tab encoding from help description
ad-hoc, ap, and wsc all had descriptions longer than the max width but
this is now taken care of automatically. Remove the tab and newline's
from the description.

The WSC pin command description was also changed to be more accurate
since the pin does not need to be 8 digits.
2022-07-07 14:09:03 -05:00
James Prestwood
80051f0124 client: add generic display function for table rows
There was no easy to use API for printing the contents of a table, and
was left up to the caller to handle manually. This adds display_table_row
which makes displaying tables much easier, including automatic support
for line truncation and continuation on the next line.

Lines which are too long will be truncated and displayed on the next
line while also taking into account any colored output. This works with any
number of columns.

This removes the need for the module to play games with encoding newlines
and tabs to make the output look nice.

As a start, this functionality was added to the command display.
2022-07-07 14:08:56 -05:00
James Prestwood
80f9374440 ap: remove diagnostic interface when netdev goes down
This fixes a crash associated with toggling the iftype to AP mode
then calling GetDiagnostics. The diagnostic interface is never
cleaned up when netdev goes down so DBus calls can still be made
which ends up crashing since the AP interface objects are no longer
valid.

Running the following iwctl commands in a script (once or twice)
triggers this crash reliably:

iwctl device wlp2s0 set-property Mode ap
iwctl device wlp2s0 set-property Mode station
iwctl device wlp2s0 set-property Mode ap
iwctl ap wlp2s0 start myssid secret123
iwctl ap wlp2s0 show

++++++++ backtrace ++++++++
0  0x7f8f1a8fe320 in /lib64/libc.so.6
1  0x451f35 in ap_dbus_get_diagnostics() at src/ap.c:4043
2  0x4cdf5a in _dbus_object_tree_dispatch() at ell/dbus-service.c:1815
3  0x4bffc7 in message_read_handler() at ell/dbus.c:285
4  0x4b5d7b in io_callback() at ell/io.c:120
5  0x4b489b in l_main_iterate() at ell/main.c:476
6  0x4b49a6 in l_main_run() at ell/main.c:519
7  0x4b4cd9 in l_main_run_with_signal() at ell/main.c:645
8  0x404f5b in main() at src/main.c:600
9  0x7f8f1a8e8b75 in /lib64/libc.so.6
+++++++++++++++++++++++++++
2022-07-01 11:58:06 -05:00
James Prestwood
ac8e9f53f2 auto-t: add client test to testAP
Tests iwctl functionality with ap commands
2022-06-30 13:38:02 -05:00
James Prestwood
d1c5e42ae2 auto-t: refactor testAP to reuse code
All the AP tests were basically doing the same validation. Refactor
this code into validation.py and import that into the tests.
2022-06-30 13:38:02 -05:00