Commit Graph

236 Commits

Author SHA1 Message Date
James Prestwood d8aadc49b2 tools: enable CONFIG_CRYPTO_ARC4 in kernel config 2019-09-11 11:40:39 -05:00
Marcel Holtmann 1104d69e29 build: Add StateDirectoryMode=0700 option to systemd service 2019-09-09 06:55:22 +02:00
Marcel Holtmann c1a9f71b39 build: Add script to start iwd.service via systemd-run 2019-09-08 22:10:28 +02:00
Marcel Holtmann 7e4a6e8a49 test-runner: Remove pointless NULL check before calling l_free 2019-09-08 18:14:13 +02:00
Marcel Holtmann 9d1f7ad6f5 test-runner: Provide CONFIGURATION_DIRECTORY and STATE_DIRECTORY 2019-09-08 18:12:51 +02:00
Marcel Holtmann 7347bd4098 test-runner: Use execvpe to provide environment context 2019-09-08 18:03:10 +02:00
James Prestwood 7acb910a26 test-runner: better define --shell behavior
Specifically, this defines the behavior when --shell is used when no
specific test is specified. In this case test-runner will assume the
'shell' test/sandbox should be used as the test environment as
running all autotests with --shell is not useful or feasable.
2019-08-28 15:55:57 -05:00
James Prestwood 202f65be69 tools/ios_convert: use join rather than manually looping 2019-08-27 10:14:08 -05:00
James Prestwood de2c808970 tools/ios_convert: add ServerDomainMask
Parses mobileconfig TLSTrustedServerNames
2019-08-27 10:14:08 -05:00
James Prestwood 96ce39c1c2 tools/ios_convert: add raw XML option
This option allows the script to be called with a raw XML file. This
is mostly useful for testing, but since its already implemented we
might as well include it.
2019-08-27 10:14:08 -05:00
James Prestwood ab0c8cae3c tools/ios_convert: parse DisplayedOperatorName
Some hotspot networks do not contain SSID_STR, which was required
for both naming the provisioning file as well as the 'Name' key.
The DisplayedOperatorName is a better option for this 'Name' key
and could also be used for the filename.

Now, DisplayedOperatorName is preferred, and if not found SSID_STR
is used.
2019-08-27 10:14:08 -05:00
James Prestwood b05689fc81 tools/ios_convert: Use tag instead of text for IsHotspot
The IsHotspot key just contains a tag after it (true/false), not
a tag with inner text.
2019-08-22 13:05:16 -05:00
James Prestwood 54a5791195 tools/ios_convert: add 'Name' to hotspot config
Also fixed a indentation issue for NAIRealms
2019-08-22 12:46:16 -05:00
James Prestwood 0e317ed9b1 test-runner: print if haveged fails to start
If haveged is not installed it attempts to start but exits with no
indication of what happened.
2019-08-20 14:23:35 -05:00
Denis Kenzior ed8a4ab931 treewide: Make global variables static 2019-08-15 15:06:59 -05:00
James Prestwood d2639e5d4e test-runner: log iwd output for --shell
This will allow the user to see the iwd output in /tmp/iwd.log.

execute_program was extended to take a 'log' flag. If true, this
will cause the programs output to be stored in /tmp/<name>.log.
This is only useful when using the --shell command as this file
will go away once the VM stops. The verbose flag always overrides
the logging functionality.

For now only iwd output is logged when using --shell.
2019-08-07 16:37:51 -05:00
James Prestwood da65acbd07 test-runner: allow booting directly into a shell
It is sometimes valuable to just boot into a shell in order to manually
test functionality. Since test-runner already is setup to run a minimal
kernel with all the necessary requirements for hostapd/iwd it made
sense to allow the user to do this.

If -s,--shell is passed into test runner, no python tests will be run.
The hw.conf file is still used to setup IWD and hostapd so once booted
into the shell you can still (manually) run the test (e.g. via iwctl).

This also works when using USB/PCI passthrough. This makes testing
out different kernel version with real hardware much quicker than
using the host kernel.
2019-08-07 16:37:51 -05:00
James Prestwood d8dac9a330 tools: add tool for iOS mobileconfig conversion
This tool will convert an iOS 'mobileconfig' file into the IWD
format. The tool only supports PEAP and TTLS networks, including
hotspots.

It will also parse out any certificate chains found in the
mobileconfig file, and verify they lead to a root CA found on the
system. If they do, this root CA will be used as the CACert in
the provisioning file.
2019-07-29 14:04:03 -05:00
James Prestwood edd4f2b2a2 test-runner: allow glob matching of tests
This allows a glob match of tests, e.g.

./test-runner -A testEAP-TTLS*

would run all TTLS based tests
2019-06-05 16:49:45 -05:00
Denis Kenzior 71ebc00fb7 tools: Update test-runner to the new genl api 2019-05-17 17:10:15 -05:00
Denis Kenzior dea23bede7 tools: Update hwsim to the new genl api 2019-05-17 17:10:13 -05:00
James Prestwood f038c11205 test-runner: allow disabling of iftype/cipher
Two new hardware configuration keys were added:

[radX]
iftype_disable=station,ap,adhoc,p2p_client,p2p_go,mesh_point
cipher_disable=wep40,wep104,tkip,ccmp,bip

Any of the above values are supported and can be disabled.
2019-05-13 16:38:23 -05:00
James Prestwood 2d173e5f24 test-runner: add a radio parameters structure for creation
Support is coming to configure radios with a specific set of interface
type and cipher support, so the input to create_hwsim_radio is better
suited to use a parameter structure rather than adding more parameters.
2019-05-13 16:38:23 -05:00
James Prestwood 2d51622c0b test-runner: allow radio list subset to be configured
The radio_confs key was parsed in a way that required all radios
to be specified in the list. This isnt optimal, as you may want to
specially configure a certain radio, while keeping all the others
default.

This change reworks some logic and allows any radio to be specially
configured on its own.
2019-05-13 16:38:23 -05:00
James Prestwood 0e31b33631 hwsim: allow specific radio iftypes/ciphers
mac80211_hwsim now allows setting supported iftypes/ciphers. This patch
enables this support in hwsim. Specific iftypes/ciphers can now be
disabled via the command line when creating a radio:

Disable iftypes:
--iftype-disable station,ap,adhoc,p2p_client,p2p_go,mesh_point

Disable cipher types:
--cipher-disable ccmp,tkip,wep
2019-05-13 16:38:23 -05:00
James Prestwood 79dd04c13a test-runner: in native HW mode, check for AP capabilities
The test should be aborted if there are not enough radios that support
AP mode. The iftype attribute will now be parsed during the wiphy dump
and a flag is set on the wiphy so we know to skip this radio when
creating the hostapd instances. Since hostapd gets started first, it
will automatically choose all the radios it needs which support AP mode.
This leaves the remainder of the radios (potentially STA only) for IWD.
2019-05-13 14:13:34 -05:00
James Prestwood 7c7aafa812 test-runner: skip hostapd iface creation if native HW
In native hardware mode the interfaces already exist, so there is
no need for hostapd to create new ones.
2019-05-13 14:13:18 -05:00
James Prestwood 97ec50ce28 test-runner: fix radio index 0 deletion
In the PCI/USB passthrough changes the wiphy ID was changed to be an
unsigned integer, where id zero corresponded to an error when in native
hardware mode. Along with this, the radio ID for hwsim was changed to a
pre-increment (only in test-runner), so the radio IDs would start at 1.
The repercussions were not fully investigated, but if they were it would
have been seen that hwsim creates radios IDs starting at zero. This left
test-runner and hwsim with unsynchronized radio IDs, and radio zero
never got deleted after each test causing each successive test to
discover old radio IDs.
2019-05-13 14:11:54 -05:00
Andrew Zaborowski d256bc91ad test-runner: Drop options no longer supported by qemu
-nodefconfig doesn't exist anymore and according to the docs it either
had the same meaning or was implied by -no-user-config so it wouldn't be
needed anyway.  -balloon doesn't exist anymore and according to
https://lists.gnu.org/archive/html/qemu-devel/2018-02/msg06985.html
"-balloon none" was a nop, but I suspect -nodefaults may have already
had the effect of disabling creation of the virtio-balloon device.
2019-05-10 14:15:51 -05:00
James Prestwood 07115e56a1 test-runner: Allow native hardware passthrough
This patch allows the host machine to pass through its PCI/USB network
cards into the test-runner virtual machine. By doing this we can run
nearly all the same autotests using physical/real wireless hardware.

First off, utilizing this feature requires a properly configured host
machine. There are kernel boot parameters and config files that need to
be configured before any of this will work. Unfortunately there is no
way around this, and hence this feature is not particularly aimed for
"the masses", but rather for specially configured test machines.

A new configuration file was introduced (tools/hw.conf) which is just an
example, it should be edited to work with the host machine using it. This
file merely holds the PCI addresses/USB bus of the devices you wish to pass
through to qemu.

Passing in this hardware config file with --hw <file> tells test-runner
that you are attempting to use this new feature. The tests themselves
do not need to change, its the initial test setup that required some
changes.

Since we are no longer creating radios we must discover the radios that
are present (once in the VM). This is done using borrowed code from IWD
to dump wiphys and interfaces. As the wiphys/interfaces are dumped, we
build up the wiphy list. In the hwsim case we still build this list up
when we create the radios, which hasn't changed. This does lead us to
have some special cleaup, where in the native case we just 'reset' the
list into its state pre-test (removing any hostapd flags). And as before
with the hwsim case we fully destroy and free the wiphy list, since a
new list will be created on the next test (along with new radios).

There should not need to be any changes to the tests themselves, but
potentially to some hw.conf files. A new key was introduced, 'needs_hwsim'
which need to be set on any tests that require the hwsim dbus API. This
tells test-runner to skip this test, otherwise it would fail in native
mode.

One last minor detail; the wiphy->id was changed to an unsigned int. This
is to match the type the kernel uses when dumping wiphys. Because of
this '0' is now the error case for both hwsim and native mode rather than
-1. Error checks were updated accordingly.
2019-05-01 17:03:34 -05:00
Andrew Zaborowski d1c4921b86 test-runner: Only create/remove interfaces for hostapd
Move the interface creation code from configure_hw_radios to
configure_hostapd_instaces so as not to create unneeded interfaces on
the wiphys that IWD is going to manage.  We pass a wiphy whitelist to
IWD later and IWD now creates the interfaces it needs on those managed
wiphys.  Change TEST_WIPHY_LIST format to only include the interface
name for the wiphys used by hostapd.

Note that we still remove interfaces just before removing the hwsim
radios on exit, it seems like there's no point removing the interfaces
in that case.
2019-04-22 16:33:40 -05:00
Andrew Zaborowski 20faa37467 test-runner: Futher fix for the SETUP group support
Drop a pointless asignment of has_hw_conf to false when it's already
false, fix index when accessing radio_conf_list.  Apparently the SETUP
group is not used in any of our test and wasn't tested itself so could
as well have removed the code.
2019-04-22 16:33:40 -05:00
Andrew Zaborowski 1462d68eb6 test-runner: Check radio_conf_list is not null
The option may be present but may not parse correctly as a list in which
case has_hw_conf will be true but radio_conf_list will be NULL and we
might crash.
2019-04-22 16:33:40 -05:00
Andrew Zaborowski fcd5b8b54f test-runner: Drop unused wiphy.interface_index 2019-04-22 16:33:16 -05:00
James Prestwood 71c7d826e4 tools: fix test_runner_kernel_config for HT/VHT
This should now properly load regulatory.db and disable verification
2019-03-18 12:21:49 -05:00
James Prestwood 7b3831515a test-runner: allow test to set the regulatory domain
HT/VHT require setting the regulatory domain to something other
than 00. This adds an option to the hardware config which allows
the regulatory domain to be set to any country.
2019-02-21 16:45:30 -06:00
James Prestwood c275581389 tools: add option to disable reg domain verification
HT/VHT require channels who's use is restricted depending on
country. When using these channels, cfg80211 tries to load the
regulatory.db file in /lib/firmware and verify the signature.
This poses a problem as the host machine may not have a signed
regulatory.db, or it may have not been signed with the expected
signature which would cause cfg80211 to fail to load the database.

If cfg80211 fails to load the database the country will be set to
00, which is the most restrictive "world roaming" setting. This
does not allow HT/VHT to work properly.

In the context of test-runner we can simply disable the verification.
Unforunately this is not a very common practice, so CONFIG_EXPERT
must be enabled.

If your system does not have /lib/firmware/regulatory.db you must
get it. More info can be found here:

https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb
2019-02-21 16:42:48 -06:00
Mat Martineau 645b7dda4b tools: Add CONFIG_CRYPTO_USER_API_AEAD for full TLS support 2019-02-17 20:43:38 -06:00
James Prestwood 8956451b26 test-runner: decouple --verbose with --valgrind
When using --valgrind, you must also use --verbose iwd, and, depending
on the tests you may also need to include pytests in the verbose flag.
Since anyone using --valgrind definitely wants to see valgrind info
printed they should not need to enable verbose printing. Also, manually
parsing valgrind prints with IWD prints mixed throughout is a nightmare
even for a single test.

This patch uses valgrind's --log-file flag, which is directed to
/tmp/valgrind.log. After the tests runs we can print out this file.
2019-01-18 08:57:21 -06:00
James Prestwood 1927e40fd0 test-runner: fix garbage output on test start
I missed this on a previous commit fixing the same issue with printing
the test results. This fixes garbage output on lines in between test
runs.
2019-01-17 15:43:12 -06:00
James Prestwood 2ec66c9d3f test-runner: fixed garbage output in test results
When printing test results the line separators were not NULL terminated
causing garbage bytes to be printed at the end.
2018-12-17 11:17:34 -06:00
James Prestwood dd835aba2e test-runner: fix removal of SIM/AKA/AKA' files
If ofono/phonesim is not found on the system, any test requiring those will
be skipped. In this case we would still try and remove symlinks that were
never created. An error would be printed, but the actual source tree files
were getting removed. This adds a new goto label where we can skip the tmpfs
removal in this error case.
2018-12-05 22:24:08 -06:00
Andrew Zaborowski 862707f943 test-runner: Add dbus verbose output options
-v dbus may help debug find client authentication problems but if
everything is ok it will not print any messages.  -v dbus-monitor starts
the dbus-monitor.
2018-11-30 10:26:30 -06:00
Tim Kourt 2cc4fdbf45 t-runner: Add verbosity option for TLS debug 2018-11-02 15:54:32 -05:00
Denis Kenzior a4512f3cd6 hwsim: Use l_genl_family_set_unicast_handler 2018-11-02 15:52:56 -05:00
Marcel Holtmann 554e4f55db build: Fix includes for using with -std=c99 compiler option 2018-11-01 22:37:11 +01:00
Marcel Holtmann 72a64fa7fb build: Adjust to the latest ELL signal API changes 2018-11-01 22:09:19 +01:00
Marcel Holtmann 2b36727f3a test-runner: Use l_main_run_with_signal instead of open coding it 2018-11-01 20:46:18 +01:00
Marcel Holtmann 36f5056810 hwsim: Use l_main_run_with_signal instead of open coding it 2018-11-01 19:58:34 +01:00
James Prestwood a2df686d97 hwsim: limit "Unknown attribute type:" print
Since we don't catch all hwsim attribute types in unicast_handler
you see tons of "Unknown attribute type: X" prints. Since this is
not an error, we should only print if the attribute does not exist
in the attribute list.
2018-10-24 16:23:12 -05:00