Commit Graph

140 Commits

Author SHA1 Message Date
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