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

372 Commits

Author SHA1 Message Date
James Prestwood
da3f66ea68 auto-t: add optional scan argument to get_ordered_network(s)
There is a very common block of code inside many autotests
which goes something like:

device.scan()
condition = 'obj.scanning'
wd.wait_for_object_condition(device, condition)
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
network = device.get_ordered_network('an-ssid')

When you see the same pattern in nearly all the tests this shows
we need a helper. Basic autotests which merely check that a
connection succeeded should not need to write the same code again
and again. This code ends up being copy-pasted which can lead to
bugs.

There is also a code pattern which attempts to get ordered
networks, and if this fails it scans and tries again. This, while
not optimal, does prevent unneeded scanning by first checking if
any networks already exist.

This patch solves both the code reuse issue as well as the recovery
if get_ordered_network(s) fails. A new optional parameter was
added to get_ordered_network(s) which is False by default. If True
get_ordered_network(s) will perform a scan if the initial call
yields no networks. Tests will now be able to simply call
get_ordered_network(s) without performing a scan before hand.
2020-05-02 06:40:23 -05:00
James Prestwood
8126899eda auto-t: change blacklist test RSSI values
These values were meant only to force IWD's BSS preference but
since the RSSI's were so low in some cases this caused a roam
immediately after connecting. This patch changes the RSSI values
to prevent a roam from happening.
2020-05-01 23:01:42 -05:00
Tim Kourt
57ce53f1ac auto-t: Fix event order
In addition, use the conditional wait for the expected number
of known networks
2020-04-09 16:46:31 -05:00
Tim Kourt
000b533194 auto-t: Remove unused imports 2020-04-09 16:46:31 -05:00
Tim Kourt
d3339ddb72 auto-t: Use proper connection status indicator
'Connected' property of the network object is set before the connection
attempt is made and does not indicate a connection success. Therefore,
use device status property to identify the connection status of the device.
2020-04-09 16:46:31 -05:00
James Prestwood
83128c797f auto-t: check linkmode/operstate in adhoc test (open)
A previous patch fixed the linkmode/operstate for open AdHoc networks.
2020-04-08 16:35:06 -05:00
James Prestwood
72bf3aa1f5 auto-t: remove iwd_config_dir from autotests
This is no longer needed unless setting a different
directory than /tmp
2020-03-21 00:10:36 -05:00
James Prestwood
9eb0f973f3 auto-t: fix testAddressRandomization
This test was dependent on having a local main.conf in /etc/iwd
2020-03-21 00:10:34 -05:00
James Prestwood
e7a9a43410 auto-t: add test for AddressRandomization option
Tests all cases of AddressRandomization=network

1. Deterministic generation per-network (default)
2. Full randomization per-network
3. Address override per-network
2020-03-18 18:15:16 -05:00
Tim Kourt
40ad8be113 auto-t: Test PEAPv0 cryptobinding 2020-02-03 11:34:29 -06:00
Torstein Husebø
759dbdd37f treewide: fix typos 2020-01-21 16:03:28 -06:00
James Prestwood
38fa76faf5 auto-t: use stand alone radius server for testFT-FILS-SHA384
This fixes the test with recent hostapd versions
2020-01-06 11:18:48 -06:00
James Prestwood
c01751c2b3 auto-t: use stand alone radius server for testFT-FILS-SHA256
This fixes the test with recent hostapd versions
2020-01-06 11:18:48 -06:00
James Prestwood
112f1f2bef auto-t: use stand alone radius server for testFILS
This fixes the test with recent hostapd versions
2020-01-06 11:18:48 -06:00
James Prestwood
40a79dc90b auto-t: add RRM test for scan duration
mac80211_hwsim does not actually support SET_SCAN_DWELL, but since we are
not setting duration mandatory the request should still be accepted.
2019-11-15 14:17:25 -06:00
James Prestwood
c961dafc50 auto-t: let testEAP-TTLS-MSCHAPv2 use HostapdCLI easier
This test made it past the initial refactor to use HostapdCLI with the
'config' parameter. This avoids the need to iterate the hostapd map in
the actual test.
2019-11-14 15:23:03 -06:00
James Prestwood
0c586dc8ca auto-t: give testEAP-TTLS-MSCHAPv2 a longer timeout
When logging is turned on this test consistently fails due to a
timeout. Giving it a bit more time allows it to pass.
2019-11-14 15:23:03 -06:00
James Prestwood
dcbdbac2f8 auto-t: fix intermittent failures in testEAP-MSCHAPV2
Occationally autoconnect would start which was not expected in the
test. This is fixed by disabling autoconnect in the provisioning files.
2019-11-14 12:58:18 -06:00
James Prestwood
a3817ba015 auto-t: add ctrl_interface to testHotspot
This is now required for any test using HostapdCLI
2019-11-13 16:37:17 -06:00
James Prestwood
088ed86f3d auto-t: add ctrl_interface to testHT-VHT
This is now required for any test using HostapdCLI
2019-11-13 16:37:17 -06:00
James Prestwood
5e98a1bbe5 auto-t: add ctrl_interface to testFILS
This is now required for any test using HostapdCLI
2019-11-13 16:37:17 -06:00
James Prestwood
7c2f73148c auto-t: add ctrl_interface to testOWE
This is now required for any test using HostapdCLI
2019-11-13 16:37:17 -06:00
James Prestwood
b45242562b auto-t: add RRM autotest
This test merely verifies hostapd receieved our measurement reports
and verified they were valid. Hostapd does not verify the actual
beacon report body. Really, the only way to test this is on an
actual network which makes these requests.
2019-11-07 12:26:19 -06:00
James Prestwood
87bd9f4c6e auto-t: support hostapd event processing
Hostapd has a feature where you can connect to its control socket and
receive events it generates. Currently we only send commands via this
socket.

First we open the socket (/var/run/hostapd/<iface>) and send the
ATTACH command. This tells hostapd we are ready and after this any
events will be sent over this socket.

A new API, wait_for_event, was added which takes an event string and
waits for some timeout. The glib event loop has been integrated into
this, though its not technically async since we are selecting over a
socket which blocks. To mitigate this a small timeout was chosen for
each select call and then wrapped in a while loop which waits for the
full timeout.
2019-11-04 14:42:17 -06:00
Denis Kenzior
22cba31c8b auto-t: update to the new AgentManager path 2019-10-28 18:08:54 -05:00
James Prestwood
4fcb6c3cc6 auto-t: update testEAP-TLS to use HostapdCLI
This test did not use the updated HostapdCLI where you can specify
a config file rather than iterate hostapd list.
2019-10-28 15:01:36 -05:00
James Prestwood
14df50a0ab auto-t: fix random failures in testEAP-MSCHAPV2
Its difficult to know 100%, but this random test failures appeared
to be caused by two issues. One was that get_ordered_network is being
checked for None, when it was returning a zero length array. Because
of this the scanning block was never executed in any cases. This was
fixed in the previous commit. The other issue was the disconnect at
the start of the tests. The disconnect will cause all pending scans
to cancel, which appeared to cause the scanning block below to be
skipped over quickly if the timing was right. Then, afterwards,
getting a single network failed because scanning was not complete.
2019-10-28 15:01:33 -05:00
James Prestwood
fc9342f751 auto-t: return None with get_ordered_network(s)
If no networks are found, return None rather than an empty
array. This is easier to check by the caller (and was assumed
in some cases). Also add an exception to get_ordered_network
if no network is found.
2019-10-28 14:59:58 -05:00
Denis Kenzior
d12ee292aa treewide: Use CamelCase for disable_anqp setting 2019-10-24 23:18:23 -05:00
Denis Kenzior
e540978633 treewide: Use CamelCase for [Scan] settings 2019-10-24 15:58:08 -05:00
Denis Kenzior
19a85a85e7 treewide: Rename EAP mtu key to MTU 2019-10-24 13:51:20 -05:00
Denis Kenzior
d66139fe34 treewide: Switch to CamelCase for Blacklist settings 2019-10-24 13:38:11 -05:00
Denis Kenzior
aa13f5458d auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
Denis Kenzior
2521830d3e auto-t: Update to use InvalidArguments error 2019-10-24 10:54:45 -05:00
Denis Kenzior
584712dc6d auto-t: Update to the new wsc api naming 2019-10-24 10:49:13 -05:00
James Prestwood
cdc9eb13aa auto-t: hostapd: raise exception upon invalid config
If the config file passed in is not found we would continue and
eventually something else would fail. Instead immediately raise an
exception to be more clear on what is actually failing.
2019-10-22 21:58:30 -05:00
James Prestwood
8885135e63 auto-t: add TLS test with embedded PEMs 2019-10-07 23:09:29 -05:00
Tim Kourt
b3ccabea9e auto-t: Exercise '--dontask' iwctl command-line option 2019-09-19 12:36:12 -05:00
James Prestwood
e3fe7ab18e auto-t: test frequency removal and cleanup
This cleans up the test, but also adds some code to make sure the
frequency file is updated when a known network is forgotten
2019-09-16 13:49:08 -05:00
James Prestwood
c1890c6b06 auto-t: updated testScanKnownFreqs
This autotest was manually creating the .known_network.freq file so
the UUID needed to be manually generated and updated for the test
to function correctly.
2019-09-12 11:36:00 -05:00
James Prestwood
6503a1b482 auto-t: add frequency_test to testKnownNetworks
This tests that the known frequency file works as expected, both
for PSK and hotspot (and 8021x) networks.
2019-09-12 11:35:57 -05:00
Tim Kourt
bab9a4b6f2 auto-t: Remove no longer relevant test
The client prompts user for the missing secrets now, instead of
exiting with an error status code.
2019-09-11 11:48:24 -05:00
James Prestwood
50c947b53c auto-t: set CONFIGURATION_DIRECTORY
The --config option was removed, so any tests which start IWD from
python need to set this option if they need a special configuration
directory.
2019-09-09 15:40:09 -05:00
James Prestwood
c17b0ce04e auto-t: check for known networks in EAP-WSC
Make sure changes to WSC continue to work with known networks
2019-08-28 13:06:40 -05:00
James Prestwood
a0a81c72e1 auto-t: add autoconnect hotspot test 2019-08-28 11:28:53 -05:00
James Prestwood
0766138432 auto-t: update testHotspot with new Name requirements 2019-08-21 14:17:15 -05:00
James Prestwood
0f55b0023d auto-t: add hotspot to testKnownNetworks 2019-08-21 14:17:00 -05:00
James Prestwood
0846f76703 auto-t: add 'hotspot' network type 2019-08-21 14:16:08 -05:00
Tim Kourt
636bf5749f auto-t: Test client's non-interactive connect command 2019-08-15 15:06:59 -05:00
James Prestwood
5af5498aa9 auto-t: add shell test
This is merely an empty test that can act as a sandbox for the new
--shell command. It was not named with 'test' so that autotesting
will skip it.

This test is not very useful for virtual hardware testing
(mac80211_hwsim), but very useful for USB/PCI passthrough. When
setup correctly, you can now pass through a single device and test
against real networks with a minimal kernel.
2019-08-07 16:37:51 -05:00
James Prestwood
e2ec571f06 auto-t: remove dbus scan call in SAE autoconnect test
Doing this scan causes issues in the test. Like with other autoconnect
tests we can just use the fact that IWD will always be doing a periodic
scan during start up, so we only need to wait for that to finish before
querying the network list.
2019-08-02 02:23:45 -05:00
James Prestwood
43e9cce1dc auto-t: fix hotspot tests to remove main.conf
The hotspot tests were not cleaning up /tmp/main.conf, which resulted
in future tests failing.
2019-08-02 02:21:53 -05:00
Tim Kourt
9736bc211c auto-t: Test disconnect on connect while connected 2019-07-23 17:19:12 -05:00
James Prestwood
ce9e61d727 auto-t: hotspot dir not hidden 2019-07-15 11:14:01 -05:00
James Prestwood
c5eba1cc27 auto-t: add test for Hotspot with roaming consortium 2019-07-15 11:11:29 -05:00
James Prestwood
e5dedc3378 auto-t: add HESSID hotspot autotest
This tests the use of ONLY the HESSID configuration option. In
this test we also explicitly disable ANQP.
2019-07-03 13:02:28 -05:00
James Prestwood
7ed51a2d95 auto-t: update testHotspot with copy_to_hotspot 2019-07-03 13:02:28 -05:00
James Prestwood
cdc80cd341 auto-t: add copy_to_hotspot
Initially the solution to copying files to .hotspot was to use the
existing copy_to_storage, but allow full directory copying. Doing it
this way does not allow us to copy single files into .hotspot which
makes it difficult to test single configurations in several consecutive
tests.

This adds a new API, copy_to_hotspot, where a single hotspot config
can be provided. clear_storage was also modified to clear out the
.hotspot directory in addition to the regular storage directory.
2019-07-03 13:02:28 -05:00
James Prestwood
1a2f10dacd auto-t: allow copy_to_storage to copy directories 2019-07-03 11:36:08 -05:00
James Prestwood
f9aeee8707 auto-t: add Hotspot autotest 2019-06-27 13:01:00 -05:00
James Prestwood
65eeab1313 auto-t: updated autotests to use hwsim.get_radio
This removes all the duplicated code where the interfaces are iterated
and the radio/hostapd instances are created. Instead the two new APIs
are used to get each instance, e.g.:

hapd = HostapdCLI(config='ssid.conf')
radio = hwsim.get_radio('radX')
2019-06-11 11:44:00 -05:00
James Prestwood
0c554500e1 auto-t: add simple getter for radios 2019-06-11 11:44:00 -05:00
James Prestwood
1561392614 auto-t: update testOWE to use new HostapdCLI 2019-06-05 16:18:26 -05:00
James Prestwood
5937bfafca auto-t: update testFILS to use new HostapdCLI 2019-06-05 16:18:26 -05:00
James Prestwood
35f06ef87a auto-t: hostapd: allow CLI to lookup by config file
There is a common interface lookup in many tests in order to initialize
the HostapdCLI object e.g.:

for intf in hostapd_map.values():
    if intf.config == 'ssidOWE.conf':
        hapd = HostapdCLI(intf)
        break

Instead of having to do this in every test, HostapdCLI will now
optionally take a config file (config=<file>). The interface object
will still be prefered (i.e. supplying an interface will not even
check the config file) as to not break existing tests. But if only
a config file is supplied the lookup is done internally.

There are some tests that do still need the interface, as they do
an interface lookup to initialize both hostapd and hwsim at the
same time.
2019-06-05 16:18:26 -05:00
James Prestwood
55a077d399 auto-t: testutil: allow skipping of group traffic test
If the network does not support group traffic we can now skip the
broadcast test by specifying group=False in test_ifaces_connected.
2019-06-05 16:18:26 -05:00
James Prestwood
77d66ebc54 auto-t: FILS-FT autotest 2019-05-23 15:28:24 -05:00
James Prestwood
e5d36bbb33 auto-t: add AP test with no AP iftype support
Ensures IWD properly handles an adapter which does not support AP mode.
2019-05-13 16:38:23 -05:00
James Prestwood
f30c4bf578 auto-t: handle exceptions correctly for start_ap
The start_ap method was raising potential dbus errors before converting
them to an IWD error type. This is due to dbus.Set() not taking an error
handler. The only way to address this is to catch the error, convert it
and raise the converted error.
2019-05-13 16:38:23 -05:00
James Prestwood
d6eade2252 auto-t: add test for CCMP with no support
Using the new cipher_disable hwsim option we can disable CCMP support
but require it on the AP. This should result in a Not Supported error.
2019-05-13 16:38:23 -05:00
James Prestwood
02a0a821b4 auto-t: add test for FT-over-DS 2019-05-09 13:38:48 -05:00
James Prestwood
1801262f2a auto-t: update FT tests to disable FT-over-DS 2019-05-09 12:26:33 -05:00
James Prestwood
7f3e47881b auto-t: remove rekey from testFILS
mac80211_hwsim is not quite ready to allow rekeys (will be soon).
2019-05-08 14:42:21 -05:00
James Prestwood
7cbbca23ce auto-t: fix OWE tests, use explicit ifnames 2019-05-02 13:34:04 -05:00
James Prestwood
19bb93a622 auto-t: require "needs_hwsim" on hwsim tests
Running autotests with native hardware will not work on tests which
depend on the hwsim python API (since hwsim will not be running).
For these tests, it will now be required that they specify:

needs_hwsim=1

This allows the test to be skipped when running with native hardware
rather than the test failing with a python exception.
2019-05-01 17:03:37 -05:00
James Prestwood
4209837c0d auto-t: update testFILS to do PTK rekeys 2019-04-26 12:40:13 -05:00
James Prestwood
a6d7907a61 auto-t: fix FILS-384 autotest
This new test was merged during the time when testutil was not working
properly, so it was never verified to work with respect to testutil
(testing for 'connected' has always worked).

Since testFILS has 2 hostapd interfaces test_interface_connected was
defaulting to the incorrect interface for the SHA384 test. Now, the
explicit interfaces are passed in when checking for connectivity.
2019-04-26 12:22:58 -05:00
Andrew Zaborowski
1521b57ec9 autotests: Use device.name instead of a hardcoded interface 2019-04-22 18:20:06 -05:00
Andrew Zaborowski
c73575585b autotests: Remove del wd at the end function pattern
Don't use del wd to dereference the IWD instance at the end of the function
where it has been defined in the first place as at this point wd is about
to have its reference count decreased anyway (the variable's scope is
ending) so it's pointless (but didn't hurt).

Relying on the __del__ destructor to kill the IWD process in those tests
it has been started in the constructor is a bit of a hack in the first
place, because the destructor is called on garbage collection and even
through CPython does this on the refcount reaching 0, this is not
documented and there's no guideline on when it should happen or if it
should happen at all.  So it could be argued that we should keep the del
wd statemenets to be able to easily replace all of them with a call to a
new method.  But most of them are not placed so that they're guaranteed
to happen on test success or failure.  It would probably be easier to do
this and other housekeeping in a base class and make the tests its
subclasses.  Also some of these tests don't really need to launch iwd
themselves, since IWD now tracks changes in the known network files I
think IWD only really needs to be killed between tests when main.conf
changes.
2019-04-22 18:20:01 -05:00
Andrew Zaborowski
f456ac49dc autotests: Use hostapd_map in place of wiphy_map
In the tests that only want to iterate over the hostapd interfaces,
simplify the pattern of walking through the whole wiphy_map tree by
instead using the hostapd_map variable which is already filtered to only
contain hostapd interfaces.
2019-04-22 18:16:14 -05:00
Andrew Zaborowski
576d8ad123 autotests: In testutil obtain interface list dynamically
For the interface connectivity tests obtain the lists of interfaces in
use directly from the IWD class, which has the current list from DBus
properties.
2019-04-22 18:16:11 -05:00
Andrew Zaborowski
0a196025f2 autotests: Remove unneded loops
The hostapd_map dictionary is indexed by the interface name so there's
no point iterating over it to find that entry whose name matches, we can
look up by the name directly.  Simplify code.
2019-04-22 16:34:36 -05:00
Andrew Zaborowski
e13c749d1e autotests: Update the wiphy_map and hostapd_map structs
In the test utilties updated the wiphy_map struct built from the
TEST_WIPHY_LIST variable to parse the new format and to use a new
structure where each wiphy is a namedtuple and each interface under it
also contains a reference to that wiphy.  The 'use' field is now
assigned to the wiphy instead of to the interface.
2019-04-22 16:34:17 -05:00
James Prestwood
00bbc62dfb auto-t: FILS autotest 2019-04-22 16:27:25 -05:00
James Prestwood
0ffc5af09c auto-t: add group renegotiate test to OWE 2019-04-19 13:52:31 -05:00
Tim Kourt
6fd68dae64 auto-t: Test quick scan 2019-04-16 18:20:29 -05:00
Tim Kourt
20ac57783b auto-t: AdHoc - address race condition
The AdHoc methods used to miss the change in properties
on AdHoc interface. To address the race condition, we
subscribe 'PropertiesChanged' signal first and then do
GetAll properties call. This way we are not missing
'PropertiesChanged' signal in between these calls.
2019-03-22 12:40:11 -05:00
James Prestwood
3641cfe30e auto-t: update SAE tests to use MFP/CCMP 2019-03-22 11:38:15 -05:00
James Prestwood
06ee531749 testutil: retry up to 3 times for connectivity 2019-03-19 09:42:53 -05:00
Tim Kourt
55b3a974c6 auto-t: Split EAP-WPS tests
Previously, the WPS tests have shared a single instance of iwd
among themselves. This approach didn’t allow to identify which
tests have passed and which failed. The new solution makes WPS
tests independent from each other by creating a new instance
of iwd for each one of them.
2019-03-19 09:41:39 -05:00
Tim Kourt
664cf5a368 auto-t: TTLS-MSCHAPv2 - remove iwd instance on failure 2019-03-15 17:04:11 -05:00
Tim Kourt
bda956f2b2 auto-t: SAE - remove iwd instance on failure 2019-03-15 17:04:07 -05:00
Tim Kourt
b4485f3e1b auto-t: Ad-Hoc - remove iwd instance on failure 2019-03-15 17:03:34 -05:00
James Prestwood
6de133aee7 auto-t: add timeout test for testOWE
This simulates an authenticate timeout. This test really just proves
that IWD doesn't crash in this case.
2019-03-01 17:15:22 -06:00
James Prestwood
981892470a auto-t: test for temporary blacklist
The simplest way to test this was to create a new AP, where
max_num_sta=1. This only allows a single STA to connect to this AP.
We connect a device to this AP, then try and connect with another.
This results in hostapd failing with DENIED_NO_MORE_STAS, which will
cause a temporary blacklist. We can then disconnect both devices,
and reconnect the device that previously got denied. If it connects
then we know the blacklist only persisted for that earlier connection.
2019-03-01 13:13:19 -06:00
James Prestwood
d47e31954b auto-t: add test for HT/VHT rates
This is a VERY simple test for HT/VHT. Since there are so many potential
options in the IE this really just tests that drops in RSSI will cause
IWD to choose a different BSS, even if that means choosing HT over VHT,
or even basic rates over HT/VHT.
2019-02-25 15:10:31 -06:00
James Prestwood
dc280b83d7 auto-t: add config file for testSAE
This conf file was forgotten after updating SAE to work with group 20
2019-02-07 11:10:14 -06:00
James Prestwood
2e5099a716 auto-t: add SAE test for group 20 2019-02-01 16:01:01 -06:00
James Prestwood
3ecf091196 auto-t: clean up SAE autotests
SAE has a clogging test which requires 4 radios to all simultaneously
connect. All the other tests are only using one of these radios, so
in these tests we explicitly disconnect these devices preventing them
from autoconnecting.
2019-02-01 15:57:23 -06:00
James Prestwood
ffa943f02f auto-t: Use group 20 in EAP-PWD autotest
Since the EAP-PWD fragmentation test uses group 19 there is test
coverage there for that group. This changes connection_test to use
group 20 instead of 19.
2019-01-31 12:42:28 -06:00