Commit Graph

726 Commits

Author SHA1 Message Date
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
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
James Prestwood 7ef165035e auto-t: iwd.py: add DPP utilities 2022-01-04 12:02:42 -06:00
James Prestwood 88f2309796 auto-t: wpas.py: add wait_for_result
Some wpa_cli utilities return some result which isn't possible to
get with wait_for_event unless you know what the result will be.
This adds wait_for_result which just returns the first event that
comes in.
2022-01-04 12:02:42 -06:00
James Prestwood 8178ea17fd auto-t: iwd.py: remove unused members 2022-01-04 12:02:42 -06:00
James Prestwood cbe454a46a auto-t: wpas.py: don't require strict match on wait_for_event
wait_for_event was checking the event string presence in the rx_data
array which meant the event string had to match perfectly to any
received events. This poses problems with events that include additional
information which the caller may not be able to know or does not care
about. For example:

DPP-RX src=02:00:00:00:02:00 freq=2437 type=11

Waiting for this event previously would require the caller know src, freq,
and type. If the caller only wants to wait for DPP-RX, it can now do that.
2022-01-04 12:02:42 -06:00
James Prestwood 4ee44ee0ea auto-t: iwd.py: remove StationDebug out of Device init
Since a Device class can represent multiple modes (AP, AdHoc, station)
move StationDebug out of the init and only create this class when it
is used (presumably only when the device is in station mode).

The StationDebug class is now created in a property method consistent
with 'station_if'. If Device is not in station mode it is automatically
switched if the test tries any StationDebug methods.

If the Device mode is changed from 'station' the StationDebug class
instance is destroyed.
2022-01-04 11:40:52 -06:00
Denis Kenzior c3a76e0f9d auto-t: Drop !used hostapd instances in testHotspot 2021-12-24 14:28:55 -06:00
Denis Kenzior 4e2005d53b auto-t: Disable Scan address randomization 2021-12-23 18:38:18 -06:00
James Prestwood 1825fd7ab7 auto-t: iwd.py: fix namespaces on StationDebug
Passing the full argument list to StationDebug was removed
because any existing properties (for Device) were being
included and causing incorrect behavior.

This neglected to handle namespaces which should also be
passed to StationDebug. Unfortunately the arguments are not
named when Device() is initialized so they cannot easily be
sorted. Instead just define Device() arguments to match the
DBus abstraction and pass only the path and namespace to
StationDebug
2021-12-22 19:10:43 -06:00
James Prestwood 76d54b28ea auto-t: add missing config files (testOWE-transition) 2021-12-22 18:10:42 -06:00
Andrew Zaborowski 7ecdee6eaa autotests: p2p: Make waiting for dhclient more reliable
Make sure we wipe the leases file both for server and client, so that
dhclient doesn't try to re-use leases from previous tests (should really
happen) and waste time waiting for a reply.  Extend the timeout from 1s
to 5s, sometimes it takes dhclient 1s just to start.  Disable verbose
mode if not needed to avoid dhclient stalling if the pipe is not being
read.
2021-11-30 15:49:08 -06:00
James Prestwood 61dfa943c6 auto-t: testPSK-roam deauthenticate IWD after roam
After roaming deauth IWD and check the connection state.
2021-11-23 12:19:18 -06:00
James Prestwood 44faa81a06 auto-t: iwd.py: use args[0] for station debug interface
Passing *args, **kwargs into StationDebug ended up initializing the
class with Station properties since devices can be initialized from
existing property dictionaries. Since the object path is all
StationDebug needs, pass args[0] instead.
2021-11-22 15:29:42 -06:00
Torsten Schmitz 22c77cc037 auto-t: replace ifconfig with ip commands
ifconfig has long been deprecated in favor of ip from iproute2.
It is usually no longer installed by default.
2021-11-11 14:29:54 -06:00
Denis Kenzior 05ae9689eb auto-t: use tmp radvd pid file
On some systems the default radvd pid file location is not accessible.
Specify it to be under /tmp instead.

While there, enable full radvd debug output so it is logged when
test-runner is invoked with the --log option.
2021-11-10 09:17:17 -06:00
Andrew Zaborowski d30fc97815 autotests: Test DHCPv6 client in testNetconfig 2021-11-09 14:32:50 -06:00
James Prestwood 017069bf68 auto-t: add OWE transition test with extra open network
A user reported a crash in situations where there was an OWE transition
pair, with an extra open network using the same SSID but not advertising
the OWE transition IE:

++++++++ backtrace ++++++++
 0x7f199cadf320 in /lib64/libc.so.6
 0x418c08 in network_has_open_pair() at /home/jprestwo/iwd/src/station.c:712
 0x4262ce in scan_finished() at /home/jprestwo/iwd/src/scan.c:1718
 0x4273cd in get_scan_done() at /home/jprestwo/iwd/src/scan.c:1733
 0x47cf7a in destroy_request() at /home/jprestwo/iwd/ell/genl.c:674
 0x479f1c in io_callback() at /home/jprestwo/iwd/ell/io.c:120
 0x47922d in l_main_iterate() at /home/jprestwo/iwd/ell/main.c:472 (discriminator 2)
 0x4792dc in l_main_run() at /home/jprestwo/iwd/ell/main.c:521
 0x47950c in l_main_run_with_signal() at /home/jprestwo/iwd/ell/main.c:649
 0x403e97 in main() at /home/jprestwo/iwd/src/main.c:532
 0x7f199cac9b75 in /lib64/libc.so.6
+++++++++++++++++++++++++++
2021-11-08 13:50:25 -06:00
James Prestwood 09f4bd9210 auto-t: add a DGAF Disable hotspot test 2021-11-04 14:30:55 -05:00
James Prestwood 72dbab789d auto-t: allow testAP to benefit from re-scanning
If a beacon is lost testAP will fail since it did not utilize any
rescanning logic. Now it can use this feature by passing full_scan.
This is required since IWD APs are not known to test-runner like
hostapd APs are.
2021-11-02 16:14:55 -05:00
James Prestwood 392eebc0a9 auto-t: iwd.py: fix re-scanning bug on get_ordered_networks
Certain scenarios coupled with lost beacons could result in OrderedNetwork
being initialized many times until the dbus library reached its maximum
signal registrations. This could happen where there are two networks,
IWD finds one in a scan but continues to scan for the other and the beacons
are lost. The way get_ordered_networks was written it returns early if any
networks are found. Since get_ordered_network (not plural) uses
get_ordered_networks() in a loop this caused OrderedNetwork's to be created
rapidly until python raises an exception.

To fix this, pass an optional list of networks being looked for to
get_ordered_networks. Only if all the networks in the list are found will
it return early, otherwise it will continue to scan.
2021-11-02 16:14:28 -05:00
James Prestwood e782911d33 auto-t: use tearDownClass in hidden network test
A failure in this test could leave stale network profiles, which
may cause future tests to fail.
2021-10-20 16:52:18 -05:00
James Prestwood 2dec023f63 auto-t: fix testConnectAutoconnect
There was no open ssid provisioning file, which was fine as the
first test should have created one. But to be safe, include one
explicitly and use the proper setUp/tearDown functions.
2021-10-20 16:51:58 -05:00
James Prestwood 6a4fffe6da auto-t: update blacklist test to use 'enable' on rules 2021-10-20 16:44:28 -05:00
James Prestwood bec0cabde4 auto-t: add missing ocv option and wait to testChannelSwitch
This should have been added to the original test
2021-10-19 15:29:26 -05:00
James Prestwood b16621b9ee auto-t: Add channel switch test 2021-10-19 13:33:54 -05:00
James Prestwood 74e7e341fd auto-t: hostapd.py: add chan_switch()
Forces hostapd to channel switch
2021-10-19 13:33:51 -05:00
James Prestwood 850d2c7ea8 auto-t: add OCV to testSAQuery-spoofing 2021-10-19 13:28:03 -05:00
James Prestwood 1c86327029 auto-t: SAQuery-spoofing replace sleep with condition wait
By sleeping for 4 seconds IWD had plenty of time to fully disconnect
and reconnect in time to pass the final "connected" check. Instead
use wait_for_object_condition to wait for disconnected and expect
this to fail. This will let the test fail if IWD disconnects.
2021-10-19 13:27:59 -05:00
James Prestwood adceab280b auto-t: Add test for extended key IDs 2021-10-08 13:28:04 -05:00
James Prestwood 48e7c0bd50 auto-t: update rekey() use to not wait for event
The hostapd event wait was moved into rekey() itself.
2021-10-08 08:49:55 -05:00
James Prestwood 119de8ec55 auto-t: hostapd.py: add resend_m3
This forces hostapd to resend message 3 of the 4-way handshake
2021-10-08 08:49:29 -05:00
James Prestwood f1b106f6eb auto-t: hostapd.py: separate GTK and PTK rekeys
REKEY_GTK kicks off the GTK only handshake where REKEY_PTK does
both (via the 4-way). The way this utility was written was causing
hostapd some major issues since both REKEY_GTK and REKEY_PTK was
used.

Instead if address is set only do REKEY_PTK. This will also rekey
the GTK via the 4-way handshake.

If no address is set do REKEY_GTK which will only rekey the GTK.
2021-10-08 08:49:07 -05:00
James Prestwood 2e882946f8 auto-t: iwd.py: make wait() a static method
This allows it to be used without initializing an IWD class:

IWD.wait(1)
2021-10-08 08:48:56 -05:00
James Prestwood 83a30fe5ae auto-t: rekey in FT/FILS tests 2021-09-28 17:40:29 -05:00
James Prestwood 7c1e3ab76a auto-t: hostapd.py: add rekey() utility
Forces GTK/PTK rekeys
2021-09-28 17:40:22 -05:00
James Prestwood 908dff807e auto-t: fix testSAE to continue if a test fails 2021-09-28 17:40:11 -05:00
James Prestwood a71f24109f auto-t: block auth frames for FT-over-DS test
The FT-over-DS test was allowed to fail as it stood. If FT-over-DS
failed it would just do a normal over-Air transition which satisfied
all the checks. To prevent this Authenticate frames are blocked after
the initial connection so if FT-over-DS fails there is no other way
to roam.
2021-09-28 17:39:57 -05:00
James Prestwood 26befb5850 auto-t: add OCV to FILS test 2021-09-28 17:39:51 -05:00
James Prestwood 8ce7dc3dbe auto-t: set ocv on PSK FT test 2021-09-28 11:01:03 -05:00
James Prestwood 10f026748e auto-t: add oper class/band tests for OWE transition 2021-09-22 14:41:36 -05:00
James Prestwood 8a43473504 auto-t: add testOWE-transition
This adds several tests for OWE transition networks. Hostapd
does have special options for these networks but currently their
implementation is incorrect as the IE is not ever added to the
OWE BSS. Besides that using vendor_elements provides a much easier
way to create invalid IEs to test.
2021-09-17 18:05:10 -05:00
James Prestwood e11ad83222 auto-t: hostapd.py: add disable() 2021-09-15 16:42:21 -05:00
James Prestwood 7fda423e12 auto-t: remove ';' in testSAE autoconnect_test.py 2021-09-09 16:57:38 -05:00
James Prestwood 4c6f0ff75a auto-t: add SAE test for no supported groups 2021-09-09 16:57:38 -05:00
James Prestwood a0a05a88b9 auto-t: add SAE test for a non-ACKed confirm 2021-09-09 16:57:38 -05:00
James Prestwood 1574909535 auto-t: change testSAE timeout_test to use match/offset
This makes things more clear on what frames are being blocked
since it passes over header information to get to the actual
SAE payload.
2021-09-09 16:57:38 -05:00
James Prestwood 9049ed2f25 auto-t: hwsim.py: add match/match_offset properties 2021-09-09 16:57:38 -05:00
James Prestwood a50af3b751 auto-t: remove OWE renegotiate test
Since IWD tries group 20 first all other OWE tests are actually
triggering group negotiation where this test is not. Since this
code is exercised this test can be removed completely, as well
as the additional radio/network.
2021-09-08 20:05:07 -05:00
James Prestwood eeb42c56f0 auto-t: add sae test for non-acked commit
This test simulates the scenario where IWDs commit is not acked which
exposes a hostapd bug that ultimately fails the connection. This behavior
can be seen by reverting the commit which works around this issue:

"sae: don't send commit in confirmed state"

With the above patch applied this test should pass.

Note: The existing timeout test was reused as it was not of much use
anyways. All it did was block auth/assoc frames and expect a failure
which didn't exercise any SAE logic anyways.
2021-09-08 16:48:07 -05:00
James Prestwood 5b226a8151 auto-t: hwsim.py: add drop_ack property 2021-09-07 20:02:38 -05:00
James Prestwood 06ee649a91 auto-t: hwsim.py: add match_times property 2021-09-07 19:02:47 -05:00
James Prestwood 7123f47f84 test-runner: remove special case for "root" namespace
This was a placeholder at one point but modules grew to depend on it
being a string. Fix these dependencies and set the root namespace
name to None so there is no more special case needed to handle both
a named namespace and the original 'root' namespace.
2021-09-07 12:45:26 -05:00
Andrew Zaborowski 59d4e86bc5 autotests: Don't use the netifaces module
Get rid of a dependency on a package that needed to be manually
installed.
2021-09-03 14:45:18 -05:00
Andrew Zaborowski ba152c567c autotests: Extend a testP2P timeout
With various versions of wpa_supplicant tested, after an IWD GO tears
the group down, the wpa_supplicant P2P client will not immediately
signal that the group has disappeared but will at least wait for the
lost beacon signal, wait some more and try reconnecting and all that
takes it 10s or a little longer.  Possibly sending Deauthenticate frames
to clients first would improve this.
2021-09-03 14:45:18 -05:00
James Prestwood cb7e9b5885 auto-t: hostapd.py: properly implement singleton (per-config)
This shouldn't change any functionality but it is much more convenient
in the cleanup path i.e. nothing special needs to be done.
2021-08-27 20:07:26 -05:00
James Prestwood 1a01486170 auto-t: hwsim.py: turn Hwsim into singleton (per-namespace)
This prevents reallocation of new Hwsim classes on each call if one
already exists. This is a bit more efficient on memory.
2021-08-27 20:07:26 -05:00
James Prestwood 4657bd55f5 auto-t: Update Process changes in a few autotests 2021-08-26 08:52:48 -05:00
James Prestwood d2a3809ca8 auto-t: testutil.py: update Process changes 2021-08-26 08:52:48 -05:00
James Prestwood 665f63ff97 auto-t: hostapd.py: update Process changes 2021-08-26 08:52:48 -05:00
James Prestwood a3db60b7b1 auto-t: add force SAE group 19 autotest
The vendor element was taken directly from observed logs of an AP
behaving this way. This causes IWD to force group 19.
2021-08-25 13:05:39 -05:00
James Prestwood 70b6451dc2 auto-t: hostapd.py: remove ungraceful_restart
This is no longer needed and greatly simplifies the class
2021-08-25 08:51:45 -05:00
James Prestwood 5776ce87d7 auto-t: testSAQuery remove ungraceful restart
Instead the same effect can be seen by just ifdown/ifup the interface.
2021-08-25 08:51:45 -05:00
James Prestwood f6683bab75 auto-t: hwsim.py: convert addresses to 42:* format
mac80211_hwsim has a funny quirk with multiple addresses in
radios. Some operations require address index zero, some index
one. And these addresses (possibly a result of how test-runner
initializes radios) sometimes get mixed up. For example scan
results may show a BSS address as 02:00:00:00:00:00, while the
next test run shows 42:00:00:00:00:00.

Ultimately, sending out frames requires the first nibble of the
address to be 0x4 so to handle both variants of addresses described
above hwsim.py was updated to always bitwise OR the first byte
with 0x40.
2021-08-25 08:51:45 -05:00
Andrew Zaborowski 3eff81864c autotests: Test GO-side IP Allocation in testP2P
Check if our wpa_supplicant P2P Client has received the allocated
Clieant IP/netmask/GO IP values we sent in the 4-Way Handshake.
2021-08-25 08:02:17 -05:00
James Prestwood 47ebd81393 auto-t: remove ANQP delay test
The idea of this test is valid but it is extremely timing dependent
which simply isn't testable on all machines. Removing this test
at least until this can be tested reliably.
2021-08-18 19:53:22 -05:00
James Prestwood 07da17ec5f auto-t: update tests to enable hwsim rules 2021-08-18 19:53:19 -05:00
James Prestwood db9f001865 auto-t: combine testBSSBlacklist tests
All 4 tests were combined to reuse hwsim rule code, and improve
cleanup between running tests.
2021-08-18 19:53:16 -05:00
James Prestwood b252b65ee0 auto-t: hwsim.py: handle Prefix/Enabled in __str__ 2021-08-18 19:53:12 -05:00
James Prestwood f328d62f55 auto-t: hwsim.py: add Enabled property 2021-08-18 19:53:07 -05:00
James Prestwood 07fc7905ca auto-t: fix error handling in testHotspot
testHotspot suffered from improper cleanup and if a single test failed
all subsequent tests would fail due to IWD still running since IWD()
was never cleaned up.

In addition the PSK agent and hwsim rules are now set onto the cls
object and removed in tearDownClass()
2021-08-18 16:57:34 -05:00
James Prestwood 8e5a68f407 hwsim: add Rule.remove_all()
There are really no cases where a test wants to remove a single
rule. Most loop through and remove rules individually so this
is being added as a convenience.
2021-08-18 16:57:29 -05:00
James Prestwood 1e0553250b auto-t: scan as many times as needed to find networks
Certain autotests coupled with slower test machines can result in lost
beacons and "Network not found" errors. In attempt to help with this
the test can just rescan (30 seconds max) until the network is found.
2021-08-18 16:55:47 -05:00
James Prestwood 3616b37789 auto-t: separate PEAP + SIM test
Remove EAP-SIM from the generic PEAP test case since skipping
(if ofono is not on system) would skip the entire test rather
than just the EAP-SIM portion.
2021-08-17 17:02:32 -05:00
James Prestwood f0a890da8a auto-t: remove duplicate EAP tests
This removes any EAP test which was combined into testEAP as well
as modifies any special EAP test to use the now global eap-users
file.
2021-08-17 11:44:36 -05:00
James Prestwood c21dc9ed6f auto-t: Add universal testEAP test
This tests all EAP methods in their standard configuration. Any
corner cases requiring changes to main.conf or other hostapd
options are not included and will be left as stand alone tests.

This was done because nearly all EAP tests are identical except
the IWD provisioning file and hostapd EAP users fine. The IWD
provisioning file can be swapped out as needed for each individual
test without actually restarting IWD. And the EAP users file can
simply be written to include every possible EAP method that
is supported.
2021-08-17 11:44:36 -05:00
James Prestwood 42fe6c5a15 auto-t: hostapd.py: remove _hostapd_restarted concept
The destructor was trying to do more than the scope of a destructor
by trying to handle this single case of hostapd being restarted.

Instead we can simply pass a keyword argument 'reinit' to the
constructor to tell it to reinitialize everything. And as for killing
hostapd this can be done in ungraceful_restart itself rather than
trying to handle it in the destructor.
2021-08-16 11:33:26 -05:00
James Prestwood cb4f1d2a99 auto-t: turn off scan address randomization in testHotspot
This (hopefully) will make this test pass better on slower machines.
In addition the mechanism of copying over separate main.conf files
was changed (rather than echo'ing the option into /tmp/main.conf)
2021-08-13 20:39:13 -05:00
James Prestwood a2c777ba84 auto-t: iwd.py: clean up StationDebug
Initialize this once and reference that for each method/property
2021-08-13 20:39:13 -05:00
James Prestwood 973ee269d3 auto-t: return existing instance from HostapdCLI
This addresses the TODO where HostapdCLI was creating separate
objects each time HostapdCLI was called. This was worked around
by manually setting the important members but instead the class
can be re-worked to act as somewhat of a singleton, per-config
at least.

If there is no HostapdCLI instance for a given config one is
created and initialized. Subsequent HostapdCLI calls (for the
same config) will be returned the same object rather than a
new one.
2021-08-13 20:39:13 -05:00
James Prestwood f721f1de1e auto-t: skip testEAP-PEAP-SIM if ofonod is not running 2021-08-13 16:44:14 -05:00
James Prestwood 365f955318 auto-t: ead.py: remove wait_for_object_condition
Instead the class method IWD._wait_for_object_condition can
be used.
2021-08-13 15:18:40 -05:00
James Prestwood 382b73c11a auto-t: cleanup dhcpd.leases[~] in testNetconfig 2021-08-13 15:18:40 -05:00
James Prestwood 5c14742a87 auto-t: use prefix on hotspot anqp test
The hotspot ANQP delay test was setting a global delay on all
packets which had some unintended consequences. At the time this
was the only way of simulating the test scenario but now hwsim
supports prefix matching so only the ANQP request/response will
be delayed.
2021-08-13 15:18:40 -05:00
James Prestwood c2caa325ba auto-t: fix testAgent use of Process
This test was accessing the subprocess object and calling terminate
which ends up causing issues with test-runners own process cleanup.
Instead kill() should be used.
2021-08-13 15:18:40 -05:00
James Prestwood 82d7c81bd3 auto-t: remove unneeded BSSs in testEAP-MSCHAPv2
Hostapd sometimes has trouble with specifying additional BSSs in
a single config file, at least in the test-runner environment.
Since all the BSS's specified were identical instead the test was
reworked to only have a single BSS and each subtest can connect
in its own unique way.
2021-08-13 14:54:53 -05:00
James Prestwood 3adb91fc9e auto-t: iwd.py: allow renaming in copy_to_storage
By providing a 'name' keyword argument the file copied will be
renamed to that.
2021-08-13 14:54:53 -05:00
James Prestwood 78f5a5dde4 auto-t: speed up testRoamRetry
This test took quite a while to execute (~2 minutes on my machine)
because there was simply no other way to test this scenario but
waiting. Now the no-roam-candidates condition can be waited for
rather than just sleeping for 20 seconds. Additionally the default
RoamRetryInterval was being used which is 60 seconds. Instead
main.conf can set this to 5 seconds and really cut down on the time
to wait.

Part of a comment was also removed due to being incorrect. Even
with neighbor reports IWD still must scan, its just that the
scan is more limited and, in theory, faster.
2021-08-13 14:45:14 -05:00
James Prestwood 36777d1e68 auto-t: iwd.py: add StationDebug.Event support
Adds a new wait_for_event API which waits for a StationDebug.Event.
2021-08-13 14:45:12 -05:00
James Prestwood b705a579ad auto-t: ead.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood 5ebbe07fa6 auto-t: hostapd.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood 732871b601 auto-t: iwd.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood 80ee406e3e auto-t: ofono.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood 541dca499a auto-t: hostapd.py: remove get_freq()/get_config_value() 2021-08-13 10:46:21 -05:00
James Prestwood 876ac5f569 auto-t: use .frequency property in SAQuery-spoofing test 2021-08-13 10:46:18 -05:00
James Prestwood 7a74a825a4 auto-t: iwd.py: scan only on needed frequencies
get_ordered_network() now scans automatically and has been updated
to use the StationDebug.Scan() API rather than doing a full
dbus scan (unless full_scan = True). The frequencies to be scanned
are picked automatically based on the current hostapd status
(hidden behind ctx.hostapd.get_frequency()).
2021-08-13 10:46:16 -05:00
James Prestwood 57933425ca test-runner: start HostapdCLI from test-runner
This gives the benefit of test-runner itself having access to
the CLI, e.g. for getting status information.
2021-08-13 10:46:13 -05:00
James Prestwood c7466cd56a auto-t: add python API for StationDebug.Scan 2021-08-13 10:46:10 -05:00