3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-20 12:39:25 +01:00
Commit Graph

361 Commits

Author SHA1 Message Date
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
James Prestwood
ceca5c42ba hwsim: update hwsim attrs to latest mac80211_hwsim 2018-10-24 16:23:12 -05:00
Marcel Holtmann
2606bc73ad build: Add DAEMON_ prefix to CONFIGDIR and STORAGEDIR 2018-09-14 17:58:44 +02:00
Marcel Holtmann
ea20559599 tools: Change net.connman.iwd.hwsim to net.connman.hwsim 2018-09-14 15:27:57 +02:00
Marcel Holtmann
502aac073f tools: Add configure option and D-Bus policy file for hwsim utility 2018-09-14 15:24:15 +02:00
Marcel Holtmann
b88388b172 hwsim: Fix missing handling of help option -h 2018-09-14 15:17:14 +02:00
Tim Kourt
83e66b5831 tools: add needed CONFIG_SECURITYFS option
Add CONFIG_SECURITYFS as a required configuration option
for the kernels to be used with test-runner.
2018-09-13 16:42:23 -05:00
Mat Martineau
27e9b6c435 tools: Remove unused kernel config
CONFIG_DRIVER_NL80211 isn't an option for the kernel. Maybe it was
mistakenly added based on the hostap configuration instructions in
doc/test-runner.txt

If the intent was to add CONFIG_CFG80211 and CONFIG_MAC80211, they're
already in the relevant kernel defconfigs.
2018-06-19 16:06:08 -05:00
Denis Kenzior
e15caa2288 test-runner: Fix kernel command line parsing
Kernel command line arguments were not being parsed properly, $PATH in
particular was completely screwed up and causing commands in user's
$PATH to fail
2018-06-14 15:19:50 -05:00
James Prestwood
16a2fb2664 test-runner: added CONFIG_NLMON to kernel config 2018-05-24 19:42:19 -05:00
Andrew Zaborowski
465488878e hwsim: Look up radio address in radio_info
In mac80211_hwsim each radio is assigned two addresses, the second (addr
1) being used over nl80211.  In SendFrame we'd hardcode the mapping of
address 0 to address 1 even though we track all the addresses in radio_info,
so instead use that data to find the radio that has given address 0.  Also
if no address 0 matches what was supplied over DBus try to find a matching
address 1.

There are ways userspace can request different addresses when managing
mac80211_hwsim radios and the hardcoded mapping would become wrong.
2018-05-22 11:35:57 -05:00
Andrew Zaborowski
676a1f48c3 hwsim: Don't crash if source radio not found
We already print an error when this happens, no need to crash.
2018-05-22 11:35:05 -05:00
James Prestwood
23b9963b20 test-runner: fix iwd verbosity
Specifying --verbose iwd will now enable the -d flag for IWD
2018-05-21 17:49:01 -05:00
Denis Kenzior
d13f10c111 test-runner: Add hwsim to --gdb support 2018-05-21 17:33:45 -05:00
Tim Kourt
79ce3f645f t-runner: init stat totals
the stat_totals structure was not initialized and produced
a garbage output when printed
2018-05-10 18:58:13 -05:00
Mat Martineau
9252d23358 test-runner: Use l_strdup_printf to combine strings
There's a new "-Werror=format-overflow" warning in gcc 8 that detects
potential overflow or truncation with sprintf/snprintf, so the
test-runner build fails with gcc 8. Using l_strdup_printf allows the
build to succeed, and moves a few large buffers from the stack to the
heap.
2018-05-09 20:41:51 -05:00
James Prestwood
aed98137fb test-runner: set env flag if valgrind is being used
If the hw.conf option 'start_iwd' is false, then iwd is started
inside the python test, which means it will not know if the
--valgrind option was passed to test runner. If this is the case
an environment variable is set so the python test knows the
option is being used.
2018-04-27 11:21:33 -05:00
James Prestwood
eaf93de0fa test-runner: enable verbose output for kernel
This was mistakenly removed. This allows you to use "-v kernel"
2018-04-24 14:55:39 -05:00
James Prestwood
f67505c5df test-runner: fix warning in gdb patch 2018-04-03 15:34:51 -05:00
James Prestwood
461b39f206 test-runner: add feature to debug processes with gdb
Specifying the --gdb <process> option to test runner will run gbd on
the given process. Using this option will turn off all timeouts in
test-runner.
2018-04-02 12:49:09 -05:00
Andrew Zaborowski
90366ba0c4 test-runner: Kill hwsim after failed hostapd setup
Without this subsequent tests may be affected by hwsim not being
restarted.

Additionally in 4.13 the kernel will not use the registered hwsim
wmedium for wiphys created after the HWSIM_CMD_REGISTER call and
there's no way to re-register it without disconnecting from netlink
which is a bit of work.  It's a one line fix in 4.13, I've not yet
checked if this has changed in current git.
2018-03-21 14:25:30 -05:00
Andrew Zaborowski
4a7e228da8 test-runner: Run all APs as one hostapd instance
When running multiple BSSes in one ESS this solves the communication
between them (called RRB) for purposes like preauthentication,
FT key pull and push and FT-over-DS without complicated bridges.  At the
same time we're unlikely to have a scenario where we need the
communication to fail so there's no need for this to be configurable.

The supporting code for multiple hostapd processes is left in place so
that configure_hostapd_instances can decide how many processes to run
based on hw.conf and policies.  start_hostapd now uses "-i wln0,..."
which is no longer documented in hostapd manual page or usage() but
still supported in current git and required if interface names are not
provided in the config files (possibly unless -b is used which is also
undocumented.)
2018-03-21 14:25:11 -05:00
Tim Kourt
0afdd64db5 t-runner: refactor logic for output hiding 2018-02-07 11:33:23 -06:00
Tim Kourt
290f4e24d4 t-runner: fix 'new line' usage for non-verbose mode 2018-02-07 11:33:19 -06:00
James Prestwood
fc9fe34ba0 test-runner: remove unneeded argument parsing
There was an unnecessary l_strsplit call when parsing the verbose
options for test-runner. The verbose options get parsed inside
qemu already, so this call was removed.
2018-02-02 14:38:23 -06:00
James Prestwood
bcf9ec5922 tools: add valgrind option to test-runner
Can now pass -V, --valgrind to test-runner to run valgrind on
iwd during autotests. Note: the verbose option for iwd must
also be passed in order to see output (-v iwd).
2018-02-01 13:21:55 -06:00
James Prestwood
d25e88cd8d t-runner: Fixed crash
test-runner would segfault if no verbose option was passed.
2018-02-01 10:30:48 -06:00
Denis Kenzior
17f55f3b4a hwsim: Fix leak of send_frame_info->user_data
In case the genl object is cleaned up prior to the callback being
called, the DBus message might get leaked.  Can only happen in bizarre
cases.
2018-01-30 23:03:07 -06:00
James Prestwood
f22ec55efb hwsim: add spoofing frame support
Added a new method SendFrame() under the radios .Interface
interface. This method takes two byte arrays as parameters,
first is the station address to send the frame to, and the
second is the raw frame data.
2018-01-30 22:59:32 -06:00
James Prestwood
20fc857afd test-runner: added more verbosity options
The following verbose options can be used:

"unit" - see output from unit tests
"kernel" - see hwsim kernel prints
"pytests" - see prints from python autotests
2018-01-24 17:07:43 -06:00
James Prestwood
802a8f86ff test-runner: make verbose option -v application specific
The existing verbose option would turn on debug logging for most
processes in the test-runner framework. This change makes the verbose
option more granular. The --verbose or -v option should now be
followed by a comma separated list of the test-runner processes you
want to see debug logging from. Currently iwd, hwsim, ofonod, and
hostapd are valid options to pass to the verbose flag e.g.

-v iwd,hwsim,ofonod,hostapd

Or any single/combination of the above applications.
2018-01-24 11:17:30 -06:00
Denis Kenzior
d98349d201 tools: Remove unused kernel config
CONFIG_CRYPTO_USER_API_AKCIPHER was superceded by the keys API and not
actually used now.
2018-01-22 10:27:50 -06:00
Mat Martineau
9ea0063eb9 tools: Add SHA512 to kernel config
This hash algorithm is used by the ELL unit tests.
2018-01-19 12:50:05 -06:00
James Prestwood
d175e4aa42 test-runner: add ofono/phonesim to test-runner
A new option 'sim_keys' can be put in the SETUP group. If
sim_keys=ofono, then test-runner will attempt to start ofono
and phonesim to be used with EAP-SIM/AKA. If ofono OR phonesim
are not found the test will be skipped.

Any other value of 'sim_keys' should be a 'keys' file
e.g. /tmp/sim_keys.conf which should contain hardcoded
SIM/AKA key values.
2017-12-14 17:46:46 -06:00
Tim Kourt
f6ae59e48e tools: add DES cipher algorithm support 2017-10-31 16:53:00 -05:00
Andrew Zaborowski
a7ee2c428a hwsim: Use util_is_broadcast_address
Replace is_multicast_addr with util_is_broadcast_address usage.
is_multicast_addr seems to have been wrong, first because we're not
interested in just any multicast address (defined to be same as "group
address"), but rather specifically the broadcast address, as we don't
know of any specific address groups other than broadcast.  And also
wrong because the "Individual/Group bit" is the LSB of byte 0, not the
MSB of byte 0 apparently.
2017-09-22 10:09:01 -05:00
Andrew Zaborowski
c8854d9a4c hwsim: Use new mpdu.h structs 2017-08-31 15:13:09 -05:00
Marcel Holtmann
c0a77f32c1 test-runner: Add support for Qemu on PowerPC 32-bit and 64-bit 2017-08-30 14:25:03 -07:00
Andrew Zaborowski
bf86081eba hwsim: Add Rule.Drop property
Add a way to have matching packets dropped by the hwsim medium.
2017-08-23 13:26:58 -05:00
Marcel Holtmann
45e4626d80 test-runner: Add support for Qemu on ARM 32-bit and 64-bit 2017-08-08 00:00:59 -07:00
Mat Martineau
21fae3d1d9 test-runner: Avoid intermediate string in number conversion
Derive a floating-point interval value from integers using math rather
than integer->string->float conversion. The string technique triggered a
-Wformat-overflow warning.
2017-07-11 16:34:52 -07:00
James Prestwood
1cd1183916 test-runner: move remove_absolute_path_dirs call
remove_absolute_path_dirs() was not getting called in some test
failure cases. This caused subsequent tests to fail due to stale
files existing.
2017-06-02 14:21:01 -05:00
Matías Zúñiga
d46489c4ee test-runner: Always define qemu_table
Otherwise build fails in architectures with no qemu name defined.
2017-06-01 11:19:10 -05:00
Andrew Zaborowski
a2b9cd0726 test-runner: Set host dependent qemu executable path list 2017-05-16 15:59:33 -05:00
Denis Kenzior
694a95ba9e test-runner: Bump alloca request
Otherwise we run out of bounds on the argv array.
2017-05-16 15:57:56 -05:00
Andrew Zaborowski
7b45ad220d test-runner: Fix the has_virt flag usage
Use the same machine type regardless of has_virt: q35 with accelerators
list set to kvm:tcg, this will use KVM if available and fall back to TCG
if not available so there's no point checking has_virt.  We can't
reliably know if KVM is usable anyway: even if the CPU has the
virtualization extensions, the support might not be enabled in the QEMU
build or there may be no kernel module or we may be calling a different
qemu executable than the one supporting KVM.

Set CPU type to "host" if KVM available and "max" otherwise because
"host" is not supported without KVM.  We actually want to emulate the
host CPU as closely as possible so that host executables can run even if
optimized for the specific CPU.  "max" seems to be the new way (since
Feb only) to request "host" cpu without KVM.  It seems that the idea is
for "max" to become same as "host" if KVM is enabled so at some point we
will want to switch to using "max" in both cases.

The "level=9" flag seems to have been an error, there's no CPU with
cpuid max level of 9 and I can't see the purpose of setting the cpuid
level other than the host cpu's level.

-enable-kvm is redundant with accel=kvm:tcg in current qemu.

Again I'm not able to test this patch on a cpu that would be affected
by it but I hope this fixes some situations which are currently broken
anyway.
2017-05-16 15:56:06 -05:00
Andrew Zaborowski
a74c34024a test-runner: Check for SVM in check_virtualization
Update check_virtualization to check for the SVM on x86, KVM supports
both VMX and SVM.  Fix the clobber list of the VMX check: memory is not
clobbered while ebx and edx are (ecx is already marked as output).

I'm not able to test this patch on a cpu that would be affected by it
but I don't think test-runner has been tested on those cpus yet.
2017-05-16 15:31:09 -05:00
Andrew Zaborowski
80ac510be0 test-runner: Export final interface config to tests
Communicate the final wiphy and interface configuration data after the
hostapd and iwd processes are started, to the test scripts as an
environment variable TEST_WIPHY_LIST.  This way the test scripts can
know which interfaces are used by hostapd instances, which hostapd
config they're using, and which are used by iwd.  The typical value will
be
rad0=wln0=hostapd,ctrl_interface=/var/run/hostapd,config=ssidOpen.conf
rad1=wln1=iwd
2017-03-28 15:29:40 -05:00
Andrew Zaborowski
1338c446b0 hwsim: Watch RTNL NewLink events
Handle NewLink events to detect interface mac address changes.  In my
current testing I don't see nl80211 events on address change so it's
best to react to both types of events.
2017-03-28 15:26:02 -05:00
Andrew Zaborowski
dff92b9c76 hwsim: Fix the Interface.Addresses property type 2017-03-26 11:04:42 -05:00
Denis Kenzior
d031e6815a test-runner: Tell iwd which phys to manage 2017-03-16 17:16:22 -05:00
Denis Kenzior
44f23e7a5f test-runner: Simplify phy creation logic
The phy creation logic was a bit complex, using a hashmap to map between
phy names in the config file (e.g. rad0, rad2, etc) and interface names
created for that phy.

We take advantage of the fact that hwsim can create a radio with a given
name to simply assign the radio name from the autotest config file
directly.  Then we name any interfaces created in order of phy creation.

A few extra sanity checks are also added.
2017-03-16 14:06:47 -05:00
Andrew Zaborowski
3b8f9ba176 test-runner: Register hwsim medium on startup
Actually run hwsim in the daemon mode to work as the wireless medium now
that hwsim supports it.  The current test-runner code, which assumed a
different command line syntax, wasn't functional but it didn't affect
test-runner in any way.
2017-03-14 10:27:10 -05:00
Andrew Zaborowski
2411d24c87 hwsim: Don't require full mpdu_mgmt_header in frames
Don't require the full length of a Management MPDU as a condition to
forward the frame, only require data up to the three addresses we need
to know where to forward the frame.

This check was failing with some frames during a deauthentication.  We
could possibly forward shorter frames too if needed (send to all
possible recipients.)
2017-03-14 10:26:17 -05:00
Andrew Zaborowski
0e2a7c479f hwsim: Drop the -k/--keep switch, always keep radios
It didn't make any sense for hwsim to be called in the create mode to
have it create a radio to be destroyed immediately afterwards as hwsim
exited.
2017-03-14 10:25:44 -05:00
Andrew Zaborowski
48b90febf1 hwsim: Don't handle netlink events in command mode
Don't handle the hwsim netlink events we use to track radios and
interfaces if we're not in daemon mode.  This quiets dbus errors when
using hwsim through the command line.
2017-03-14 10:24:51 -05:00
Andrew Zaborowski
10d96e5c19 hwsim: Add terminating 0 byte to attribute
Similar to 21a9b064d3 also include the NUL
byte in the name attribute when creating a radio through DBus call.
2017-03-14 10:24:08 -05:00
Andrew Zaborowski
ea9edc1f99 hwsim: Fix netlink attribute size calculation
The name attribute in the NEW RADIO command needs at least 4 bytes for
the attribute header (struct nlattr), all the characters of the name
string and a NUL byte, and up to 3 bytes of alignment padding.
Otherwise, depending on the name length and whether the NO_VIF attribute
was the last, that attribute could end up being dropped and we were
ending up with too many interfaces inside test-runner.
2017-03-14 10:23:28 -05:00
Denis Kenzior
b2642d42bf hwsim: Clean up some trivial style issues
The code had too many empty lines in places where it would be logical to
just group the statements together.
2017-03-10 10:22:44 -06:00
Andrew Zaborowski
cde6401485 hwsim: Add Rule and RuleManager dbus interfaces 2017-03-10 10:13:23 -06:00
Andrew Zaborowski
3b9785dffe hwsim: Add user-defined rules for frames passed by medium
Define rule structure, add the list of current rules and code to match
frames against rules and apply RSSI changes.
2017-03-10 10:11:09 -06:00
Andrew Zaborowski
7460b6e1a7 hwsim: Add wmedium implementation
Implement a hwsim wireless medium inside hwsim.c.  This doesn't do
anything to the frames it moves around yet, only tries to implement
the same logic that the kernel medium contains.
2017-03-10 10:09:05 -06:00
Andrew Zaborowski
6280a6c72d hwsim: Use an array of addresses for radio_info_rec.addrs
Make accessing the addrs field easier by converting it from a flat
buffer concatenation of the 2 addresses to an array of 2 arrays of
6 bytes.
2017-03-10 10:03:01 -06:00
Andrew Zaborowski
c537953f11 hwsim: Fix property name typo in notification 2017-03-10 10:02:29 -06:00
Andrew Zaborowski
257aa441a1 hwsim: DBus methods for creating and destroying radios 2017-03-10 10:01:04 -06:00
Andrew Zaborowski
315269fd23 hwsim: Basic DBus interface to radio information
In daemon mode start a basic passive DBus interface to expose the
information on radios attached to mac80211_hwsim.  In this version
interfaces have objects of their own.  It might be simpler to only
show them as an array property on the radio object (array of pairs of
string, one string for address, one for name).
2017-03-09 11:21:21 -06:00
Andrew Zaborowski
43a882e934 hwsim: Replace isspace usage with l_ascii_isspace 2017-03-08 09:43:13 -06:00
Andrew Zaborowski
d03eeb398c hwsim: Refactor radio, wiphy and interface tracking
Read wiphy addresses from sysfs and perform the wiphy name to wiphy idx
mapping using sysfs.  Do this directly on a new radio notification and
stop using new wiphy notifications except for updating the radio names.
Having the wiphy index available synchronously when parsing a new radio
event we store the wiphy index in the radio_info_rec struct directly and
drop struct wiphy_info_rec as there was a 1:1 mapping.  With this, and
knowing that all radio_info data is available when new interface
notifications are received, the tracking is simplified because dbus
objects can be created and destroyed within the notification handlers.
We also now store both the wiphy hardware address data and separately
the interface MAC addresses and can use them more appropriately in the
medium implementation.
2017-03-03 11:56:50 -06:00
Andrew Zaborowski
21a9b064d3 hwsim: Include terminating 0 byte in radio name attribute
The kernel expects the radio name attribute to include the string's zero
byte.  Things may still work without this if there is padding after the
attribute.

This has been now patched and the zero byte will be optional when that
patch makes its way through different trees.
2017-03-03 11:50:11 -06:00
Andrew Zaborowski
335ee0c31e hwsim: Add daemon mode with radio information tracking
Add a daemon mode that is entered when no action was specified on the
command line.  In this mode hwsim tracks information on radios through
the netlink events.  The interface to make use of the information is
added in the next patch.
2017-02-23 11:21:18 -06:00
Andrew Zaborowski
dfee120333 hwsim: Fix radio_name_attr length calculation 2017-02-23 11:06:45 -06:00
Andrew Zaborowski
070f93fdf8 hwsim: Fix l_genl_family_register return value check 2017-02-23 11:05:16 -06:00
Denis Kenzior
ada054cc30 test-runner: Don't use killall
killall doesn't wait for the iwd process to clean up, so using it is not
enough when cleaning up between tests.

Using killall -w also doesn't work since iwd is launched by the script.
By the time killall is invoked, the script process is also cleaned up.
So when iwd is killed via killall, nobody is there to reap the zombie
process (test-runner is running as init, but doesn't do this)

The easiest solution is to make the test script itself clean up any iwd
processes it launches.  This is what has been implemented in the
previous patch.
2016-12-20 12:44:52 -06:00
Markus Ongyerth
214603e68f tools: Add MD4 to test runner kernel config 2016-12-14 23:01:22 -06:00
Denis Kenzior
6e729f6175 test-runner: Make sure to chdir to top_level_path
Some unit tests expect to be running from the top level iwd tree
directory to load certificates and such.  Make sure that test-runner
chdirs to the appropriate directory prior to running the unit tests.
2016-12-14 15:52:28 -06:00
Tim Kourt
8bc1b6866f tools: Add option for CMAC in 4.9.0-rc5+ 2016-12-06 17:04:07 -06:00
Tim Kourt
22a7a209d0 tools: Add required for 4.9.0-rc5+ config option 2016-12-06 15:18:50 -06:00
Tim Kourt
f21698095b t-runner: Specify a python version to run 2016-11-30 22:57:16 -06:00
Tim Kourt
8d7b88ad25 t-runner: Disable PMU emulation for a guest 2016-11-30 22:57:13 -06:00
Tim Kourt
a2d638791d t-runner: Enable unit test support 2016-11-29 11:34:07 -06:00
Tim Kourt
50dff98280 t-runner: Rename abs_path_dir_list to tmpfs_extra_stuff 2016-11-03 13:30:06 -05:00
Tim Kourt
445f872ecd t-runner: use iwd config file option 2016-11-02 17:24:51 -05:00
Tim Kourt
c35366fc38 t-runner: Move chdir into the earlier stages 2016-10-12 10:31:32 -05:00
Tim Kourt
60c4f0bc0d t-runner: Allow relative paths in abs dir mapping 2016-10-12 10:31:11 -05:00
Tim Kourt
e29b193195 t-runner: Remove chdirs before exec. of hwsim 2016-10-12 10:27:17 -05:00
Tim Kourt
5d7f523bbf t-runner: Make start of IWD instance optional 2016-10-05 18:05:33 -05:00
Tim Kourt
f93b7dfad1 t-runner: Add symlink for absolute dir. paths 2016-10-03 21:23:21 -05:00
Tim Kourt
7ff9876c47 t-runner: Add python file extensions 2016-10-03 21:23:15 -05:00
Tim Kourt
b1ed586365 t-runner: Mount IWD's storage to tmpfs 2016-10-03 13:52:42 -05:00
Mat Martineau
95017e8722 tools: More key and crypto kernel config parameters 2016-09-05 22:40:07 -05:00
Tim Kourt
6324f96e5d tools: Add kernel config option 2016-09-02 00:24:08 -05:00
Tim Kourt
e7731f27ec tools: Update kernel config for t-r to use new opts 2016-07-13 10:24:42 -05:00
Tim Kourt
34ffadb087 hwsim: Make attribute names consistent 2016-07-13 10:23:31 -05:00
Tim Kourt
d815004b31 t-runner: Register hwsim as a transmission medium 2016-07-13 10:23:06 -05:00
Tim Kourt
c6fb438c73 hwsim: Report exit status to the parent 2016-07-13 10:06:52 -05:00
Tim Kourt
1732dcfb66 t-runner: Set debug environment var for hwsim 2016-07-07 15:44:02 -05:00
Tim Kourt
912a97719a t-runner: Make radio and interface lists optional 2016-07-07 15:35:04 -05:00
Tim Kourt
0b8d641d2e hwsim: Refactor create/list/destroy action logic 2016-07-07 15:20:59 -05:00
Tim Kourt
a7916ebdf2 hwsim: Fix string length bug 2016-07-07 13:44:23 -05:00
Denis Kenzior
8b20019ded hwsim: Add option to enable p2p support 2016-07-07 12:26:16 -05:00
Tim Kourt
4d5e4b929c t-runner: Report if. removal status 2016-06-16 18:23:09 -05:00
Tim Kourt
7fa2ac7b67 t-runner: Use radio identifiers in service assign. 2016-06-16 18:23:06 -05:00
Tim Kourt
6d0bef0bfb t-runner: Add -i parameter into hostapd start cmd 2016-06-16 18:21:20 -05:00
Denis Kenzior
b3abd2f7ca test-runner: add debug info for cmd being executed 2016-06-09 09:56:40 -05:00
Denis Kenzior
d9848730ed test-runner: Update to the new l_main API 2016-06-09 09:56:40 -05:00
Denis Kenzior
87296b4aab hwsim: Update to new l_main api 2016-06-09 09:56:37 -05:00
Tim Kourt
5ac9a20e4f tools: Add test_runner_kernel_config 2016-06-06 12:15:05 -05:00
Tim Kourt
10be3c27b9 t-runner: Search for iwd in both /src and $PATH 2016-06-06 12:08:56 -05:00
Denis Kenzior
411af28489 t-runner: Add command line option for debug output 2016-06-03 09:48:58 -05:00
Tim Kourt
bc22e66df5 t-runner: Remove debug statements 2016-06-03 09:42:51 -05:00
Denis Kenzior
d53873a254 test-runner: Fix buffer overflow
The argv buffer allocated by alloca is only large enough to hold the
original argument list.  Additional arguments (such as --kernel) are
appended at the end, which results in the stack corruption.  Make sure
to allocate space for additional arguments.
2016-05-26 10:07:32 -05:00
Denis Kenzior
f4becdff6a test-runner: Use '-cpu host' in kvm mode
When KVM is available, use the -cpu host option.  This is useful on
distributions that might use architecture specific optimizations, which
might not be available on the default machine being emulated by qemu.

For example, a Gentoo box compiled with "-march=core-avx2" would result
in several binaries not executing properly inside the qemu environment
due to instruction set mismatches.
2016-05-26 10:06:58 -05:00
Tim Kourt
d6d0b1d7d8 t-runner: Refactor D-bus starting logic 2016-05-20 10:18:05 -05:00
Tim Kourt
05df895da4 t-runner: Start 'haveged' by default 2016-05-20 10:17:57 -05:00
Tim Kourt
1c901bcc13 t-runner: Propagate host's $PATH var. into sim. env. 2016-05-19 13:24:51 -05:00
Tim Kourt
52611afe6f t-runner: Start SW entropy generator if no HW avail. 2016-05-18 14:04:03 -05:00
Tim Kourt
94b2c00534 t-runner: make kvm accel. optional 2016-05-18 14:04:03 -05:00
Tim Kourt
63a4972672 hwsim: Remove bogus info msg 2016-05-18 14:01:52 -05:00
Tim Kourt
1a7a1f5b84 t-runner: Change format of the summary row 2016-05-18 14:01:28 -05:00
Tim Kourt
5e6912afd6 t-runner: Add params into hwsim create action 2016-05-17 17:58:16 -05:00
Tim Kourt
9536c27d35 hwsim: Add params: --name, --nointerface 2016-05-17 17:58:13 -05:00
Tim Kourt
900a10d3c7 t-runner: Absence of hostapd instances is ok now 2016-05-13 20:19:34 -05:00
Tim Kourt
1f6939016d t-runner: fix bug in check for radio configs 2016-05-13 20:19:34 -05:00
Tim Kourt
6ee5d6b7c0 t-runner: Bug fix in num radios check 2016-05-13 20:19:34 -05:00
Tim Kourt
eb6e3a5753 t-runner: add exit on hwsim failure 2016-05-13 20:12:21 -05:00
Tim Kourt
86e42a80e7 t-runner: Correct typo in usage 2016-05-13 20:12:02 -05:00
Tim Kourt
3d384b83b7 t-runner: Remove unnecessary line 2016-05-13 20:11:06 -05:00
Tim Kourt
c3213fb95d t-runner: Improved error reporting in exec. program 2016-05-13 20:10:51 -05:00
Tim Kourt
7db9c05610 t-runner: add exit procedures after AP's failures 2016-05-13 20:10:30 -05:00
Tim Kourt
cc7617e506 t-runner: Replace the stat calls with function 2016-05-11 11:08:25 -05:00
Tim Kourt
cfc5f64317 t-runner: Change printfs to l logs 2016-05-09 12:48:45 -05:00
Tim Kourt
66b7a20f40 t-runner: Refactor log statement 2016-05-09 12:48:45 -05:00
Tim Kourt
8e6df3ab0b t-runner: Make -enable-kvm param optional 2016-05-09 12:48:45 -05:00
Tim Kourt
f3f6ebc417 t-runner: Refactored wait loop 2016-05-09 12:48:45 -05:00
Tim Kourt
56f42f6df5 t-runner: Remove auto_run param from t-runner 2016-05-09 09:51:34 -05:00
Tim Kourt
a0cd11e89a t-runner: Propagate --tests param into qemu 2016-05-09 09:50:07 -05:00
Tim Kourt
8b390fc142 t-runner: Add new arg. into t-runner: --tests 2016-05-09 09:48:32 -05:00
Denis Kenzior
1c9550aeb1 t-runner: Fix warning
tools/test-runner.c:1363:6: error: no previous declaration for
‘test_stat_queue_entry_destroy’ [-Werror=missing-declarations]
 void test_stat_queue_entry_destroy(void *data)
2016-05-05 20:46:17 -05:00
Tim Kourt
5a34e3c2b6 t-runner: Refactored run_py_tests params 2016-05-05 20:45:42 -05:00
Tim Kourt
45c54945c3 t-runner: Introduce test stats, improve readability 2016-05-05 20:45:39 -05:00
Tim Kourt
2c3ab8e968 t-runner: Remove delay before the tests 2016-05-05 20:43:38 -05:00
Tim Kourt
364be241d0 t-runner: Change name of signal handler 2016-05-05 20:43:35 -05:00
Tim Kourt
9b339daeb9 t-runner: Add configurable max. test execution int 2016-05-05 20:42:58 -05:00
Tim Kourt
ccc962d040 t-runner: Remove DBus struct: no longer used 2016-05-05 20:41:18 -05:00
Tim Kourt
035d78f403 t-runner: Add test status for the timed out tests 2016-05-05 10:12:25 -05:00
Tim Kourt
347134cb24 t-runner: Change some of the log levels 2016-05-05 10:11:46 -05:00
Tim Kourt
58859212a3 t-runner: Remove unnecessary line brakes 2016-05-05 10:11:29 -05:00
Tim Kourt
16e997c424 t-runner: Refactor exec. timeout starting code 2016-05-05 09:11:21 -05:00
Tim Kourt
d9744f3824 t-runner: Replaced process kill signal 2016-05-05 09:06:43 -05:00
Tim Kourt
b4e3c0d45d t-runner: Fix bug in min number of radios check 2016-05-05 09:06:08 -05:00
Tim Kourt
962653c0d6 t-runner: Remove the IWD service watchers 2016-05-05 09:05:39 -05:00
Tim Kourt
1365da5fdb test-runner: Changed the set of QEMU parameters 2016-04-28 09:37:25 -05:00
Tim Kourt
1cf8279a1b test-runner: Changed the set of parameters 2016-04-27 19:47:22 -05:00
Tim Kourt
5d6425b74a test-runner: Replaced run_command with IWD's tasks 2016-04-27 19:46:54 -05:00
Tim Kourt
3fe7739e86 test-runner: Changed dbus starter to new functions 2016-04-27 19:46:09 -05:00
Tim Kourt
a63a32acfd test-runner: autotest configurator and runner 2016-04-27 19:45:14 -05:00
Tim Kourt
c4fccc2717 test-runner: Python test executor 2016-04-27 19:44:14 -05:00
Tim Kourt
2898c8f2c8 test-runner: Test status formatter 2016-04-27 19:41:37 -05:00
Tim Kourt
81b189137a test-runner: Controllers for IWD 2016-04-27 19:41:33 -05:00
Tim Kourt
d8d5449a45 test-runner: hostapd instance configurator 2016-04-27 19:40:35 -05:00
Tim Kourt
d0b72f8eb7 test-runner: The radio management functions 2016-04-27 19:36:54 -05:00
Tim Kourt
f775e5f53b test-runner: Adding the HW configuration readers 2016-04-27 19:36:36 -05:00
Tim Kourt
10197f4943 test-runner: Dir. discovery and filtration functions 2016-04-27 19:36:14 -05:00
Tim Kourt
313c605a2f test-runner: Added the hostapd control functions 2016-04-27 19:35:25 -05:00
Tim Kourt
09463912d1 test-runner: Added the hwsim control functions 2016-04-27 19:34:34 -05:00
Tim Kourt
b70e2c8a35 test-runner: Added the interface control functions 2016-04-27 19:33:46 -05:00
Tim Kourt
e023eb2287 test-runner: Added various utility functions 2016-04-27 19:33:21 -05:00
Tim Kourt
5d29871d89 hwsim: Fixed the errors reported by checkpatch.pl 2016-04-20 21:24:48 -05:00
Tim Kourt
3cb5213435 test-runner: fixed the type qualifier errors 2016-04-20 17:42:16 -05:00
Tim Kourt
dda07316e6 test-runner: Removed the BlueZ related code 2016-04-14 21:35:52 -05:00
Tim Kourt
00673ba76a tools: Fixed the errors reported by checkpatch.pl 2016-04-12 13:49:00 -05:00
Tim Kourt
2440d4cfd3 tools: Copy test-runner.c from BlueZ
BlueZ commit id: 6aa37338ff72fa2b7bc71766f33e4979cd1526fd
2016-04-11 14:31:56 -05:00
Andrzej Zaborowski
92841b4976 hwsim: Don't try l_genl_attr_next if _attr_init fails.
This was causing a segfault.
2015-04-17 10:50:56 -05:00
Andrzej Zaborowski
0a6b6d0ca5 hwsim: Fix #define 2015-04-17 10:50:39 -05:00
Denis Kenzior
5594de8d27 hwsim: Use new l_genl send() APIs 2015-02-27 11:00:58 -06:00
Denis Kenzior
ff30bb86dd hwsim: Fixup minor style issues 2014-11-14 22:17:30 -06:00