mech_eap.git
10 years agobgscan: Add global bgscan configuration
Haim Dreyfuss [Sun, 3 Nov 2013 13:19:59 +0000 (15:19 +0200)]
bgscan: Add global bgscan configuration

This option can be used to globally configure bgscan parameters
for all the network blocks.

Note that this configuration will not override a network block
specific bgscan settings, but will only be used in case that
the network block does not have a valid bgscan configuration.

Signed-hostap: Haim Dreyfuss <haim.dreyfuss@intel.com>

10 years agohwsim tests: Check kernel messages for warnings/bugs
Johannes Berg [Mon, 4 Nov 2013 09:00:36 +0000 (10:00 +0100)]
hwsim tests: Check kernel messages for warnings/bugs

When a test passes but the kernel printed warnings, consider
the test to have failed.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agoeap_proxy: Re-read IMSI from proxy in Interworking functionality
Naresh Jayaram [Fri, 1 Nov 2013 18:48:03 +0000 (20:48 +0200)]
eap_proxy: Re-read IMSI from proxy in Interworking functionality

Try to read the IMSI values through the eap_proxy layer for Interworking
functionality again if the value was not available at startup.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: HS 2.0 excluded SSID
Jouni Malinen [Mon, 4 Nov 2013 11:22:55 +0000 (13:22 +0200)]
tests: HS 2.0 excluded SSID

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: HS 2.0 required roaming consortium
Jouni Malinen [Mon, 4 Nov 2013 11:11:31 +0000 (13:11 +0200)]
tests: HS 2.0 required roaming consortium

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Use dictionary as add_cred_values() parameter
Jouni Malinen [Mon, 4 Nov 2013 11:09:46 +0000 (13:09 +0200)]
tests: Use dictionary as add_cred_values() parameter

This makes it more convenient to use this function for cases that modify
credential parameters.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Do not require hlr_auc_gw for HS 2.0 username/password
Jouni Malinen [Mon, 4 Nov 2013 10:17:32 +0000 (12:17 +0200)]
tests: Do not require hlr_auc_gw for HS 2.0 username/password

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agoAllow AP mode configuration with VHT enabled on 2.4 GHz
Jouni Malinen [Mon, 4 Nov 2013 09:51:56 +0000 (11:51 +0200)]
Allow AP mode configuration with VHT enabled on 2.4 GHz

hostapd_set_freq_param() rejected the 20 MHz channel case with
vht_enabled due to the existing validation step including only 5 GHz (to
be more exact, only >= 5000 MHz). While the behavior may not be fully
defined for 2.4 GHz, we can enable this based on driver capability
advertisement to fix automatic VHT selection for P2P use cases.
mac80211_hwsim advertises VHT for 2.4 GHz band and that resulted in
failures when trying to start GO on that band with vht=1 parameter.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Add preliminary version of DFS test cases
Jouni Malinen [Sun, 3 Nov 2013 19:57:39 +0000 (21:57 +0200)]
tests: Add preliminary version of DFS test cases

These are still disabled by default since they require mac80211_hwsim
changes that are not yet in the upstream kernel and because the test
cases do not fully work yet. Anyway, they are quite convenient for
development use, so good to have them available in the main repository.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoDFS: Do not use cf1 to override freq for 20 MHz channels
Jouni Malinen [Sun, 3 Nov 2013 19:50:48 +0000 (21:50 +0200)]
DFS: Do not use cf1 to override freq for 20 MHz channels

NL80211_ATTR_CENTER_FREQ1 is defined to be used for anything but 20 MHz
bandwidth, so it could be unset for 20 MHz channels. Do not use it to
override center frequency from NL80211_ATTR_WIPHY_FREQ (if available)
for 20 MHz channels to avoid clearing frequency.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoDocument AP mode startup functions
Jouni Malinen [Sun, 3 Nov 2013 19:16:33 +0000 (21:16 +0200)]
Document AP mode startup functions

This provides some more details on how interfaces and BSSes are
initialized during hostapd startup.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add a test case for HT40 co-ex scan
Jouni Malinen [Sun, 3 Nov 2013 19:00:49 +0000 (21:00 +0200)]
tests: Add a test case for HT40 co-ex scan

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add test cases for automatic channel selection
Jouni Malinen [Sun, 3 Nov 2013 18:50:39 +0000 (20:50 +0200)]
tests: Add test cases for automatic channel selection

This extends the Hostapd class to support monitor interface events and
STATUS command similarly to the WpaSupplicant class so that internal
hostapd state can be verified in more detail.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add test case for multi-BSS configuration file
Jouni Malinen [Sun, 3 Nov 2013 18:20:50 +0000 (20:20 +0200)]
tests: Add test case for multi-BSS configuration file

Verify that a single configuration file can be used to initiate multiple
BSSes in hostapd and that these BSSes can then be dynamically removed.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Use correct wpa_printf verbosity level for message
Jouni Malinen [Sun, 3 Nov 2013 18:12:36 +0000 (20:12 +0200)]
hostapd: Use correct wpa_printf verbosity level for message

This configuration file message is informative and MSG_INFO should be
used instead of MSG_ERROR.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Fix multi-BSS configuration file parsing regression
Jouni Malinen [Sun, 3 Nov 2013 18:01:50 +0000 (20:01 +0200)]
hostapd: Fix multi-BSS configuration file parsing regression

Commit ebd79f07c47b02b71c0ac7744a6a94a2bae92fcf broke parsing of
configuration files that use the bss parameter to specify another BSS
entry. This resulted in crashing the process with NULL pointer
dereference since the new hostapd_config::bss design requires this
function to allocate a new hostapd_bss_config structure.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Use start_ctrl_iface() from hostapd_add_iface()
Jouni Malinen [Sun, 3 Nov 2013 17:11:38 +0000 (19:11 +0200)]
hostapd: Use start_ctrl_iface() from hostapd_add_iface()

Better share the same function for initializing control interface from
the two possible paths that can add a new interface to hostapd.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoFix AP mode QoS Map configuration to be per-BSS
Jouni Malinen [Sun, 3 Nov 2013 17:05:09 +0000 (19:05 +0200)]
Fix AP mode QoS Map configuration to be per-BSS

This is a per-BSS configuration parameter and as such, needs to be
configured to the driver from hostapd_setup_bss() instead of
hostapd_driver_init().

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoDFS: Convert hostapd_data use to hostapd_iface
Jouni Malinen [Sun, 3 Nov 2013 16:48:03 +0000 (18:48 +0200)]
DFS: Convert hostapd_data use to hostapd_iface

DFS operations are specific to the interface (radio/wiphy), not BSS
(netdev/vif), so hostapd_iface is the appropriate element to use in
them.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Fill in phyname automatically
Jouni Malinen [Sun, 3 Nov 2013 16:20:28 +0000 (18:20 +0200)]
hostapd: Fill in phyname automatically

If per-BSS configuration enabling did not provide a phy name, iface->phy
was left empty. It can be helpful to set this up automatically, so fill
that when initializing the interface.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Add ctrl_iface STATUS command
Jouni Malinen [Sun, 3 Nov 2013 16:13:14 +0000 (18:13 +0200)]
hostapd: Add ctrl_iface STATUS command

This can be used to fetch runtime information about hostapd interfaces.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoOptimize 40 MHz HT co-ex scan on AP
Jouni Malinen [Sun, 3 Nov 2013 15:43:40 +0000 (17:43 +0200)]
Optimize 40 MHz HT co-ex scan on AP

Only scan the affected channels instead of all enabled channels when
determining whether the primary and secondary channel for HT40 needs to
be swapped. This speed up HT40 setup considerably on 5 GHz band.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Add AP-ENABLED/DISABLED ctrl_iface events
Jouni Malinen [Sun, 3 Nov 2013 15:30:49 +0000 (17:30 +0200)]
hostapd: Add AP-ENABLED/DISABLED ctrl_iface events

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Track interface state
Jouni Malinen [Sun, 3 Nov 2013 15:25:05 +0000 (17:25 +0200)]
hostapd: Track interface state

The new hostapd_iface::state enum is used to track the current state of
the hostapd interface (a radio/wiphy).

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Wait for channel list update after country code change
Jouni Malinen [Sun, 3 Nov 2013 14:33:11 +0000 (16:33 +0200)]
hostapd: Wait for channel list update after country code change

If hostapd is requested to set the country code and the previous country
code differs from the new one, the channel list information from the
driver may change. This change may not be instant, so wait for an
EVENT_CHANNEL_LIST_CHANGED event before continuing interface setup with
fetching of the channel list information. This fixes issues where the
selected channel is not available based on the previous regulatory data
and update through CRDA takes some time.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Add ctrl_iface events for ACS
Jouni Malinen [Sun, 3 Nov 2013 13:59:53 +0000 (15:59 +0200)]
hostapd: Add ctrl_iface events for ACS

These give status information to external observers from automatic
channel selection operations.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Move ctrl_iface initialization to happen earlier
Jouni Malinen [Sun, 3 Nov 2013 13:47:01 +0000 (15:47 +0200)]
hostapd: Move ctrl_iface initialization to happen earlier

Channel determination may take considerable time when ACS or DFS is
used, so it is useful to be able to observe this process through the
control interface. Move the initialization of the control interfaces to
happen before channel determination so that this can be achieved.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Remove hostapd_interface_init2()
Jouni Malinen [Sun, 3 Nov 2013 11:34:35 +0000 (13:34 +0200)]
hostapd: Remove hostapd_interface_init2()

This was an unnecessary wrapper functions for calling two functions from
a single place in the code. It is cleaner to just call those two
functions directly.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Simplify interface initialization
Jouni Malinen [Sun, 3 Nov 2013 11:28:17 +0000 (13:28 +0200)]
hostapd: Simplify interface initialization

Use hostapd_interface_init2() for all interfaces instead of the
previously used different paths for per-interface-config and
per-BSS-config cases. This moves the calls to hostapd_driver_init() and
hostapd_setup_interface() to happen after all configuration files have
been read.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add an EAP-TLS test case
Jouni Malinen [Sun, 3 Nov 2013 10:25:44 +0000 (12:25 +0200)]
tests: Add an EAP-TLS test case

This fixes the user.key file (incorrect key was copied previously) and
adds a test case for EAP-TLS with WPA2-Enterprise.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add more EAP test cases
Jouni Malinen [Sun, 3 Nov 2013 09:58:38 +0000 (11:58 +0200)]
tests: Add more EAP test cases

This increases EAP method coverage for WPA2-Enterprise to include
EAP-pwd, EAP-GPSK, EAP-SAKE, EAP-EKE, EAP-IKEv2, EAP-PAX, and EAP-PSK.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoDFS: Add control interface events for various DFS events
Jouni Malinen [Sat, 2 Nov 2013 19:01:47 +0000 (21:01 +0200)]
DFS: Add control interface events for various DFS events

These can be useful for external programs that track the current state
of the AP.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Add control interface test commands for radar detection
Jouni Malinen [Sat, 2 Nov 2013 18:44:58 +0000 (20:44 +0200)]
hostapd: Add control interface test commands for radar detection

If hostapd is build with CONFIG_TESTING_OPTIONS=y, the RADAR control
interface command can be used to test hostapd behavior on arbitrary
driver radar events.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agonl80211: Verify radar event attributes exist before using them
Jouni Malinen [Sat, 2 Nov 2013 18:39:57 +0000 (20:39 +0200)]
nl80211: Verify radar event attributes exist before using them

While these attributes may be expected to be present always, this needs
to be verified within driver_nl80211.c since we cannot depend on the
kernel/driver working correctly.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add run-tests.py --no-reset
Jouni Malinen [Sat, 2 Nov 2013 18:38:40 +0000 (20:38 +0200)]
tests: Add run-tests.py --no-reset

This can be used to request the previously used default behavior where
the devices are not stopped at the end of a test case if a single test
case is run.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: hostapd behavior on dynamic addition of invalid config
Jouni Malinen [Sat, 2 Nov 2013 17:57:35 +0000 (19:57 +0200)]
tests: hostapd behavior on dynamic addition of invalid config

Verify that hostapd handles ENABLE command on invalid configuration
correctly and allows the configuration to be fixed or the interface to
be removed.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Fix ENABLE failure to not remove interface
Jouni Malinen [Sat, 2 Nov 2013 17:49:01 +0000 (19:49 +0200)]
hostapd: Fix ENABLE failure to not remove interface

Previously, ENABLE command ended up freeing the hostapd_iface context on
initialization failures, but did not even remove the interface from the
list of available interfaces. This resulted in use of freed memory with
any following operation on the same interface. In addition, removing the
interface on initialization failure does not seem like the best
approach. Fix both of these issues by leaving the interface instance in
memory, but in disabled state so that the configuration can be fixed and
ENABLE used again to enable the interface or REMOVE used to remove the
interface.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add test cases for SAE
Jouni Malinen [Sat, 2 Nov 2013 16:10:17 +0000 (18:10 +0200)]
tests: Add test cases for SAE

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoSAE: Fix group selection
Jouni Malinen [Sat, 2 Nov 2013 16:07:49 +0000 (18:07 +0200)]
SAE: Fix group selection

Number of regressions had shown up in wpa_supplicant implementation of
SAE group selection due to different integer array termination (-1 in
hostapd, 0 in wpa_supplicant) being used for SAE groups. The
default_groups list did not seem to use any explicit termination value.
In addition, the sae_group_index was not cleared back to 0 properly
whenever a new SAE session was started.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Clean up output formatting with str.format()
Jouni Malinen [Sat, 2 Nov 2013 15:07:13 +0000 (17:07 +0200)]
tests: Clean up output formatting with str.format()

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoReplace unnecessary UTF-8 characters with ASCII versions
Jouni Malinen [Sat, 2 Nov 2013 14:01:32 +0000 (16:01 +0200)]
Replace unnecessary UTF-8 characters with ASCII versions

There is no need for using UTF-8 in these files when perfectly fine
ASCII versions of these characters exist.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Remove trailing whitespace
Jouni Malinen [Sat, 2 Nov 2013 13:40:36 +0000 (15:40 +0200)]
tests: Remove trailing whitespace

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Rename stop-wifi.sh to stop.sh
Jouni Malinen [Sat, 2 Nov 2013 13:39:25 +0000 (15:39 +0200)]
tests: Rename stop-wifi.sh to stop.sh

This makes script naming more consistent with start.sh.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Simplify test_ap_bss_add_remove implementation
Jouni Malinen [Sat, 2 Nov 2013 11:53:23 +0000 (13:53 +0200)]
tests: Simplify test_ap_bss_add_remove implementation

Use lists and loops to avoid duplicated operations.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Use a helper function to rename wpa_supplicant/hostapd logs
Jouni Malinen [Sat, 2 Nov 2013 11:04:06 +0000 (13:04 +0200)]
tests: Use a helper function to rename wpa_supplicant/hostapd logs

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoConvert perror/printf calls to wpa_printf
Jouni Malinen [Sat, 2 Nov 2013 10:51:30 +0000 (12:51 +0200)]
Convert perror/printf calls to wpa_printf

This makes debug and error logging more consistent and allows them to be
directed to a file more easily.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Always write run-tests.py debug logs a file
Jouni Malinen [Sat, 2 Nov 2013 10:20:59 +0000 (12:20 +0200)]
tests: Always write run-tests.py debug logs a file

Remove the -l command like option from run-tests.py and always enable
writing of debug level logs to files. The stdout debug verbosity is
controlled independently of the debug log files.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Split hostapd debug log into per test case files
Jouni Malinen [Sat, 2 Nov 2013 09:53:38 +0000 (11:53 +0200)]
tests: Split hostapd debug log into per test case files

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Accept RELOG from global control interface
Jouni Malinen [Sat, 2 Nov 2013 09:52:35 +0000 (11:52 +0200)]
hostapd: Accept RELOG from global control interface

This makes it easier to recycle log file (-f) when no active interface
is in use.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohostapd: Use wpa_printf() for hostapd_logger() to stdout
Jouni Malinen [Sat, 2 Nov 2013 09:32:19 +0000 (11:32 +0200)]
hostapd: Use wpa_printf() for hostapd_logger() to stdout

This allows log-to-file (-f command line option) to be used to redirect
these messages to the same file with all the other stdout debug.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Ignore old scan results in test_grpform_pbc
Jouni Malinen [Sat, 2 Nov 2013 09:27:16 +0000 (11:27 +0200)]
tests: Ignore old scan results in test_grpform_pbc

This is needed to avoid invalid PBC session overlap detection when
the previous test case used active PBC mode and the old BSS entry
in cfg80211 may still be valid when starting the next test case.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Use single channel scans to speed up test cases
Jouni Malinen [Sat, 2 Nov 2013 09:22:16 +0000 (11:22 +0200)]
tests: Use single channel scans to speed up test cases

A full scan in these specific test cases does not add anything to the
coverage, so use a single channel scan for the station connection to
remove undesired extra time needed for a full scan.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add run-tests.py --shuffle-test
Jouni Malinen [Sat, 2 Nov 2013 08:30:37 +0000 (10:30 +0200)]
tests: Add run-tests.py --shuffle-test

This optional argument can be used to randomize the order in which the
test cases are run. This can provide more coverage on testing
interactions of common use cases in various different sequences. Such
issues have already been found even with the fixed order of test cases,
but being able to reorder the tests makes this more efficient.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohwsim tests: Add build script
Johannes Berg [Thu, 31 Oct 2013 15:08:01 +0000 (16:08 +0100)]
hwsim tests: Add build script

This is easier than to copy/paste from the README. We may
want to extend it later to change the .config for some
common differences between systems (e.g., libnl/libbfd).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
10 years agohwsim tests: Prefill database in VM tests
Johannes Berg [Thu, 31 Oct 2013 15:05:11 +0000 (16:05 +0100)]
hwsim tests: Prefill database in VM tests

In some cases, e.g., with the VM tests if the VM crashes, it
can be useful to know which tests should have run but didn't
(or didn't finish). In order to catch these more easily, add
an option to prefill the database with all tests at the very
beginning of the testing (in a new NOTRUN state) and use the
option in the VM tests.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Create results database in VM tests
Johannes Berg [Thu, 31 Oct 2013 14:36:44 +0000 (15:36 +0100)]
hwsim tests: Create results database in VM tests

Create a results.db in the output directory when running
the tests in a VM. To make that easier, create the tables
in the python script if they don't exist.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Refactor test results reporting
Johannes Berg [Thu, 31 Oct 2013 14:02:50 +0000 (15:02 +0100)]
hwsim tests: Refactor test results reporting

Refactor the test reporting to treat the different results
(success/skip/failure) identically. This makes the timing
seem a bit longer, but cleans up the code which will allow
for adding more checks (e.g., on the captured data files)
later.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Allow setting KERNEL and KVMARGS
Johannes Berg [Thu, 31 Oct 2013 13:22:20 +0000 (14:22 +0100)]
hwsim tests: Allow setting KERNEL and KVMARGS

Rather than just having KERNELDIR, allow setting KERNEL directly.
Also remove the -s option that prevents running multiple machines
at the same time, but add a KVMARGS= variable that can be used to
restore that if needed.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agoP2P: Clear pending group formation data on group removal
Jouni Malinen [Fri, 1 Nov 2013 08:31:55 +0000 (10:31 +0200)]
P2P: Clear pending group formation data on group removal

It was possible for the wpa_s->show_group_started and wpa_s->go_params
to be left set when a P2P group was removed before group formation had
completed. In case a separate P2P group interface was not used, this
could rsult in all future scans using the hardcoded DIRECT-* SSID and as
such, not find the network they were trying to find. Fix this by
clearing these P2P parameters on group removal.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agoP2P: Debug print reason for specific SSID for scan
Jouni Malinen [Fri, 1 Nov 2013 08:30:50 +0000 (10:30 +0200)]
P2P: Debug print reason for specific SSID for scan

It can be useful to see whether the specific P2P SSID was used for scan
based on p2p_in_provisioning or show_group_started when debugging issues
where this case shows up unexpectedly.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Test dynamic BSS addition/removal
Jouni Malinen [Thu, 31 Oct 2013 15:28:43 +0000 (17:28 +0200)]
tests: Test dynamic BSS addition/removal

test_ap_bss_add_remove verifies hostapd behavior when BSSes are
added/removed in multi-BSS configuration.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agoAllow add-BSS operation to re-use existing netdev
Jouni Malinen [Thu, 31 Oct 2013 17:41:42 +0000 (19:41 +0200)]
Allow add-BSS operation to re-use existing netdev

When removing and re-adding the first wlan# netdev to hostapd
dynamically, the netdev is already present and should not be removed and
re-added to maintain its state as not-added-by-hostapd so that it does
not get removed automatically.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agohostapd: Allow a single BSS to be removed from an interface
Jouni Malinen [Thu, 17 Oct 2013 15:56:30 +0000 (18:56 +0300)]
hostapd: Allow a single BSS to be removed from an interface

The global control interface command "REMOVE <ifname>" can now be used
to remove a single virtual interface (BSS) without affecting other
virtual interfaces on the same radio.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agohostapd: Allow a single BSS to be added to an interface
Kyeyoon Park [Wed, 23 Oct 2013 07:10:22 +0000 (00:10 -0700)]
hostapd: Allow a single BSS to be added to an interface

The global control interface command "ADD
bss_config=<phyname>:<config file>" can now be used to add a single
virtual interface (BSS) to an interface.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agohostapd: Make hostapd_interface_init_bss() available externally
Kyeyoon Park [Tue, 29 Oct 2013 14:29:49 +0000 (16:29 +0200)]
hostapd: Make hostapd_interface_init_bss() available externally

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agohostapd: Make hostapd_init() available externally
Kyeyoon Park [Tue, 29 Oct 2013 14:27:30 +0000 (16:27 +0200)]
hostapd: Make hostapd_init() available externally

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agohostapd: Allow the first BSS in a multi-BSS setup to be removed
Kyeyoon Park [Wed, 30 Oct 2013 23:34:32 +0000 (16:34 -0700)]
hostapd: Allow the first BSS in a multi-BSS setup to be removed

This moves the vif added check from core hostapd to the driver wrapper
(only driver_nl80211.c uses this) and reorders operations a bit to allow
the first BSS (vif) to be removed from a multi-BSS setup.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agonl80211: Make wpa_driver_nl80211_data::first_bss pointer
Kyeyoon Park [Wed, 30 Oct 2013 00:41:39 +0000 (17:41 -0700)]
nl80211: Make wpa_driver_nl80211_data::first_bss pointer

This is needed to allow the first BSS to be removed and replaced by the
next one in the list.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agonl80211: Fix monitor interface reference counting
Jouni Malinen [Thu, 31 Oct 2013 19:55:17 +0000 (21:55 +0200)]
nl80211: Fix monitor interface reference counting

The first user of monitor interface was not counted and that could
result in the monitor interface getting removed if the initial interface
was removed from a multi-BSS setup.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agonl80211: Add a debug print for DEL_BEACON
Jouni Malinen [Thu, 31 Oct 2013 19:56:40 +0000 (21:56 +0200)]
nl80211: Add a debug print for DEL_BEACON

This is quite helpful in debugging beaconing issues.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agohostapd: Fix error path in hostapd_add_iface()
Kyeyoon Park [Tue, 29 Oct 2013 14:32:23 +0000 (16:32 +0200)]
hostapd: Fix error path in hostapd_add_iface()

Incorrect count variable was used in freeing up the BSS data.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agoACS: Do not get stuck while failing to do a subsequent scan
Helmut Schaa [Thu, 31 Oct 2013 12:54:55 +0000 (14:54 +0200)]
ACS: Do not get stuck while failing to do a subsequent scan

Return control flow to hostapd by calling hostapd_acs_completed()
if requesting a scan from the underlying device fails.

Signed-hostapd: Helmut Schaa <helmut.schaa@googlemail.com>

10 years agoDFS: Add support for multi-BSS
Michal Kazior [Thu, 31 Oct 2013 12:51:44 +0000 (14:51 +0200)]
DFS: Add support for multi-BSS

If radar was detected single BSS is notified about it. This caused only
that single BSS to be stopped and restarted. However, due to nl80211
interface combinations the BSS was not started on a new channel and
other BSSes remained operating on the old channel.

The downside is that hostapd_disable_iface() causes deauth frames to be
sent. This is undesired but on the other hand it doesn't make sense to
create workarounds that imitate CSA's 'block tx'. For proper Tx
quiescing CSA should be properly implemented.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
10 years agoDFS: Reset cac_started properly
Michal Kazior [Thu, 31 Oct 2013 12:49:38 +0000 (14:49 +0200)]
DFS: Reset cac_started properly

If CAC was stopped but hostapd was not terminated cac_started would
remain set to 1.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
10 years agoDFS: Sanitize channel availability checks
Michal Kazior [Thu, 31 Oct 2013 12:48:34 +0000 (14:48 +0200)]
DFS: Sanitize channel availability checks

Fixes corner case of holes in channel list and simplifies availability
checks.

Signed-hostap: Michal Kazior <michal.kazior@tieto.com>

10 years agoDFS: Fix HT40/VHT calculation
Michal Kazior [Thu, 31 Oct 2013 12:46:09 +0000 (14:46 +0200)]
DFS: Fix HT40/VHT calculation

Decouple HT/VHT offset/center-freq calculations from channel lookup.
This will be necessary for further improvements on the DFS codebase.

Signed-hostap: Michal Kazior <michal.kazior@tieto.com>

10 years agotests: Remove separate error/failed text file
Jouni Malinen [Thu, 31 Oct 2013 12:39:09 +0000 (14:39 +0200)]
tests: Remove separate error/failed text file

The new sqlite database for results deprecated this.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Remove separate results text file
Jouni Malinen [Thu, 31 Oct 2013 12:36:26 +0000 (14:36 +0200)]
tests: Remove separate results text file

The new sqlite database for results deprecated this.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Use a symlink for default LOGDIR between scripts
Jouni Malinen [Thu, 31 Oct 2013 12:27:57 +0000 (14:27 +0200)]
tests: Use a symlink for default LOGDIR between scripts

This allows run-tests.py to use the same logs/<date> default logdir as
start.sh which is quite convenient for manual test runs.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Split wpa_supplicant debug logs into per test case files
Jouni Malinen [Thu, 31 Oct 2013 11:09:14 +0000 (13:09 +0200)]
tests: Split wpa_supplicant debug logs into per test case files

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Split run-tests.py logger info into per test case files
Jouni Malinen [Thu, 31 Oct 2013 10:46:42 +0000 (12:46 +0200)]
tests: Split run-tests.py logger info into per test case files

The run-tests.py -l argument does not take an argument value anymore.
Instead, debug output is directed to a separate file <test>.log for each
test case.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Remove the 'test_' prefix from test module names
Jouni Malinen [Thu, 31 Oct 2013 09:47:43 +0000 (11:47 +0200)]
tests: Remove the 'test_' prefix from test module names

This is unnecessary extra complexity for user, so use the 'test_' prefix
only internally within the python scripts and file names.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Remove the 'test_' prefix from test names
Jouni Malinen [Thu, 31 Oct 2013 09:43:45 +0000 (11:43 +0200)]
tests: Remove the 'test_' prefix from test names

This is unnecessary extra complexity for user and reports, so use the
'test_' prefix only internally within the python scripts.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Replace tcpdump with wlantest file write
Jouni Malinen [Thu, 31 Oct 2013 09:35:02 +0000 (11:35 +0200)]
tests: Replace tcpdump with wlantest file write

There is no need to run a separate tcpdump process to capture frames
from hwsim0 since wlantest is already doing that can write the results
to a file.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Remove last-debug creation
Jouni Malinen [Thu, 31 Oct 2013 09:26:52 +0000 (11:26 +0200)]
tests: Remove last-debug creation

This file was used for adding debug info into the buildbot logs. The new
sqlite database-based design will replace that, so there is no need to
create last-debug and getting rid of it will make it easier to split the
run log into per-test case files.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agotests: Fix sqlite run column to be an integer
Jouni Malinen [Thu, 31 Oct 2013 08:43:02 +0000 (10:43 +0200)]
tests: Fix sqlite run column to be an integer

Commit 781b65cfbb444e2a479f2ea282879b5678235413 ended up accidentally
changing this from an integer to a string. Fix this by not converting
the variable into a string.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

10 years agohwsim tests: Add scripts to run in a VM
Johannes Berg [Wed, 30 Oct 2013 23:23:57 +0000 (00:23 +0100)]
hwsim tests: Add scripts to run in a VM

Instead of running on the host, it can be useful to run in a
VM, particularly to test kernel rather than userspace changes,
so add a few scripts that allow doing so easily.

The basic idea is that the VM kernel is the same architecture
as the host kernel, so the host's root filesystem can be used
(in read-only mode) to run everything. Only a log filesystem
is mounted read-write and will get all the test output.

The kernel console output is collected to a special 'console'
file in the logs directory and kernel crashes are detected.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Silence chown warnings
Johannes Berg [Wed, 30 Oct 2013 22:16:05 +0000 (23:16 +0100)]
hwsim tests: Silence chown warnings

If running in a VM with the logs going to a host filesystem
chown isn't actually possible, silence any warnings from it.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Silence modprobe warnings
Johannes Berg [Wed, 30 Oct 2013 22:14:55 +0000 (23:14 +0100)]
hwsim tests: Silence modprobe warnings

If module loading isn't enabled (e.g., in VM tests) then
don't try to load/unload the modules.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Reset at the end of a test
Johannes Berg [Wed, 30 Oct 2013 21:53:29 +0000 (22:53 +0100)]
hwsim tests: Reset at the end of a test

Resetting at the beginning causes the reset logging/tracing
data to leak from the previous test into the next, and the
last one being missed at all - reset at the end of each run
instead. Also reset before all tests just in case running a
test actually crashed the python script.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Allow collecting dmesg
Johannes Berg [Wed, 30 Oct 2013 21:50:56 +0000 (22:50 +0100)]
hwsim tests: Allow collecting dmesg

In addition to tracing, allow collecting dmesg. There's no
provision for actually looking at it and finding problems
in it yet though.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Pass --logdir to run-tests.py
Johannes Berg [Wed, 30 Oct 2013 21:37:15 +0000 (22:37 +0100)]
hwsim tests: Pass --logdir to run-tests.py

Instead of passing the log directory for each option
(-l, -r, -e, and -T) pass it once and make the other
options just take the filename (optionally, even).

This will also make it easier to extend later.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Move logging into timestamped subdirectory
Johannes Berg [Wed, 30 Oct 2013 21:08:10 +0000 (22:08 +0100)]
hwsim tests: Move logging into timestamped subdirectory

Instead of logging many files called "<timestamp>-*", log into
a new "<timestamp>/*" in the logs/ subdirectory and only put
the last-debug file into logs/. If a LOGDIR is specified in the
environment, instead just put everything into that directory
(so the caller should make sure to give it a timestamp or so)
and skip the creation of last-debug entirely.

Also clean up a bit and pass the LOGDIR from run-all.sh to
start.sh rather than having start.sh create the timestamp and
run-all.sh detect the latest one when having run start.sh.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Allow run-tests.py to start tracing
Johannes Berg [Wed, 30 Oct 2013 20:05:24 +0000 (21:05 +0100)]
hwsim tests: Allow run-tests.py to start tracing

In order to get tracing per test, allow run-tests.py to start
and stop tracing per test case. This is implemented using a
python 'with' context so it starts/stops automatically at the
right spots.

Instead of starting global tracing, also use it from run-all.sh
and put the trace files into the log dir.

Note that this only works right if you use a separate log dir
for all test runs as the trace files aren't timestamped.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohostapd: Add -T Linux tracing option
Johannes Berg [Wed, 30 Oct 2013 18:29:58 +0000 (19:29 +0100)]
hostapd: Add -T Linux tracing option

Just like wpa_supplicant, give hostapd the -T option to
send all debug messages into the Linux tracing buffer.
Enable this option for hwsim test builds by default.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Pass run-all arguments on
Johannes Berg [Wed, 30 Oct 2013 18:01:56 +0000 (19:01 +0100)]
hwsim tests: Pass run-all arguments on

Allow run-all to pass on extra arguments from the command
line that aren't built by the script itself.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agohwsim tests: Pass commit as an argument
Johannes Berg [Wed, 30 Oct 2013 19:01:11 +0000 (21:01 +0200)]
hwsim tests: Pass commit as an argument

Rather than saving the current commit to a file, pass it
as an argument to run-tests.py.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agotests: Silence chmod errors
Jouni Malinen [Wed, 30 Oct 2013 17:55:00 +0000 (19:55 +0200)]
tests: Silence chmod errors

These will fail if used on a readonly file system and are only needed
for valgrind runs.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Refactor run-all.sh
Johannes Berg [Wed, 30 Oct 2013 17:49:12 +0000 (19:49 +0200)]
tests: Refactor run-all.sh

Reuse the code rather than duplicating the implementation
of starting the tests. To make that easier, allow passing
multiple modules with -f to run-tests.py.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

10 years agotests: Reduce duplication in startup code
Johannes Berg [Wed, 30 Oct 2013 17:43:59 +0000 (19:43 +0200)]
tests: Reduce duplication in startup code

Instead of hard-coding four different cases, use variables
(and printf) to reduce the duplication.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>