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

639 Commits

Author SHA1 Message Date
James Prestwood
f4279ebf53 auto-t: fix hardcoded 'wlan1' in testNetconfig
This works, if testNetconfig is the only test. Otherwise it will always
fail since the interface naming increments for each test.
2022-06-22 18:37:15 -05:00
James Prestwood
72fac7f1b8 auto-t: rename testHiddenNetwork's test class
This was copy pasted from the autoconnect test, and depending on
how the python module cache is ordered can incorrectly use the
wrong test class. This should nothappen because we insert
the paths to the head of the list but for consistency the class
should be named something that reflects what the test is doing.
2022-06-22 18:37:15 -05:00
Andrew Zaborowski
2c0bb06d1a auto-t: Verify DNS entries added from DHCP/static
Add a fake resolvconf executable to verify that the right nameserver
addresses were actually committed by iwd.  Again use unique nameserver
addresses to reduce the possibility that the test succeeds by pure luck.
2022-06-22 15:57:36 -05:00
Andrew Zaborowski
c4fe900a71 auto-t: In testNetconfig verify routes created
Check that the right set of routes is being added for IPv4 and IPv6.
Chane gateway addresses to differ from the AP or dhcpd addresses.
2022-06-22 15:57:22 -05:00
Andrew Zaborowski
c65b2ec317 auto-t: In testNetconfig add static IPv6, add comments
In static_test.py add IPv6.  Add comments on what we're actually testing
since it wasn't very clear.  After the expected ACD conflict detection,
succeed if either the lost address was removed or the client disconnected
from the AP since this seems like a correct action for netconfig to
implement.
2022-06-22 15:57:09 -05:00
Andrew Zaborowski
a46707a595 auto-t: Ensure storage_dir exists, clean up
In iwd.py make sure all the static methods that touch IWD storage take the
storage_dir parameter instead of hardcoding IWD_STORAGE_DIR, and make
sure that parameter is actually used.

Create the directory if it doesn't exist before copying files into it.
This fixes a problem in testNetconfig where

`IWD.copy_to_storage('ssidTKIP.psk', '/tmp/storage')`

would result in /tmp/storage being created as a file, rather than a
directory containing a file, and resulting in IWD failing to start with:

`Failed to create /tmp/storage`

runner.py creates /tmp/iwd but that doesn't account for IWD sessions
with a custom storage dir path.
2022-06-22 15:56:57 -05:00
Andrew Zaborowski
57888632a3 auto-t: Validate netmasks in testNetconfig, add utility
Extend test_ip_address_match to support IPv6 and to test the
netmask/prefix length while it reads the local address since those are
retrieved using the same API.

Modify testNetconfig to validate the prefix lengths, change the prefix
lengths to be less common values (not 24 bits for IPv4 or 64 for IPv6),
minor cleanup.
2022-06-22 15:56:35 -05:00
Andrew Zaborowski
8237264848 autotests: Drop unused file+directory 2022-06-17 14:13:33 -05:00
Andrew Zaborowski
cb6289b622 auto-t: Work around wpa_s config issue in testP2P
Since commit 922fa099721903b106a7bc1ccd1ffe8c4a7bce69 in hostap, our
setting of config_methods on P2P-client interface was ignored.  Work
around that commit, in addition to the previous workaround we have in
this test, to again ensure the correct config_methods value is used.
2022-06-06 10:39:00 -05:00
James Prestwood
0545dbcf24 auto-t: remove ifconfig call from testScan
ifconfig isn't available by default in several linux distros
so instead use 'ip' which seems to be much more widespread.
2022-06-03 11:59:07 -05:00
James Prestwood
df46776046 auto-t: allow skipping tests is wpa_supplicant is not found
Similarly to ofono/phonesim allow tests to be skipped if wpa_supplicant
is not found on the system.

This required some changes to DPP/P2P where Wpas() should be called first
since this can now throw a SkipTest exception.

The Wpas class was also made to allow __del__ to be called without
throwing additional exceptions in case wpa_supplicant was not found.
2022-06-02 16:47:02 -05:00
James Prestwood
1296e4eacb auto-t: allow wildcard phase1 for EAP tests
This allows the EAP tests to pass, but the fix really needs to be in
hostapd itself. Hostapd currently tries to lookup the EAP session
immediately after receiving EAPOL_REAUTH. This uses the identity
it has stored which, in the case of PEAP/TTLS, will always be a phase2
identity. During this initial lookup hostapd hard codes the identity
to be phase1 which is not true for PEAP/TTLS, and the lookup fails.
2022-06-01 11:02:01 -05:00
James Prestwood
e2aca6e917 auto-t: correctly import Mapping from collections
The current way this was being done was to import collections and
use collections.Mapping. This has been deprecated since python 3.3
but has worked up until python 3.10. After python 3.10 this will
no longer work, and Mapping must be imported from collections.abc.
2022-06-01 11:01:50 -05:00
James Prestwood
7290989e15 auto-t: add EAP reauth to testEAP 2022-05-26 11:24:56 -05:00
James Prestwood
a18c6e10a7 auto-t: fix eapol_reauth utility
This was passing IFNAME= along with EAPOL_REAUTH which does not work
in the context of a hostapd socket where the iface is already implied.
This fixes that issue as well as resets the events array and actually
waits for the required events afterwards.
2022-05-26 11:24:52 -05:00
James Prestwood
0e77e33a4d auto-t: fix testRSSIAgent after signal agent changes
The signal agent notifications were changed which breaks this test.
Specifically commit ce227e7b94 sends a notification when connected
which breaks the 'agent.calls' check. Since this check is done both
after connecting and once already connected the initial value may
be 1 or 0. Because of this that check was removed entirely.
2022-05-25 15:00:06 -05:00
James Prestwood
e000eff492 auto-t: use copy_to_storage in address randomization test
This test was just piping the PSK files into /tmp/iwd/ssidCCMP.psk
which is a bit fragile if the storage dir was ever to change. Instead
use copy_to_storage and the 'name' keyword to copy the file.
2022-05-25 15:00:06 -05:00
Denis Kenzior
503ce2e488 auto-t: Use NameResolvingService=none
Since this test isn't actually running name resolving service of any
kind, use NameResolvingService=none to quiet down the logs.
2022-05-20 10:15:17 -05:00
Denis Kenzior
f3c633e222 auto-t: Add EAPoL spoofing test
Make sure that unencrypted EAPoL packets received after the initial
handshake is complete do not break the connection.
2022-05-11 17:23:54 -05:00
Denis Kenzior
e44ccf3daa auto-t: Rework spoofing code
Use scapy library which allows one to easily construct and fudge various
network packets.  This makes constructing spoofed packets much easier
and more readable compared to hex-encoded, hand-crafted frames.
2022-05-11 17:20:30 -05:00
Denis Kenzior
2019823443 auto-t: Fix TA/BSSID addresses of spoofed disassoc
The TA/BSSID addresses of spoofed disassociate frames were set
incorrectly.  They should be using the 02:00:00:XX:XX:XX address, but
instead were being converted over to 42:00:00:XX:XX:XX address
2022-05-11 14:05:51 -05:00
James Prestwood
5caeb82d61 auto-t: disable update_config for testDPP
update_config=1 lets wpa_supplicant write config changes
to the config file. In the real world this is what you want
so your DPP credentials are persistant. But for testing this
is not correct since multiple tests use the same config file
and expect it to be pristine.

Occationally wpa_supplicant was connecting to the AP without
running DPP because the config already had the network
credentials.
2022-04-15 12:17:29 -05:00
James Prestwood
1a903001f9 auto-t: cleanup the few uses of is_verbose
These were used outside of run-tests in a couple places. Replace
these with Process.is_verbose()
2022-04-06 14:47:32 -05:00
James Prestwood
197368dcfc auto-t: hwsim.py: set NoVirtualInterface by default
There is really no reason to have hwsim create interfaces automatically
for test-runner. test-runner already does this for wpa_supplicant and
hostapd, and IWD can create the interface itself.
2022-04-05 13:33:35 -05:00
James Prestwood
57ae02ab71 auto-t: delay rekeys in extended key ID test
The test was rekeying in a loop which ends up confusing hostapd
depending on the timing of when it gets the REKEY command and any
responses from IWD. UML seemed to handle this fine but not QEMU.

Instead delay the rekey a bit to allow it to fully complete before
sending another.
2022-04-04 11:14:26 -05:00
James Prestwood
5c7f34d66b auto-t: iwd.py: use IO watch for station debug events
Similarly to hostapd.wait_for_event, IWD's variant needed to act on
an IO watch because events were being received prior to even calling
wait_for_event.
2022-03-31 18:13:02 -05:00
James Prestwood
31b5275c1f auto-t: hostapd.py: use IO watch for hostapd events
With how fast UML is hostapd events were being sent out prior to
ever calling wait_for_event. Instead set an IO watch on the control
socket and cache all events as they come. Then, when wait_for_event
is called, it can reference this list. If the event is found any
older events are purged from the list.

The AP-ENABLED event needed a special case because hostapd gets
started before the IO watch can be registered. To fix this an
enabled property was added which queries the state directly. This
is checked first, and if not enabled wait_for_event continues normally.
2022-03-31 18:12:59 -05:00
James Prestwood
dbd6ddfc95 auto-t: cleanup testRRM
This removes prints which were never supposed to make it upstream as
well as changes sleep() to wd.wait() as well as increase the wait
period to fix issues with how fast UML runs the tests.
2022-03-31 18:12:56 -05:00
James Prestwood
95ad47bd98 auto-t: wait for roam events in proper order
These were out of order and would sometimes fail the check.
2022-03-31 18:12:53 -05:00
James Prestwood
1e56898606 auto-t: fix testBSSBlacklist typo
The property is 'enabled' not 'enable'
2022-03-31 18:12:49 -05:00
James Prestwood
040b8c2d5f auto-t: use full_scan=True on testBSSBlacklist
This test was missed during the test-wide change.
2022-03-30 16:16:49 -05:00
James Prestwood
fa366c79e4 auto-t: test-wide replacement of assertTrue(list_sta())
Any test using assertTrue(hostapd.list_sta()) improperly has been
replaced with wait_for_event(). There were a few places where this
was actually ok (i.e. IWD is already connected) but most needed to
be changed since the check was just after IWD connected and hostapd's
list_sta() API may not return a fully updated list.
2022-03-30 15:26:44 -05:00
James Prestwood
416ad05ce7 auto-t: fix up a few issues in testNetconfig
- Setting the IP address was resulting in an error:

   Error: any valid prefix is expected rather than "wln58".

   This is fixed by reordering the arguments with the IP address first

 - Remove the sleep, and use non_block_wait to wait for the IPv6 address
   to be set.
2022-03-30 15:26:42 -05:00
James Prestwood
b1bc8fb7fb auto-t: testSAE-roam: wait for ip link down
Before setting the address, wait for the interface to go down. This
fixes somewhat rare cases where setting the address returns -EBUSY
and ultimately breaks the neighbor reports.
2022-03-30 15:26:39 -05:00
James Prestwood
1fca13f07a auto-t: testutil: wait for operstate
Depending on timing the operstate may not be set even when IWD shows
as connected. Instead wait for the operstate to become set.
2022-03-30 15:26:36 -05:00
James Prestwood
a773aa6a07 auto-t: remove direct scan() call when possible
All tests which could avoid calling scan() directly have been
changed to use the 'full_scan' argument to get_ordered_network.

This was done because of unreliable scanning behavior on slower
systems, like VMs. If we get unlucky with the scheduler some beacons
are not received in time and in turn scan results are missing.
Using full_scan=True works around this issue by repeatedly scanning
until the SSID is found.
2022-03-30 15:25:55 -05:00
James Prestwood
cc9f8d7489 auto-t: don't wait for wpa_supplicant to connect
When configuring wpa_supplicant all we care about is that it
received the configuration object. wpa_supplicant takes quite a bit
of time to connect in some cases so waiting for that is unneeded.

This also increases the DPP timeout which may be required on slower
systems or if the timing is particularly unlucky when receiving
frames.
2022-03-28 12:38:15 -05:00
James Prestwood
f717480c18 auto-t: do a full scan when getting network
This ensures the network will be scanned for again if not found.
2022-03-28 12:38:15 -05:00
James Prestwood
12c77ef647 auto-t: use wait_for_event in testPSK-roam
Depending on timing hostapd may not show a station with list_sta()
Instead use wait_for_event
2022-03-28 12:38:15 -05:00
James Prestwood
51d4e14440 auto-t: do full scan for testSAE
This will ensure the IWD scans until the network is found.
2022-03-28 12:38:15 -05:00
James Prestwood
c852892426 auto-t: use wait_for_event in testSAE-roam
Depending on timing hostapd may not show a station with list_sta().
Instead use wait_for_event.
2022-03-28 12:38:15 -05:00
James Prestwood
2ee4e95193 auto-t: use wait_for_event in testBSSBlacklist
Depending on timing hostapd may not show a station with list_sta().
Instead use wait_for_event.
2022-03-28 12:38:15 -05:00
James Prestwood
f1a7e23eea auto-t: fixup testRoamRetry for better timing reliability
Change a few critical checks that were failing sometimes:
 - A few asserts were changed to wait_for_object_condition
 - A 15 second timeout was removed (default used instead)
 - Do a full scan at beginning of each test to clear any
   cached BSS's. The second test run was getting stale results
   and the RSSI values were not expected.
2022-03-28 12:38:15 -05:00
James Prestwood
6e608b14f5 auto-t: iwd.py: fix full_scan argument
This was not being properly honored when existing networks were
already populated. This poses an issue for any test which uses
full_scan after setting radio values such as signal strength.
2022-03-28 12:38:15 -05:00
James Prestwood
327f719f91 auto-t: remove waitstatus_to_exitcode for better compatibility
This was added in Python 3.9 which isn't always supported. Instead use
the subprocess module which automatically checks the command output.
2022-03-28 12:38:15 -05:00
James Prestwood
521960c7d6 auto-t: add test for IWD as configurator + initiator 2022-02-22 16:25:57 -06:00
James Prestwood
cfb0987eb5 auto-t: wpas.py: handle enrollee as responder
This adds support for wpa_supplicant to generate its own URI and
start presence announcements (DPP_CHIRP).
2022-02-22 16:25:55 -06:00
James Prestwood
69c1a1ba7c auto-t: wpas.py: allow arbitrary events to be handled
If an event is in response to some command which is returning an
unexpected value (unexpected with respect to wpas.py) handle_eow
would raise an exception.

Specifically with DPP this was being hit when the URI was being
returned.
2022-02-22 16:25:53 -06:00
James Prestwood
50a546705e auto-t: iwd.py: allow passing uri to start_configurator
If a URI is passed this will envoke ConfigureEnrollee()
2022-02-22 16:25:50 -06:00
James Prestwood
15c0920777 auto-t: hwsim.py: support async radio creation
Adds a new wait argument which, if false, will call the DBus method
and return immediately. This allows the caller to create multiple
radios very quickly, simulating (as close as we can) a wifi card
with dual phy's which appear in the kernel simultaneously.

The name argument was also changed to be mandatory, which is now
required by hwsim.
2022-02-16 16:27:42 -06:00