Commit Graph

622 Commits

Author SHA1 Message Date
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
James Prestwood 73e428cf3f auto-t: add test for encrypted profiles 2022-02-15 17:44:25 -06:00
James Prestwood 9966533e6a auto-t: add test for fixed scanning crash
This simulates the conditions that trigger a free-after-use which was
fixed with:

2c355db7 ("scan: remove periodic scans from queue on abort")

This behavior can be reproduced reliably using this test with the above
patch reverted.
2022-02-14 16:02:23 -06:00
James Prestwood 94cc957c5e auto-t: iwd.py: add wait argument to scan()
Lets the test continue without waiting for the method return
2022-02-14 16:02:23 -06:00
James Prestwood b44e32fde9 auto-t: only wait for wpa_s to get the DPP configuration
As far as wpa_supplicant goes we don't need to test if it can actually
connect to the network, just that it receives the DPP configuration.
2022-02-03 13:54:54 -06:00
James Prestwood c3b18c44e0 auto-t: roam test to simulate reported crash
During investigation another separate crash was found. The original is
caused by a disconnect event coming in after a neighbor report scan
was completed (roam failed) during the full roam scan.

The second crash is caused by a disconnect coming in during a full
roam scan when no neighbor report scan was ever issued.
2022-01-19 16:37:51 -06:00
James Prestwood 301a55c8c3 auto-t: hostapd.py: add remove_neighbor() 2022-01-19 16:37:51 -06:00
James Prestwood b7b0b4eb02 auto-t: improve testDPP reliablity
First disconnect wpa_supplicant to make sure it wont miss frames if
it decides to connect. Also alter the order of things for the
configurator test so autoconnect doesn't start until after hostapd
is up (avoids additional scanning and delays)
2022-01-12 12:46:27 -06:00
James Prestwood c5fb68bb2e auto-t: wpas.py: add disconnect() 2022-01-12 12:46:24 -06:00
James Prestwood 627e54eb20 auto-t: wpas.py: increase timeout for auth protocol
Sometimes wpa_supplicant takes some time to respond to the initial
presence anouncements.
2022-01-12 12:46:21 -06:00
James Prestwood 7a3d4dabb1 auto-t: add a few more DPP tests
This adds 3 more tests:
 - Channel switch during authentication
 - Scan after configuring
 - Retransmit auth frames
2022-01-12 10:05:16 -06:00
James Prestwood 692d137a21 auto-t: wpas.py: add configurator_remove
wpa_supplicant has a limited number of configurator IDs, and its
good practice to remove them after we are done.
2022-01-12 10:05:13 -06:00
James Prestwood 0b36f497c5 auto-t: wpas.py: add freq argument to configurator_start
This forces the configurator to request a new channel during the
authentication protocol.
2022-01-12 10:05:11 -06:00
James Prestwood c78573b468 auto-t: wpas.py: read DPP event until expected result
Controlling wpa_supplicant/hostapd from a text based interface is
problematic in that there is no way of knowing if an event corresponds
to a request. In certain cases if wpa_s/hostapd is sending out multiple
events and we make a request, a random event may come back after the
request, but before the actual result.

To fix this, at least for this specific case, we can continue to read
from the socket until the result is numeric.
2022-01-12 09:27:45 -06:00
James Prestwood f8459427d3 auto-t: update wpas.py to use non_block_wait
This should be used as a replacement for the common GLib
wait loop (internally this is all it does).
2022-01-12 09:27:39 -06:00
James Prestwood 994c18c44e auto-t: iwd.py: use spaces instead of tabs 2022-01-04 12:34:22 -06:00
James Prestwood 7d9b198df6 auto-t: add DPP autotests 2022-01-04 12:02:42 -06:00
James Prestwood 0fd7cdcb78 auto-t: wpas.py: add DPP utilities 2022-01-04 12:02:42 -06:00