mech_eap.git
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>

10 years agotests: Use argparse module with hwsim
Johannes Berg [Wed, 30 Oct 2013 17:28:22 +0000 (19:28 +0200)]
tests: Use argparse module with hwsim

Instead of re-implementing a command-line parser, use the
argparse module.

The only real change (I hope) is that the test module must
now be given to the -f option without the .py suffix.

Also, --help now works, and if a test module/test name is
given that doesn't exist, the valid list is printed.

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

10 years agotests: Import sqlite3 only if used
Johannes Berg [Wed, 30 Oct 2013 17:20:07 +0000 (19:20 +0200)]
tests: Import sqlite3 only if used

Might help some systems that don't have/need it.

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

10 years agotests: Use proper SQL construction in hwsim test reporting
Johannes Berg [Wed, 30 Oct 2013 17:19:07 +0000 (19:19 +0200)]
tests: Use proper SQL construction in hwsim test reporting

Don't construct SQL strings on the fly but instead use the
argument placeholders.

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

10 years agotests: Allow specifying LOGDIR for hwsim scripts
Johannes Berg [Wed, 30 Oct 2013 13:55:58 +0000 (15:55 +0200)]
tests: Allow specifying LOGDIR for hwsim scripts

Instead of hardcoding logs/, allow putting LOGDIR into
the environment. This helps run tests in a VM where the
rootfs might be mounted read-only.

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

10 years agoSet GTK rekey offload information after initial group key handshake
Sunil Dutt [Wed, 30 Oct 2013 09:41:40 +0000 (11:41 +0200)]
Set GTK rekey offload information after initial group key handshake

The GTK rekey offload information was sent to the driver immediately
after the 4-way handshake which ended up being before the initial group
key exchange in the case of WPA (v1). This could result in even that
initial GTK handshake being offloaded and wpa_supplicant being left in
WPA_GROUP_HANDSHAKE state. Fix this by postponing the operation to
happen only after the full set of initial EAPOL-Key exchanges have been
completed (i.e., in the existing location for WPA2 and a after the group
key handshake for WPA).

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

10 years agotests: Enable verbose logger_stdout debug in hostapd
Jouni Malinen [Tue, 29 Oct 2013 22:31:14 +0000 (00:31 +0200)]
tests: Enable verbose logger_stdout debug in hostapd

This makes hostapd debug logs more helpful for debugging.

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

10 years agonl80211: Add debug prints for NL80211_CMD_SET_STATION
Jouni Malinen [Tue, 29 Oct 2013 22:37:47 +0000 (00:37 +0200)]
nl80211: Add debug prints for NL80211_CMD_SET_STATION

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

10 years agoUpdate regulatory change to all virtual interface for the phy
Vinay Krishna Eranna [Tue, 29 Oct 2013 21:03:23 +0000 (23:03 +0200)]
Update regulatory change to all virtual interface for the phy

wpas_p2p_setup_channels function uses the per interface information
(wpa_s->hw.modes) for setting up the available channel list for P2P
operation, but if a separate P2P interface is used (e.g., p2p0 on
Android), the wpa_s instance for that interface may not get an updated
channel list. This can result in some operations, like "P2P_SET
disallow_freq", using old channel list information (e.g., world roaming
information with passive-scan/no-ibss flags) which was initialized
during the start-up. This could result in P2P functionality using
conflicting or obsolete channel information.

To resolve this issue, update channel list information on regulatory
change events to all of the virtual interfaces sharing the same phy for
which the event is received.

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

10 years agotests: Add a test for dynamic hostapd config change
Jouni Malinen [Tue, 29 Oct 2013 15:14:02 +0000 (17:14 +0200)]
tests: Add a test for dynamic hostapd config change

test_ap_change_ssid verifies that the SET and RELOAD control interface
commands can be used to change the SSID of a hostapd-controlled WPA2-PSK
AP, i.e., for a case where the PSK needs to be derived again after the
SSID change.

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

10 years agohostapd: Validate configuration parameters on RELOAD command
Jouni Malinen [Tue, 29 Oct 2013 14:42:39 +0000 (16:42 +0200)]
hostapd: Validate configuration parameters on RELOAD command

Reject RELOAD control interface command if the dynamic configuration
changes have resulted into a state where the configuration is invalid.

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

10 years agohostapd: Move generic configuration functions into src/ap
Jouni Malinen [Tue, 29 Oct 2013 14:40:12 +0000 (16:40 +0200)]
hostapd: Move generic configuration functions into src/ap

This allows the configuration validation routines to be called from
src/ap/*.c for runtime updates of configuration without reprocessing the
full configuration file.

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

10 years agohostapd: Allow per-BSS (vif) configuration files
Jouni Malinen [Thu, 17 Oct 2013 14:41:26 +0000 (17:41 +0300)]
hostapd: Allow per-BSS (vif) configuration files

This provides a new option for configuring multiple virtual interfaces
(BSS) that share a single radio. The new command line parameter
-b<phyname>:<config file name> is used to define one or more virtual
interfaces for each PHY. The first such entry for a new PHY is used to
initialize the interface structure and all consecutive parameters that
have the same PHY name will be added as virtual BSS entries to that
interface. The radio parameters in the configuration files have to be
identical.

This can be used as an alternative for the bss=<ifname> separator and
multiple BSSes in a single configuration file design while still
allowing hostapd to control the PHY (struct hostapd_iface) as a group of
virtual interfaces (struct hostapd_data) so that common radio operations
like OLBC detection and HT40 co-ex scans can be done only once per real
radio.

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

10 years agohostapd: Make hostapd_config::bss array of pointers
Jouni Malinen [Tue, 29 Oct 2013 14:23:23 +0000 (16:23 +0200)]
hostapd: Make hostapd_config::bss array of pointers

This makes it more convenient to move BSS configuration entries between
struct hostapd_config instances to clean up per-BSS configuration file
design.

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

10 years agohostapd: Force PSK to be derived again on BSS reload
Jouni Malinen [Tue, 29 Oct 2013 14:55:15 +0000 (16:55 +0200)]
hostapd: Force PSK to be derived again on BSS reload

This may be needed if the wpa_psk information for previously derived
from passphrase and either the SSID or the passphrase has changed.

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

10 years agohostapd: Reuse hostapd_clear_old() for RELOAD command
Jouni Malinen [Tue, 29 Oct 2013 14:09:34 +0000 (16:09 +0200)]
hostapd: Reuse hostapd_clear_old() for RELOAD command

Instead of duplicating the functionality and missing changes (like the
hostapd_broadcast_wep_clear() call), use the hostapd_clear_old()
function that was already used for the similar case with configuration
file reload.

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

10 years agoAndroid: Fix ARRAY_SIZE() compilation
Dmitry Shmidt [Tue, 29 Oct 2013 12:40:15 +0000 (14:40 +0200)]
Android: Fix ARRAY_SIZE() compilation

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
10 years agotests: Add Hotspot 2.0 test cases for connecting with username
Jouni Malinen [Tue, 29 Oct 2013 12:38:31 +0000 (14:38 +0200)]
tests: Add Hotspot 2.0 test cases for connecting with username

The test_ap_hs20_username* test cases verify that a username/password
credential can be used for Hotspot 2.0 connection and that the network
type is reported correctly.

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

10 years agotests: Add external_sim test cases with roaming network
Jouni Malinen [Tue, 29 Oct 2013 12:23:31 +0000 (14:23 +0200)]
tests: Add external_sim test cases with roaming network

test_ap_hs20_ext_sim_roaming is otherwise identical with
test_ap_hs20_ext_sim, but the network is operated by a roaming partner.

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

10 years agotests: Add helper functions for Hotspot 2.0 test cases
Jouni Malinen [Tue, 29 Oct 2013 12:20:29 +0000 (14:20 +0200)]
tests: Add helper functions for Hotspot 2.0 test cases

These make it easier to add new test cases for Interworking network
selection.

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

10 years agotests: Verify that STATUS sp_type is valid for Interworking
Jouni Malinen [Tue, 29 Oct 2013 11:57:33 +0000 (13:57 +0200)]
tests: Verify that STATUS sp_type is valid for Interworking

This verifies that the network type (home/roaming/unknown) is available
and set properly in the test_ap_hs20_ext_sim test case.

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

10 years agoInterworking: Report STATUS:sp_type even if domain is not configured
Jouni Malinen [Tue, 29 Oct 2013 11:51:18 +0000 (13:51 +0200)]
Interworking: Report STATUS:sp_type even if domain is not configured

This allows sp_type={home,roaming,unknown} to be used to determine
network type with SIM-based credentials even if the domain name
parameter is not configured explicitly.

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

10 years agoP2P: Remove compiler warning without CONFIG_IEEE80211N
Jouni Malinen [Sun, 27 Oct 2013 18:46:19 +0000 (20:46 +0200)]
P2P: Remove compiler warning without CONFIG_IEEE80211N

Commit ca9bc5b5666a08c741ddd21c451ecb92aa33a11a added wpas_conf_ap_vht()
as a static function with the caller within CONFIG_IEEE80211N, but the
function outside. This resulted in a compiler warning for wpa_supplicant
AP/P2P builds when CONFIG_IEEE80211N=y was not used. Fix that by using
matching conditional block around the function.

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

10 years agoP2P: Add VHT support
Eliad Peller [Sun, 27 Oct 2013 18:08:36 +0000 (20:08 +0200)]
P2P: Add VHT support

Start GO with VHT support if VHT option was requested
and the appropriate channels are available.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>

10 years agoP2P: Add VHT parameter to P2P operations
Eliad Peller [Sun, 27 Oct 2013 17:46:17 +0000 (19:46 +0200)]
P2P: Add VHT parameter to P2P operations

Add the option to ask for VHT operation similarly to the way ht40 is
configured - either by adding 'vht' param to the relevant p2p_*
commands or by configuring p2p_go_vht=1 in the configuration file.

This patch only adds the configuration option (e.g., via control
interface). The actual handling of the VHT parameter (asking the driver
to use VHT, etc.) will be done by the following patch.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>

10 years agonl80211: Mark VHT 80 MHz channels
Eliad Peller [Sun, 27 Oct 2013 17:37:10 +0000 (19:37 +0200)]
nl80211: Mark VHT 80 MHz channels

Later on, we'll consider the availability of these
channels when starting P2P GO with VHT support.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>

10 years agowpa_supplicant: Add CONFIG_IEEE80211AC
Eliad Peller [Sun, 27 Oct 2013 17:32:03 +0000 (19:32 +0200)]
wpa_supplicant: Add CONFIG_IEEE80211AC

In order to support P2P GO with 11ac support, add CONFIG_IEEE80211AC
config option support to the Makefile.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>

10 years agohostapd: Mask out not-supported VHT capabilities
Eliad Peller [Sun, 27 Oct 2013 17:28:40 +0000 (19:28 +0200)]
hostapd: Mask out not-supported VHT capabilities

Mask the remote VHT capabilities with our own capabilities, similarly
to what is done for HT capabilities.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>

10 years agohostapd: Verify VHT 160/80+80 MHz driver support
Eliad Peller [Sun, 27 Oct 2013 17:17:23 +0000 (19:17 +0200)]
hostapd: Verify VHT 160/80+80 MHz driver support

Make sure the driver supports 160/80+80 MHz VHT capabilities
before trying to configure these channels.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>

10 years agohostapd: Verify VHT capabilities are supported by driver
Eliad Peller [Sun, 27 Oct 2013 17:11:29 +0000 (19:11 +0200)]
hostapd: Verify VHT capabilities are supported by driver

Make sure the defined VHT capabilities are supported by the driver.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>

10 years agoFix some VHT Capabilities definitions
Eliad Peller [Sun, 27 Oct 2013 17:05:58 +0000 (19:05 +0200)]
Fix some VHT Capabilities definitions

VHT_CAP_BEAMFORMEE_STS_MAX, VHT_CAP_SOUNDING_DIMENSION_OFFSET, and
VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT were not defined properly (wrong
name/size). Fix that and update the hostapd.conf parsing accordingly.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>

10 years agohostapd: Fix wrong VHT configuration capabilities flags
Eliad Peller [Sun, 27 Oct 2013 16:59:37 +0000 (18:59 +0200)]
hostapd: Fix wrong VHT configuration capabilities flags

Wrong capabilities flags were used when certain VHT
capabilities were defined.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>

10 years agonl80211: Use max tx power from regulatory domain
Helmut Schaa [Sun, 27 Oct 2013 16:42:16 +0000 (18:42 +0200)]
nl80211: Use max tx power from regulatory domain

Previously the Country element contained the max TX power the local
hardware was capable of. Change this to just use the regulatory limit.

Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
10 years agotests: Do not require wpaspy installation
Johannes Berg [Sun, 27 Oct 2013 16:28:28 +0000 (18:28 +0200)]
tests: Do not require wpaspy installation

Since the scripts must be run from the source directory to
find the tests to run, they can use a relative path to the
wpaspy module instead of requiring it to be installed.

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

10 years agonl80211: Replace perror() and printf() calls with wpa_printf()
Jouni Malinen [Sun, 27 Oct 2013 15:58:12 +0000 (17:58 +0200)]
nl80211: Replace perror() and printf() calls with wpa_printf()

This avoids use of stderr and makes debug messages more consistent.

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

10 years agoWPS: Clear known_wps_freq in addition to after_wps
Jouni Malinen [Sun, 27 Oct 2013 10:56:56 +0000 (12:56 +0200)]
WPS: Clear known_wps_freq in addition to after_wps

Both of these variables can result in optimized WPS scans, so better
clear these more consistently to avoid unexpected single-channel scans.

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

10 years agoInterworking: Clear known_wps_freq for network selection
Jouni Malinen [Sun, 27 Oct 2013 10:55:09 +0000 (12:55 +0200)]
Interworking: Clear known_wps_freq for network selection

This was forgotten from the previous commit which allowed some cases to
trigger single-channel scan incorrectly if an optimized WPS scan had not
yet been completed at the time network selection was started.

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

10 years agotests: Allow test case descriptions to be written into database
Jouni Malinen [Sun, 27 Oct 2013 10:16:36 +0000 (12:16 +0200)]
tests: Allow test case descriptions to be written into database

"run-tests.py -S <db file> -L" can now be used to update a database
table with the current set of test cases and their descriptions.

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

10 years agoInterworking: Force normal scan for network selection
Jouni Malinen [Sun, 27 Oct 2013 09:26:58 +0000 (11:26 +0200)]
Interworking: Force normal scan for network selection

Make sure special optimized scans (like WPS-single-channel or
sched_scan) do not get used during the network selection scan. This
could have been hit in cases where a previous operation has been stopped
in a state where special scan parameters were going to be used.

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

10 years agotests: Add support for sqlite results database
Jouni Malinen [Sat, 26 Oct 2013 22:05:45 +0000 (01:05 +0300)]
tests: Add support for sqlite results database

This is more convenient to use directly than going through the
text-based results file.

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

10 years agotests: Unload cfg80211 on stop-wifi.sh
Jouni Malinen [Sat, 26 Oct 2013 21:08:51 +0000 (00:08 +0300)]
tests: Unload cfg80211 on stop-wifi.sh

cfg80211 may keep some state (e.g., regulatory domain), so make sure
this gets cleared between each full testing cycle.

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

10 years agotests: Add P2P channel selection test cases for group re-invocation
Jouni Malinen [Sat, 26 Oct 2013 18:50:44 +0000 (21:50 +0300)]
tests: Add P2P channel selection test cases for group re-invocation

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

10 years agotests: Add P2P channel selection test cases with world roaming
Jouni Malinen [Sat, 26 Oct 2013 18:02:42 +0000 (21:02 +0300)]
tests: Add P2P channel selection test cases with world roaming

This verifies that passive scan 5 GHz channels are not selected with and
without p2p_add_cli_chan=1.

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

10 years agotests: Add P2P channel selection test cases for group formation
Jouni Malinen [Sat, 26 Oct 2013 17:47:08 +0000 (20:47 +0300)]
tests: Add P2P channel selection test cases for group formation

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

10 years agoP2P: Add option to allow additional client channels
Jouni Malinen [Tue, 22 Oct 2013 18:00:49 +0000 (21:00 +0300)]
P2P: Add option to allow additional client channels

The new p2p_add_cli_chan=1 configuration parameter can be used to
request passive-scan channels to be included in P2P channel lists for
cases where the local end may become the P2P client in a group. This
allows more options for the peer to use channels, e.g., if the local
device is not aware of its current location and has marked most channels
to require passive scanning.

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

10 years agoP2P: Add option to remove channels from GO use
Jouni Malinen [Tue, 22 Oct 2013 16:45:46 +0000 (19:45 +0300)]
P2P: Add option to remove channels from GO use

The new p2p_no_go_freq frequency range list (comma-separated list of
min-max frequency ranges in MHz) can now be used to configure channels
on which the local device is not allowed to operate as a GO, but on
which that device can be a P2P Client. These channels are left in the
P2P Channel List in GO Negotiation to allow the peer device to select
one of the channels for the cases where the peer becomes the GO. The
local end will remove these channels from consideration if it becomes
the GO.

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

10 years agoUse ARRAY_SIZE() macro
Jouni Malinen [Sat, 26 Oct 2013 14:00:57 +0000 (17:00 +0300)]
Use ARRAY_SIZE() macro

Replace the common sizeof(a)/sizeof(a[0]) constructions with a more
readable version.

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

10 years agoIntroduce ARRAY_SIZE() macro
Jouni Malinen [Sat, 26 Oct 2013 14:00:01 +0000 (17:00 +0300)]
Introduce ARRAY_SIZE() macro

This can be used to clean up the common sizeof(a)/sizeof(a[0])
constructions to use a more readable version.

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

10 years agoDFS: Handle radar event when CAC actived correctly
Janusz Dziedzic [Sat, 26 Oct 2013 13:36:00 +0000 (16:36 +0300)]
DFS: Handle radar event when CAC actived correctly

When we have CAC active and receive a radar event, we should ignore
CAC_ABORT event and handle channel switch in the radar event handler.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>

10 years agoDFS: Fix overlapped() function to check only DFS channels
Janusz Dziedzic [Sat, 26 Oct 2013 13:30:42 +0000 (16:30 +0300)]
DFS: Fix overlapped() function to check only DFS channels

This fixes a problem when operating on non-DFS channel and receiving a
radar event for that channel. Previously, we would have decided to
switch channels.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>

10 years agoDFS: Adjust center freq correctly for VHT20/VHT40
Janusz Dziedzic [Sat, 26 Oct 2013 13:28:45 +0000 (16:28 +0300)]
DFS: Adjust center freq correctly for VHT20/VHT40

Setup correct seg0 for VHT with 20/40 MHz width (VHT_CHANWIDTH_USE_HT).

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>

10 years agoDFS: Fix available channels list for VHT80
Janusz Dziedzic [Sat, 26 Oct 2013 13:25:41 +0000 (16:25 +0300)]
DFS: Fix available channels list for VHT80

Add a table of available VHT80 channels. This table contains the first
available channel. We will also choose this first channel as the control
one.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>

10 years agonl80211: Add debug prints on nl_recvmsgs() failure
Jouni Malinen [Sat, 26 Oct 2013 13:13:34 +0000 (16:13 +0300)]
nl80211: Add debug prints on nl_recvmsgs() failure

These libnl calls could potentially fail and it is useful to know if
that has happened.

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

10 years agonl80211: Make eloop sockets non-blocking
Johannes Berg [Sat, 26 Oct 2013 13:09:56 +0000 (16:09 +0300)]
nl80211: Make eloop sockets non-blocking

To avoid a problem where the beacon socket occasionally
blocks, mark any sockets on the eloop as non-blocking.
The previous patch reordered the code to never send a
command after a socket was put on the eloop, but now also
invalidate the nl handle pointer while it's on there.

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

10 years agonl80211: Abstract handling of sockets on eloop
Johannes Berg [Sat, 26 Oct 2013 13:06:49 +0000 (16:06 +0300)]
nl80211: Abstract handling of sockets on eloop

Abstract the handling of sockets on the eloop to avoid
destroying sockets still on the eloop and also to allow
the next patch to mark the socket non-blocking.

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

10 years agonl80211: Register for IBSS auth frames before eloop
Johannes Berg [Sat, 26 Oct 2013 13:00:52 +0000 (16:00 +0300)]
nl80211: Register for IBSS auth frames before eloop

The IBSS code registers the bss nl_mgmt socket for auth
frames when the join event happens, but that is too late
as then the socket is already on the eloop, which could
cause problems when other events are received at the
same time as the registration is done.

Move the auth frame registration to the initial setup
before the socket is put onto the eloop.

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

10 years agoClean up get_seqnum() use for IPN
Jouni Malinen [Sat, 26 Oct 2013 10:30:28 +0000 (13:30 +0300)]
Clean up get_seqnum() use for IPN

Some driver wrappers may implement this by writing eight octets even
though IPN is only six octets. Use a separate WPA_KEY_RSC_LEN (8) octet
buffer in the call to make sure there is enough buffer room available
for the full returned value and then copy it to IPN field.

The previous implementation used the following igtk field as the extra
buffer and then initialized that field afterwards, so this change does
not fix any real issue in behavior, but it is cleaner to use an explicit
buffer of the maximum length for get_seqnum().

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

10 years agoStop ctrl_iface monitor send loop on reinit failure
Jouni Malinen [Sat, 26 Oct 2013 10:18:40 +0000 (13:18 +0300)]
Stop ctrl_iface monitor send loop on reinit failure

There is no point trying to continue sending messages with sendmsg() if
socket reinitialization fails.

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

10 years agoRemove unnecessary wpa_s->conf checks
Jouni Malinen [Sat, 26 Oct 2013 10:09:50 +0000 (13:09 +0300)]
Remove unnecessary wpa_s->conf checks

wpa_s->conf cannot be NULL because wpa_supplicant_init_iface() would not
allow wpa_supplicant_add_iface() to return wpa_s instance in such state.

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

10 years agoAdd explicit buffer length checks for p2p_build_wps_ie()
Jouni Malinen [Sat, 26 Oct 2013 09:54:20 +0000 (12:54 +0300)]
Add explicit buffer length checks for p2p_build_wps_ie()

Even though the length of this buffer is based only on locally
configured information, it is cleaner to include explicit buffer room
validation steps when adding the attributes into the buffer.

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

10 years agoVerify that readlink() did not truncate result
Jouni Malinen [Sat, 26 Oct 2013 09:25:20 +0000 (12:25 +0300)]
Verify that readlink() did not truncate result

linux_br_get() was forcing null termination on the buffer, but did not
check whether the string could have been truncated. Make this more
strict by rejecting any truncation case.

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

10 years agonl80211: Clean up if_add() for hostapd use
Jouni Malinen [Sat, 26 Oct 2013 09:14:03 +0000 (12:14 +0300)]
nl80211: Clean up if_add() for hostapd use

The allocation of new_bss and its use was separated by a lot of code in
this function. This can be cleaned up by moving the allocation next to
the use, so that this all can be within a single #ifdef HOSTAPD block.
The i802_check_bridge() call was outside type == WPA_IF_AP_BSS case, but
in practice, it is only used for WPA_IF_AP_BSS (and if used for
something else, this would have resulted in NULL pointer dereference
anyway).

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

10 years agoOpenSSL: Fix memory leak on error path
Jouni Malinen [Sat, 26 Oct 2013 09:02:50 +0000 (12:02 +0300)]
OpenSSL: Fix memory leak on error path

If SSL_CTX_new() fails in tls_init(), the per-SSL app-data allocation
could have been leaked when multiple TLS instances are allocated.

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

10 years agonl80211: Fix strerror() value in P2P Dev debug messages
Jouni Malinen [Sat, 26 Oct 2013 08:53:02 +0000 (11:53 +0300)]
nl80211: Fix strerror() value in P2P Dev debug messages

send_and_recv_msgs() returns negative errno, so need to use -ret in the
strerror() call.

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

10 years agoDFS: Add forgotten break statement
Jouni Malinen [Sat, 26 Oct 2013 08:49:46 +0000 (11:49 +0300)]
DFS: Add forgotten break statement

The VHT_CHANWIDTH_160MHZ case fell through to the default case and
printed out a debug message that was not supposed to be shown here.

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

10 years agoRemove os_strncpy()
Jouni Malinen [Sat, 26 Oct 2013 08:43:28 +0000 (11:43 +0300)]
Remove os_strncpy()

os_strlpcy() should be used instead of os_strncpy() to guarantee null
termination. Since there are no remaining strncpy uses, remove
os_strncpy() definition.

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

10 years agoReplace remainining strncpy() uses with strlcpy()
Jouni Malinen [Sat, 26 Oct 2013 08:42:09 +0000 (11:42 +0300)]
Replace remainining strncpy() uses with strlcpy()

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

10 years agoP2P: Fix snprintf buffer length for group ifname backup
Jouni Malinen [Thu, 24 Oct 2013 17:13:32 +0000 (20:13 +0300)]
P2P: Fix snprintf buffer length for group ifname backup

Commit 2e5ba4b6d14e600d259bbaf59a8fca61dab8f987 moved this to a function
and updated one of the os_snprintf() calls to use the len parameter, but
forgot the other one.

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

10 years agoeap_proxy: Add context data pointer to the get_imsi call
Naresh Jayaram [Wed, 23 Oct 2013 16:19:25 +0000 (19:19 +0300)]
eap_proxy: Add context data pointer to the get_imsi call

This was already included in all the other calls to eap_proxy, but
somehow the get_imsi call had been forgotten.

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

10 years agoeap_proxy: Confirm eap_proxy initialization before reading SIM info
Naresh Jayaram [Wed, 23 Oct 2013 16:17:14 +0000 (19:17 +0300)]
eap_proxy: Confirm eap_proxy initialization before reading SIM info

Trying to access the SIM card details without checking if the eap_proxy
layer has been initialized can results in a crash. Address this by
sending the request for the IMSI through eapol_supp_sm.c which can
verify that eap_proxy has been initialized.

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

10 years agoP2P: Check Action frame payload match before accepted TX status
Po-Lun Lai [Wed, 23 Oct 2013 10:16:31 +0000 (13:16 +0300)]
P2P: Check Action frame payload match before accepted TX status

It is possible for there to be two pending off-channel TX frames, e.g.,
when two devices initiate GO Negotiation at more or less the same time.
This could result in the TX status report for the first frame clearing
wpa_s->pending_action_tx that included the newer frame that has not yet
been transmitted (i.e., is waiting to be sent out). Avoid losing that
frame by confirming that the TX status payload matches the pending frame
before clearing the pending frame and reporting the TX status callback.

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