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

5359 Commits

Author SHA1 Message Date
James Prestwood
66b4723216 test-runner: fix duplicate process output
Process output was being duplicated when -v was used. This was
due to both stderr and stdout being appended to the write_fd list
as well as stderr being set to stdout in the Popen call.

To fix this only stdout should be appended to the write_fd list,
but then there comes a problem with closing the streams. stdout
cannot be closed, so instead it is special cased. A new
verbose boolean was added to Process which, if True, will
cause any output to be written to stdout explicitly.
2021-03-02 10:37:22 -06:00
Andrew Zaborowski
e714e72e05 utils: Add util_netmask_from_prefix 2021-02-26 11:01:03 -06:00
Andrew Zaborowski
b689100c1c ap: Print error messages in dhcp_load_settings 2021-02-26 11:00:25 -06:00
Andrew Zaborowski
cdb2c2b3e3 ap: Fix an inet_aton error check
inet_aton returns 0 on error, not a negative number.
2021-02-26 10:59:35 -06:00
Andrew Zaborowski
fd934aa39e ap: Don't use L_AUTO_FREE_VAR with l_settings
L_AUTO_FREE_VAR only causes l_free to be called on the variable that is
freed and may leak the rest of the l_settings object's memory.
2021-02-26 10:59:22 -06:00
James Prestwood
c660feadf1 test-runner: stop/warn on processes running after test
This gives the dev some inidication their test did not clean up
correctly and running processes remain.
2021-02-26 10:09:56 -06:00
James Prestwood
670f063a30 test-runner: warn on files left after test completes 2021-02-26 10:09:56 -06:00
James Prestwood
2e55e00662 test-runner: start haveged in foreground
haveged was forking itself which then prevented test-runner from
cleaning it up.
2021-02-26 10:09:56 -06:00
James Prestwood
73b89555fa test-runner: fix Namespace class ref problems
The Namespace class was never being removed when tests finished.
This is fixed by unreffing the hwsim internal _radio object which
both cleans up the radio and allows the Namespace to be removed.
2021-02-26 10:09:56 -06:00
James Prestwood
d8abc88e4c test-runner: move process cleanup into kill()
This moves all the de-init code into kill(), which fixes a few
reference issues causing processes to hang around longer than
desired. If the process terminates on its own and/or the last
reference is lost __del__ will kill the process and clean up.
2021-02-26 10:09:56 -06:00
James Prestwood
48d27c982d test-runner: reset namespaces on test completion 2021-02-26 10:09:56 -06:00
James Prestwood
8f33926a75 test-runner: use cleanup() for start_dbus
Use a cleanup routine to remove the dbus_address/dbus_cfg files
2021-02-26 10:09:56 -06:00
James Prestwood
11f0abebe6 test-runner: add better Hostapd cleanup
There were a few issues with the cleanup of Hostapd. First the
process was only being killed, which did not actually remove
the process from the list.

In addition, with EAP-SIM/AKA tests, hostapd created sim_db
unix socket files which it does not clean up.
2021-02-26 10:09:36 -06:00
James Prestwood
bf9d2b6c52 test-runner: allow radio remove failure
This is somewhat of an open issue/TODO but for now this avoids
the exception caused by trying to remove a radio that has been
moved to a namespace. Once a radio is moved hwsim loses that phy
and can no longer interact with it. This causes the Destroy()
method call to fail.
2021-02-26 10:09:36 -06:00
James Prestwood
5e79cda7c6 test-runner: cleanup output files/others in Process
A cleanup parameter was added to __init__ which can be used
by processes which create any additional files or require more
a custom cleanup routine. Some additional house keeping was
done to make Process cleanup more robust.
2021-02-26 10:09:36 -06:00
James Prestwood
697b4ce82f test-runner: remove concept of 'multi_test'
Though multi-test processes seemed like a good idea in terms of
efficiency, the additional code/special cases was not worth it
for the only two multi-test processes (dbus/haveged). Intead this
concept was removed completely and TestContext/Namespaces will
now start all processes for each individual test. This also is
fair to all tests as a previous failed test could end up bleeding
into future tests.
2021-02-26 10:09:36 -06:00
James Prestwood
80ff2fe140 auto-t: iwd.py: release namespace on IWD close 2021-02-26 10:09:36 -06:00
James Prestwood
bb27cea54c auto-t: release radio/hostapd instances from cls
The cls object is part of the unittest framework and its lifespan
is out of test-runner's control. Setting objects into the cls
object sometimes keeps those objects around longer than desired.
Its best to unset anything set in cls when the test is tore down.
2021-02-26 10:08:10 -06:00
James Prestwood
e5a66bf51f auto-t: testNetconfig stop dhcpd correctly
Use stop_process instead of kill as this removes the process
from the test context.
2021-02-26 10:08:03 -06:00
James Prestwood
e8389190a9 auto-t: testutil.py: pass wait into ping
This will wait for the process and cleanup ping-out file
2021-02-26 10:07:32 -06:00
James Prestwood
0e13c8d32b auto-t: hlrauc.py: remove unix socket on cleanup 2021-02-26 10:07:17 -06:00
James Prestwood
904238b6ec auto-t: testEAD: stop ead when test finishes 2021-02-26 10:07:07 -06:00
James Prestwood
90b695cfdf test-runner: fix start_dbus and clean up config
start_dbus was not returning the Process class which was
expected by the caller. This resulted in the config not
being cleaned up.
2021-02-19 10:16:37 -06:00
James Prestwood
4682c22ece test-runner: add __str__ method to Process
Printing out processes was done manually but instead we can
make Process printing extendable by adding its own __str__
method. This now will print if the process is a multi-test
process as well.
2021-02-19 10:16:37 -06:00
James Prestwood
c10bd14cde test-runner: use unique name for namespace output files
Output files in namespaces were not handled differently and would
end up overwriting/duplicating files from the root namespace. These
are now named /tmp/<process>-<namespace>-out.
2021-02-19 10:16:37 -06:00
James Prestwood
1791ef1dc7 test-runner: refactor Process class
The process class was quite hard to understand, and somewhat
fragile when multiple output options were needed like verbose
and logging, and in some cases even an additional output file.

To make things simpler we can have all processes output to a
temporary file (/tmp/<name>-out) and set a GLib IO watch on
that file. When the IO watch callback fires any additional
files (stdout, log files, output files) can be written to.

For wait=True processes we do not use an IO watch, but do
the same thing once the process exits, write to any additional
output files using the process output we already have.
2021-02-19 10:16:37 -06:00
James Prestwood
272a60a478 test-runner: require root user to run with --monitor
Since the monitor file requires touching the host file
system, root access is required.
2021-02-19 10:16:37 -06:00
James Prestwood
c2d71fdaa5 test-runner: clear log dir before new log test run
The log dir was never being cleaned out prior to a new logging
test run. This could leave old stale files around. Note that this
will remove any past log files so if you need them, you want to
make a copy before running test-runner with --log again.
2021-02-19 10:16:37 -06:00
James Prestwood
a0865c9010 test-runner: start dmesg process with start_process
This avoids the need to pass in the context explicitly.
2021-02-19 10:16:37 -06:00
Marcel Holtmann
25ec652423 manager: If driver is not provided, then use default interfaces 2021-02-18 21:43:56 +01:00
Andrew Zaborowski
e8ad4f10b0 ap: Drop an outdated TODO comment 2021-02-18 14:00:30 -06:00
Marcel Holtmann
bde3e0f6e3 Release 1.12 2021-02-16 21:35:20 +01:00
Marcel Holtmann
72f14b86cf build: Add missing file to .gitignore 2021-02-16 21:03:37 +01:00
Marcel Holtmann
d2bd68693b build: Require at least version 0.38 when building with external ELL 2021-02-16 21:02:55 +01:00
Marcel Holtmann
a2f1389efa build: Remove mentions of --enable-sim-hardcoded 2021-02-15 19:20:58 +01:00
Alvin Šipraga
6b6d0de163 doc: describe InitialPeriodicScanInterval setting 2021-02-12 09:57:10 -06:00
Alvin Šipraga
ff82133050 scan: add InitialPeriodicScanInterval setting 2021-02-12 09:57:10 -06:00
Alvin Šipraga
2df581d1ff doc: describe MaximumPeriodicScanIntervalSetting 2021-02-12 09:57:10 -06:00
Alvin Šipraga
88f2b44bba scan: add MaximumPeriodicScanInterval setting 2021-02-12 09:57:10 -06:00
James Prestwood
3a9c401f63 auto-t: fix blacklist test timing issues
This test fails randomly, and it appears to be due to excessive
scanning. Historically most autotests start a dbus scan right
away. The problem is that most likely a periodic scan is already
ongoing, meaning the dbus scan gets queued. If a Connect() call
comes in (which it always does), the dbus scan gets delayed and will
trigger once connected, at a time the test is not expecting. This
can cause problems with any assumed timing as well as offchannel
frames.

This patch removes the explicit DBus scanning and instead uses
scan_if_needed with get_ordered_networks. The 'all_blacklisted_test'
was also modified to wait for scanning to complete after failing
to connect to all BSS's. This lets all the networks fully come
up (after being blocked by hwsim) and appear in scan results.
2021-02-11 20:32:26 -06:00
Denis Kenzior
963bd1344f AUTHORS: Mention Daniel's contributions 2021-02-11 15:06:54 -06:00
Daniel Lin
c68e9fc0a6 resolve: configure systemd-resolved's MulticastDNS= setting
When using iwd.conf:[General].EnableNetworkConfiguration=true, it is not
possible to configure systemd.network:[Network].MulticastDNS= as
systemd-networkd considers the link to be unmanaged. This patch allows
iwd to configure that setting on systemd-resolved directly.
2021-02-11 15:06:01 -06:00
James Prestwood
c96317041d test: add a simple signal agent script
Creates a signal agent and registers for levels passed
in on the command line, or a default set of levels.
2021-02-10 15:44:52 -06:00
Denis Kenzior
c2104b62a9 unit: Drop eapol_sm_free calls
WSC EAP method always results in failure, even if successful.  Failed
eapol_sm sessions are auto-cleaned, so there's no need to do this
explicitly.  Also eapol_exit() will clean up any left-over sessions, so
drop this to make the code a bit simpler.
2021-02-10 15:41:37 -06:00
James Prestwood
6421b3c5c1 netdev: always register for single CQM threshold
If the extended feature for CQM levels was not supported no CQM
registration would happen, not even for a single level. This
caused IWD to completely lose the ability to roam since it would
only get notified when the kernel was disconnecting, around -90
dBm, not giving IWD enough time to roam.

Instead if the extended feature is not supported we can still
register for the event, just without multiple signal levels.
2021-02-10 12:09:28 -06:00
Andrew Zaborowski
0b5e7ab7bb crypto: Check for l_cipher_decrypt error 2021-02-10 11:56:24 -06:00
James Prestwood
a327e3f4d8 client: remove warning on mkdir return
This fixes up a previous commit which breaks iwctl. The
check was added to satisfy static analysis but it ended
up preventing iwctl from starting. In this case mkdir
can fail (e.g. if the directory already exists) and only
if it fails should the history be read. Otherwise a
successful mkdir return indicates the history folder is
new and there is no reason to try reading it.
2021-02-09 14:49:17 -06:00
Denis Kenzior
8232fbddbf unit: Drop un-needed null checks
both ap_sm and sta_sm are passed to eapol_register and
eapol_start.  No need to check for null here
2021-02-09 10:42:03 -06:00
Denis Kenzior
f0d811b79c backtrace: Avoid null-dereferencing strchr result 2021-02-09 10:30:48 -06:00
Denis Kenzior
fa9ae4acb7 scan: Put an upper bound on the scan interval 2021-02-09 09:31:05 -06:00